Skip to content

Commit 2589966

Browse files
Update agent modules setup + remove mediator functionality
Signed-off-by: Alexander Shenshin <alexander.shenshin@dsr-corporation.com>
1 parent 2a71269 commit 2589966

32 files changed

Lines changed: 226 additions & 380 deletions

heka-identity-service/docs/setup.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ You can modify JWT verification options by setting the following environment var
3838

3939
While integration with external auth providers is supported, it's recommended to use [Heka Auth Service](https://github.com/hiero-ledger/heka-identity-platform/tree/main/heka-auth-service) for basic deployments.
4040

41-
## Mediator
42-
43-
Heka Identity Service can also function as a Credo Mediator. To enable this functionality
44-
set `AGENT_AUTO_ACCEPT_MEDIATION_REQUESTS` environment variable to `true`
45-
4641
## Persistence
4742

4843
For persistence this backend uses `MikroORM` with `Postgres` and requires access to pre-configured `Postgres` instance.

heka-identity-service/jest.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ const config: Config = {
3535
// Force CJS builds for other @hiero-did-sdk packages which expose ESM via .js extension without "type":"module"
3636
'^@hiero-did-sdk/(.+)$': '<rootDir>/node_modules/@hiero-did-sdk/$1/dist/index.cjs.js',
3737
},
38-
transformIgnorePatterns: ['/node_modules/(?!(@credo-ts|@openid4vc|dcql|@noble|@sphereon|@sd-jwt|@stablelib|@digitalcredentials|uuid)/)'],
38+
transformIgnorePatterns: [
39+
'/node_modules/(?!(@credo-ts|@openid4vc|dcql|@noble|@sphereon|@sd-jwt|@stablelib|@digitalcredentials|uuid)/)',
40+
],
3941
verbose: true,
4042
}
4143

heka-identity-service/package.json

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@
2828
"postinstall": "patch-package"
2929
},
3030
"dependencies": {
31-
"@credo-ts/anoncreds": "v0.6.2",
32-
"@credo-ts/askar": "v0.6.2",
33-
"@credo-ts/core": "v0.6.2",
34-
"@credo-ts/didcomm": "v0.6.2",
35-
"@credo-ts/hedera": "0.6.0",
36-
"@credo-ts/indy-vdr": "v0.6.2",
37-
"@credo-ts/node": "v0.6.2",
38-
"@credo-ts/openid4vc": "v0.6.2",
39-
"@credo-ts/tenants": "v0.6.2",
31+
"@credo-ts/anoncreds": "0.6.2",
32+
"@credo-ts/askar": "0.6.2",
33+
"@credo-ts/core": "0.6.2",
34+
"@credo-ts/didcomm": "0.6.2",
35+
"@credo-ts/hedera": "0.6.2",
36+
"@credo-ts/indy-vdr": "0.6.2",
37+
"@credo-ts/node": "0.6.2",
38+
"@credo-ts/openid4vc": "0.6.2",
39+
"@credo-ts/tenants": "0.6.2",
4040
"@digitalcredentials/bitstring": "^3.1.2",
4141
"@hyperledger/anoncreds-nodejs": "^0.3.1",
4242
"@hyperledger/indy-vdr-nodejs": "^0.2.2",
@@ -128,9 +128,7 @@
128128
},
129129
"resolutions": {
130130
"@types/jsonwebtoken": "^9.0.10",
131-
"reflect-metadata": "0.2.2",
132-
"@credo-ts/core": "v0.6.2",
133-
"@credo-ts/anoncreds": "v0.6.2"
131+
"reflect-metadata": "0.2.2"
134132
},
135133
"packageManager": "yarn@4.9.4"
136134
}

heka-identity-service/src/app.module.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ import { VerificationTemplateModule } from 'verification-template/verification-t
1515
import { LoggerModule } from './common/logger'
1616
import { OCAModule } from './common/oca/oca.module'
1717
import { fileStorageConfigDefaults } from './config/file-storage'
18-
19-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
20-
const _appRoot = typeof __dirname !== 'undefined' ? resolve(__dirname, '..') : process.cwd()
2118
import { ConnectionModule } from './connection'
2219
import { CoreModule } from './core'
2320
import { CredentialModule } from './credential'
@@ -32,6 +29,8 @@ import { SchemaModule } from './schema'
3229
import { SchemaV2Module } from './schema-v2'
3330
import { UserModule } from './user'
3431

32+
const _appRoot = typeof __dirname !== 'undefined' ? resolve(__dirname, '..') : process.cwd()
33+
3534
@Module({
3635
imports: [
3736
ServeStaticModule.forRoot({

heka-identity-service/src/common/agent/agent-modules.provider.ts

Lines changed: 46 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,8 @@ import {
2121
import {
2222
DidCommAutoAcceptCredential,
2323
DidCommAutoAcceptProof,
24-
DidCommConnectionsModule,
25-
DidCommCredentialsModule,
2624
DidCommModule,
2725
DidCommDifPresentationExchangeProofFormatService,
28-
DidCommMediatorModule,
29-
DidCommMessagePickupModule,
30-
DidCommOutOfBandModule,
31-
DidCommProofsModule,
3226
DidCommCredentialV2Protocol,
3327
DidCommProofV2Protocol,
3428
} from '@credo-ts/didcomm'
@@ -39,7 +33,7 @@ import {
3933
IndyVdrIndyDidResolver,
4034
IndyVdrModule,
4135
} from '@credo-ts/indy-vdr'
42-
import { OpenId4VcIssuerModule, OpenId4VcVerifierModule } from '@credo-ts/openid4vc'
36+
import { OpenId4VcModule } from '@credo-ts/openid4vc'
4337
import { TenantsModule } from '@credo-ts/tenants'
4438
import { anoncreds } from '@hyperledger/anoncreds-nodejs'
4539
import { indyVdr } from '@hyperledger/indy-vdr-nodejs'
@@ -62,80 +56,79 @@ function getTenantModulesMap(appConfig: ConfigType<typeof AppConfig>, agencyConf
6256
const presentationExchangeProofFormatService = new DidCommDifPresentationExchangeProofFormatService()
6357

6458
const didResolvers: DidResolver[] = [new KeyDidResolver()]
65-
const didRegisters: DidRegistrar[] = [new KeyDidRegistrar()]
66-
const anoncredsRegstries: AnonCredsRegistry[] = []
59+
const didRegistrars: DidRegistrar[] = [new KeyDidRegistrar()]
60+
const anoncredsRegistries: AnonCredsRegistry[] = []
6761

6862
if (agencyConfig.didMethods.includes('indy')) {
6963
didResolvers.push(new IndyVdrIndyDidResolver())
70-
didRegisters.push(new IndyVdrIndyDidRegistrar())
71-
anoncredsRegstries.push(new IndyVdrAnonCredsRegistry())
64+
didRegistrars.push(new IndyVdrIndyDidRegistrar())
65+
anoncredsRegistries.push(new IndyVdrAnonCredsRegistry())
7266
}
7367
if (agencyConfig.didMethods.includes('indybesu')) {
7468
didResolvers.push(new IndyBesuDidResolver())
75-
didRegisters.push(new IndyBesuDidRegistrar())
76-
anoncredsRegstries.push(new IndyBesuAnonCredsRegistry())
69+
didRegistrars.push(new IndyBesuDidRegistrar())
70+
anoncredsRegistries.push(new IndyBesuAnonCredsRegistry())
7771
}
7872
if (agencyConfig.didMethods.includes('hedera')) {
7973
didResolvers.push(new HederaDidResolver())
80-
didRegisters.push(new HederaDidRegistrar())
81-
anoncredsRegstries.push(new HederaAnonCredsRegistry())
74+
didRegistrars.push(new HederaDidRegistrar())
75+
anoncredsRegistries.push(new HederaAnonCredsRegistry())
8276
}
8377

8478
return {
85-
connections: new DidCommConnectionsModule({
86-
autoAcceptConnections: true,
87-
}),
88-
credentials: new DidCommCredentialsModule({
89-
autoAcceptCredentials: DidCommAutoAcceptCredential.ContentApproved,
90-
credentialProtocols: [
91-
new DidCommCredentialV2Protocol({
92-
credentialFormats: [
93-
credentialFormatService,
94-
legacyIndyCredentialFormatService,
95-
dataIntegrityCredentialFormatService,
96-
// new JsonLdCredentialFormatService()
97-
],
98-
}),
99-
],
100-
}),
101-
proofs: new DidCommProofsModule({
102-
autoAcceptProofs: DidCommAutoAcceptProof.ContentApproved,
103-
proofProtocols: [
104-
new DidCommProofV2Protocol({
105-
proofFormats: [legacyIndyProofFormatService, proofFormatService, presentationExchangeProofFormatService],
106-
}),
107-
],
108-
}),
109-
didcomm: new DidCommModule(agencyConfig.didCommConfig),
110-
oob: new DidCommOutOfBandModule(),
111-
messagePickup: new DidCommMessagePickupModule(),
112-
mediator: new DidCommMediatorModule({
113-
autoAcceptMediationRequests: agencyConfig.autoAcceptMediationRequests,
79+
didcomm: new DidCommModule({
80+
...agencyConfig.didCommConfig,
81+
messagePickup: true,
82+
connections: {
83+
autoAcceptConnections: true,
84+
},
85+
credentials: {
86+
autoAcceptCredentials: DidCommAutoAcceptCredential.ContentApproved,
87+
credentialProtocols: [
88+
new DidCommCredentialV2Protocol({
89+
credentialFormats: [
90+
credentialFormatService,
91+
legacyIndyCredentialFormatService,
92+
dataIntegrityCredentialFormatService,
93+
// new JsonLdCredentialFormatService()
94+
],
95+
}),
96+
],
97+
},
98+
proofs: {
99+
autoAcceptProofs: DidCommAutoAcceptProof.ContentApproved,
100+
proofProtocols: [
101+
new DidCommProofV2Protocol({
102+
proofFormats: [legacyIndyProofFormatService, proofFormatService, presentationExchangeProofFormatService],
103+
}),
104+
],
105+
},
114106
}),
115107
dids: new DidsModule({
116108
resolvers: didResolvers,
117-
registrars: didRegisters,
109+
registrars: didRegistrars,
118110
}),
119111
cache: new CacheModule({
120112
cache: new InMemoryLruCache({ limit: 100 }),
121113
}),
122114
anoncreds: new AnonCredsModule({
123115
// @ts-ignore
124-
registries: anoncredsRegstries,
116+
registries: anoncredsRegistries,
125117
anoncreds,
126118
tailsFileService: new TailsService(appConfig),
127119
}),
128120
askar: new AskarModule({
129121
askar,
130122
store: agencyConfig.askarStoreConfig,
131123
}),
132-
openId4VcIssuer: new OpenId4VcIssuerModule({
133-
baseUrl: agencyConfig.oidConfig.issuanceEndpoint,
134-
app: agencyConfig.oidConfig.app,
135-
credentialRequestToCredentialMapper,
136-
}),
137-
openId4VcVerifier: new OpenId4VcVerifierModule({
138-
baseUrl: agencyConfig.oidConfig.verificationEndpoint,
124+
openid4vc: new OpenId4VcModule({
125+
issuer: {
126+
baseUrl: agencyConfig.oidConfig.issuanceEndpoint,
127+
credentialRequestToCredentialMapper,
128+
},
129+
verifier: {
130+
baseUrl: agencyConfig.oidConfig.verificationEndpoint,
131+
},
139132
app: agencyConfig.oidConfig.app,
140133
}),
141134
ledgerSdk: new IndyVdrModule({

heka-identity-service/src/common/agent/agent.module.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ import { Module } from '@nestjs/common'
22

33
import { agentModulesProvider } from './agent-modules.provider'
44
import { agentProvider, AGENT_TOKEN } from './agent.provider'
5-
import { MediatorService } from './mediator.service'
65

76
@Module({
8-
providers: [agentModulesProvider, agentProvider, MediatorService],
7+
providers: [agentModulesProvider, agentProvider],
98
exports: [AGENT_TOKEN],
109
})
1110
export class AgentModule {}

heka-identity-service/src/common/agent/agent.provider.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ export class Agent extends CredoAgent<AgencyModulesMap> implements OnApplication
3838

3939
this.modules.didcomm.registerOutboundTransport(new DidCommHttpOutboundTransport())
4040
if (this.agencyConfig.httpPort) {
41-
this.modules.didcomm.registerInboundTransport(new DidCommHttpInboundTransport({ port: this.agencyConfig.httpPort }))
41+
this.modules.didcomm.registerInboundTransport(
42+
new DidCommHttpInboundTransport({ port: this.agencyConfig.httpPort }),
43+
)
4244
}
4345

4446
this.modules.didcomm.registerOutboundTransport(new DidCommWsOutboundTransport())

0 commit comments

Comments
 (0)