Skip to content

Commit f6f9fd8

Browse files
committed
resolves issues with credo version update
Signed-off-by: nodirbek.parpibaev <nodirbek.parpibaev@dsr-corporation.com>
1 parent fd248bb commit f6f9fd8

23 files changed

Lines changed: 148 additions & 147 deletions

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

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import type { AnonCredsRegistry } from '@credo-ts/anoncreds'
22

33
import {
4-
AnonCredsCredentialFormatService,
4+
AnonCredsDidCommCredentialFormatService,
55
AnonCredsModule,
6-
AnonCredsProofFormatService,
7-
DataIntegrityCredentialFormatService,
8-
LegacyIndyCredentialFormatService,
9-
LegacyIndyProofFormatService,
6+
AnonCredsDidCommProofFormatService,
7+
DataIntegrityDidCommCredentialFormatService,
8+
LegacyIndyDidCommCredentialFormatService,
9+
LegacyIndyDidCommProofFormatService,
1010
} from '@credo-ts/anoncreds'
1111
import { AskarModule } from '@credo-ts/askar'
1212
import {
@@ -19,16 +19,16 @@ import {
1919
KeyDidResolver,
2020
} from '@credo-ts/core'
2121
import {
22-
AutoAcceptCredential,
23-
AutoAcceptProof,
22+
DidCommAutoAcceptCredential,
23+
DidCommAutoAcceptProof,
24+
DidCommConnectionsModule,
25+
DidCommCredentialV2Protocol,
26+
DidCommCredentialsModule,
27+
DidCommDifPresentationExchangeProofFormatService,
2428
DidCommModule,
25-
DifPresentationExchangeProofFormatService,
26-
V2CredentialProtocol,
27-
V2ProofProtocol,
28-
ConnectionsModule,
29-
CredentialsModule,
30-
ProofsModule,
31-
OutOfBandModule,
29+
DidCommOutOfBandModule,
30+
DidCommProofV2Protocol,
31+
DidCommProofsModule,
3232
} from '@credo-ts/didcomm'
3333
import { HederaAnonCredsRegistry, HederaDidRegistrar, HederaDidResolver, HederaModule } from '@credo-ts/hedera'
3434
import {
@@ -37,7 +37,7 @@ import {
3737
IndyVdrIndyDidResolver,
3838
IndyVdrModule,
3939
} from '@credo-ts/indy-vdr'
40-
import { OpenId4VcIssuerModule, OpenId4VcVerifierModule } from '@credo-ts/openid4vc'
40+
import { OpenId4VcModule } from '@credo-ts/openid4vc'
4141
import { TenantsModule } from '@credo-ts/tenants'
4242
import { anoncreds } from '@hyperledger/anoncreds-nodejs'
4343
import { indyVdr } from '@hyperledger/indy-vdr-nodejs'
@@ -52,12 +52,12 @@ import { TailsService } from '../../revocation/revocation-registry/tails.service
5252
import { IndyBesuAnonCredsRegistry, IndyBesuDidRegistrar, IndyBesuDidResolver, IndyBesuModule } from '../indy-besu-vdr'
5353

5454
function getTenantModulesMap(appConfig: ConfigType<typeof AppConfig>, agencyConfig: ConfigType<typeof AgentConfig>) {
55-
const credentialFormatService = new AnonCredsCredentialFormatService()
56-
const proofFormatService = new AnonCredsProofFormatService()
57-
const legacyIndyCredentialFormatService = new LegacyIndyCredentialFormatService()
58-
const legacyIndyProofFormatService = new LegacyIndyProofFormatService()
59-
const dataIntegrityCredentialFormatService = new DataIntegrityCredentialFormatService()
60-
const presentationExchangeProofFormatService = new DifPresentationExchangeProofFormatService()
55+
const credentialFormatService = new AnonCredsDidCommCredentialFormatService()
56+
const proofFormatService = new AnonCredsDidCommProofFormatService()
57+
const legacyIndyCredentialFormatService = new LegacyIndyDidCommCredentialFormatService()
58+
const legacyIndyProofFormatService = new LegacyIndyDidCommProofFormatService()
59+
const dataIntegrityCredentialFormatService = new DataIntegrityDidCommCredentialFormatService()
60+
const presentationExchangeProofFormatService = new DidCommDifPresentationExchangeProofFormatService()
6161

6262
const didResolvers: DidResolver[] = [new KeyDidResolver()]
6363
const didRegistrars: DidRegistrar[] = [new KeyDidRegistrar()]
@@ -83,13 +83,13 @@ function getTenantModulesMap(appConfig: ConfigType<typeof AppConfig>, agencyConf
8383
didcomm: new DidCommModule({
8484
...agencyConfig.didCommConfig,
8585
}),
86-
connections: new ConnectionsModule({
86+
connections: new DidCommConnectionsModule({
8787
autoAcceptConnections: true,
8888
}),
89-
credentials: new CredentialsModule({
90-
autoAcceptCredentials: AutoAcceptCredential.ContentApproved,
89+
credentials: new DidCommCredentialsModule({
90+
autoAcceptCredentials: DidCommAutoAcceptCredential.ContentApproved,
9191
credentialProtocols: [
92-
new V2CredentialProtocol({
92+
new DidCommCredentialV2Protocol({
9393
credentialFormats: [
9494
credentialFormatService,
9595
legacyIndyCredentialFormatService,
@@ -99,15 +99,15 @@ function getTenantModulesMap(appConfig: ConfigType<typeof AppConfig>, agencyConf
9999
}),
100100
],
101101
}),
102-
proofs: new ProofsModule({
103-
autoAcceptProofs: AutoAcceptProof.ContentApproved,
102+
proofs: new DidCommProofsModule({
103+
autoAcceptProofs: DidCommAutoAcceptProof.ContentApproved,
104104
proofProtocols: [
105-
new V2ProofProtocol({
105+
new DidCommProofV2Protocol({
106106
proofFormats: [legacyIndyProofFormatService, proofFormatService, presentationExchangeProofFormatService],
107107
}),
108108
],
109109
}),
110-
oob: new OutOfBandModule(),
110+
oob: new DidCommOutOfBandModule(),
111111
dids: new DidsModule({
112112
resolvers: didResolvers,
113113
registrars: didRegistrars,
@@ -125,16 +125,16 @@ function getTenantModulesMap(appConfig: ConfigType<typeof AppConfig>, agencyConf
125125
askar,
126126
store: agencyConfig.askarStoreConfig,
127127
}),
128-
openId4VcIssuer: new OpenId4VcIssuerModule({
129-
baseUrl: agencyConfig.oidConfig.issuanceEndpoint,
130-
credentialRequestToCredentialMapper: createCredentialRequestToCredentialMapper(agencyConfig.mdlIssuerCertificate),
128+
openId4Vc: new OpenId4VcModule({
131129
// eslint-disable-next-line @typescript-eslint/no-explicit-any
132-
router: agencyConfig.oidConfig.app as any,
133-
}),
134-
openId4VcVerifier: new OpenId4VcVerifierModule({
135-
baseUrl: agencyConfig.oidConfig.verificationEndpoint,
136-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
137-
router: agencyConfig.oidConfig.app as any,
130+
app: agencyConfig.oidConfig.app as any,
131+
issuer: {
132+
baseUrl: agencyConfig.oidConfig.issuanceEndpoint,
133+
credentialRequestToCredentialMapper: createCredentialRequestToCredentialMapper(agencyConfig.mdlIssuerCertificate),
134+
},
135+
verifier: {
136+
baseUrl: agencyConfig.oidConfig.verificationEndpoint,
137+
},
138138
}),
139139
ledgerSdk: new IndyVdrModule({
140140
indyVdr,

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Agent as CredoAgent, BaseAgent, LogLevel } from '@credo-ts/core'
2-
import { HttpOutboundTransport, WsOutboundTransport } from '@credo-ts/didcomm'
3-
import { agentDependencies, HttpInboundTransport, WsInboundTransport } from '@credo-ts/node'
2+
import { DidCommHttpOutboundTransport, DidCommWsOutboundTransport } from '@credo-ts/didcomm'
3+
import { agentDependencies, DidCommHttpInboundTransport, DidCommWsInboundTransport } from '@credo-ts/node'
44
import { OnApplicationShutdown } from '@nestjs/common'
55
import { ConfigType } from '@nestjs/config'
66

@@ -36,16 +36,16 @@ export class Agent extends CredoAgent<AgencyModulesMap> implements OnApplication
3636

3737
logger.info(`Agent config:\n${JSON.stringify(this.agencyConfig, undefined, 2)}`)
3838

39-
this.modules.didcomm.registerOutboundTransport(new HttpOutboundTransport())
39+
this.modules.didcomm.registerOutboundTransport(new DidCommHttpOutboundTransport())
4040
if (this.agencyConfig.httpPort) {
4141
this.modules.didcomm.registerInboundTransport(
42-
new HttpInboundTransport({ port: this.agencyConfig.httpPort }),
42+
new DidCommHttpInboundTransport({ port: this.agencyConfig.httpPort }),
4343
)
4444
}
4545

46-
this.modules.didcomm.registerOutboundTransport(new WsOutboundTransport())
46+
this.modules.didcomm.registerOutboundTransport(new DidCommWsOutboundTransport())
4747
if (this.agencyConfig.wsPort) {
48-
this.modules.didcomm.registerInboundTransport(new WsInboundTransport({ port: this.agencyConfig.wsPort }))
48+
this.modules.didcomm.registerInboundTransport(new DidCommWsInboundTransport({ port: this.agencyConfig.wsPort }))
4949
}
5050

5151
await super.initialize()

heka-identity-service/src/common/notification/dto/connection-state-change.dto.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import {
2-
ConnectionEventTypes,
3-
ConnectionRecord,
4-
ConnectionStateChangedEvent,
5-
DidExchangeState,
6-
ConnectionDidRotatedEvent,
2+
DidCommConnectionEventTypes,
3+
DidCommConnectionRecord,
4+
DidCommConnectionStateChangedEvent,
5+
DidCommDidExchangeState,
6+
DidCommConnectionDidRotatedEvent,
77
} from '@credo-ts/didcomm'
88

99
export class ConnectionStateChangeDetailsDto {
@@ -16,7 +16,7 @@ export class ConnectionStateChangeDetailsDto {
1616
public errorMessage?: string
1717
public invitationDid?: string
1818

19-
public constructor(record: ConnectionRecord) {
19+
public constructor(record: DidCommConnectionRecord) {
2020
this.threadId = record.threadId
2121
this.did = record.did
2222
this.theirDid = record.theirDid
@@ -30,11 +30,11 @@ export class ConnectionStateChangeDetailsDto {
3030

3131
export class ConnectionStateChangeDto {
3232
public id: string
33-
public type: ConnectionEventTypes
34-
public state: DidExchangeState
33+
public type: DidCommConnectionEventTypes
34+
public state: DidCommDidExchangeState
3535
public details: ConnectionStateChangeDetailsDto
3636

37-
public constructor(event: ConnectionStateChangedEvent | ConnectionDidRotatedEvent) {
37+
public constructor(event: DidCommConnectionStateChangedEvent | DidCommConnectionDidRotatedEvent) {
3838
const { connectionRecord } = event.payload
3939
this.id = connectionRecord.id
4040
this.type = event.type
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import {
2-
CredentialEventTypes,
3-
CredentialExchangeRecord,
4-
CredentialState,
5-
CredentialStateChangedEvent,
6-
RevocationNotificationReceivedEvent,
2+
DidCommCredentialEventTypes,
3+
DidCommCredentialExchangeRecord,
4+
DidCommCredentialState,
5+
DidCommCredentialStateChangedEvent,
6+
DidCommRevocationNotificationReceivedEvent,
77
} from '@credo-ts/didcomm'
88

99
import { CredentialPreviewAttributeDto } from 'credential/dto'
@@ -14,7 +14,7 @@ export class CredentialStateChangeDetailsDto {
1414
public errorMessage?: string
1515
public credentialAttributes?: CredentialPreviewAttributeDto[]
1616

17-
public constructor(record: CredentialExchangeRecord) {
17+
public constructor(record: DidCommCredentialExchangeRecord) {
1818
this.connectionId = record.connectionId
1919
this.threadId = record.threadId
2020
this.errorMessage = record.errorMessage
@@ -26,15 +26,15 @@ export class CredentialStateChangeDetailsDto {
2626

2727
export class CredentialStateChangeDto {
2828
public id: string
29-
public type: CredentialEventTypes
30-
public state: CredentialState
29+
public type: DidCommCredentialEventTypes
30+
public state: DidCommCredentialState
3131
public details: CredentialStateChangeDetailsDto
3232

33-
public constructor(event: CredentialStateChangedEvent | RevocationNotificationReceivedEvent) {
34-
const { credentialRecord } = event.payload
35-
this.id = credentialRecord.id
33+
public constructor(event: DidCommCredentialStateChangedEvent | DidCommRevocationNotificationReceivedEvent) {
34+
const { credentialExchangeRecord } = event.payload
35+
this.id = credentialExchangeRecord.id
3636
this.type = event.type
37-
this.state = credentialRecord.state
38-
this.details = new CredentialStateChangeDetailsDto(credentialRecord)
37+
this.state = credentialExchangeRecord.state
38+
this.details = new CredentialStateChangeDetailsDto(credentialExchangeRecord)
3939
}
4040
}

heka-identity-service/src/common/notification/dto/openid-issuer-state-change.dto.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import type { OpenId4VcIssuanceSessionState } from '@credo-ts/openid4vc'
2-
import type { OpenId4VcIssuanceSessionRecord } from '@credo-ts/openid4vc/build/openid4vc-issuer/repository'
1+
import type { OpenId4VcIssuanceSessionState, OpenId4VcIssuanceSessionRecord } from '@credo-ts/openid4vc'
32

43
import { OpenId4VcIssuanceSessionStateChangedEvent, OpenId4VcIssuerEvents } from '@credo-ts/openid4vc'
54

heka-identity-service/src/common/notification/dto/proof-state-change.dto.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {
2-
ProofEventTypes,
3-
ProofExchangeRecord,
4-
ProofState,
5-
ProofStateChangedEvent,
2+
DidCommProofEventTypes,
3+
DidCommProofExchangeRecord,
4+
DidCommProofState,
5+
DidCommProofStateChangedEvent,
66
} from '@credo-ts/didcomm'
77

88
export class ProofStateChangeDetailsDto {
@@ -11,7 +11,7 @@ export class ProofStateChangeDetailsDto {
1111
public isVerified?: boolean
1212
public errorMessage?: string
1313

14-
public constructor(record: ProofExchangeRecord) {
14+
public constructor(record: DidCommProofExchangeRecord) {
1515
this.connectionId = record.connectionId
1616
this.threadId = record.threadId
1717
this.isVerified = record.isVerified
@@ -21,11 +21,11 @@ export class ProofStateChangeDetailsDto {
2121

2222
export class ProofStateChangeDto {
2323
public id: string
24-
public type: ProofEventTypes
25-
public state: ProofState
24+
public type: DidCommProofEventTypes
25+
public state: DidCommProofState
2626
public details: ProofStateChangeDetailsDto
2727

28-
public constructor(event: ProofStateChangedEvent) {
28+
public constructor(event: DidCommProofStateChangedEvent) {
2929
const { proofRecord } = event.payload
3030
this.id = proofRecord.id
3131
this.type = event.type

heka-identity-service/src/common/notification/notification-events.listener.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ConnectionEventTypes, CredentialEventTypes, ProofEventTypes } from '@credo-ts/didcomm'
1+
import { DidCommConnectionEventTypes, DidCommCredentialEventTypes, DidCommProofEventTypes } from '@credo-ts/didcomm'
22
import { OpenId4VcVerifierEvents, OpenId4VcIssuerEvents } from '@credo-ts/openid4vc'
33
import { EntityManager, MikroORM, UseRequestContext } from '@mikro-orm/core'
44
import { Inject, Injectable, OnModuleDestroy, OnModuleInit } from '@nestjs/common'
@@ -19,9 +19,9 @@ import { NotificationService } from './notification.service'
1919
import { NotificationEvent, NotificationEventType } from './notification.types'
2020

2121
const NOTIFICATION_EVENT_TYPES: NotificationEventType[] = [
22-
...Object.values(ConnectionEventTypes),
23-
...Object.values(CredentialEventTypes),
24-
...Object.values(ProofEventTypes),
22+
...Object.values(DidCommConnectionEventTypes),
23+
...Object.values(DidCommCredentialEventTypes),
24+
...Object.values(DidCommProofEventTypes),
2525
...Object.values(OpenId4VcIssuerEvents),
2626
...Object.values(OpenId4VcVerifierEvents),
2727
]
@@ -78,15 +78,15 @@ export class NotificationEventsListener implements OnModuleInit, OnModuleDestroy
7878

7979
private getEventNotificationDto(event: NotificationEvent): NotificationDto {
8080
switch (event.type) {
81-
case ConnectionEventTypes.ConnectionDidRotated:
82-
case ConnectionEventTypes.ConnectionStateChanged: {
81+
case DidCommConnectionEventTypes.DidCommConnectionDidRotated:
82+
case DidCommConnectionEventTypes.DidCommConnectionStateChanged: {
8383
return new ConnectionStateChangeDto(event)
8484
}
85-
case CredentialEventTypes.CredentialStateChanged:
86-
case CredentialEventTypes.RevocationNotificationReceived: {
85+
case DidCommCredentialEventTypes.DidCommCredentialStateChanged:
86+
case DidCommCredentialEventTypes.DidCommRevocationNotificationReceived: {
8787
return new CredentialStateChangeDto(event)
8888
}
89-
case ProofEventTypes.ProofStateChanged: {
89+
case DidCommProofEventTypes.ProofStateChanged: {
9090
return new ProofStateChangeDto(event)
9191
}
9292
case OpenId4VcIssuerEvents.IssuanceSessionStateChanged: {

heka-identity-service/src/common/notification/notification.types.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import {
2-
ConnectionDidRotatedEvent,
3-
ConnectionStateChangedEvent,
4-
CredentialStateChangedEvent,
5-
ProofStateChangedEvent,
6-
RevocationNotificationReceivedEvent,
2+
DidCommConnectionDidRotatedEvent,
3+
DidCommConnectionStateChangedEvent,
4+
DidCommCredentialStateChangedEvent,
5+
DidCommProofStateChangedEvent,
6+
DidCommRevocationNotificationReceivedEvent,
77
} from '@credo-ts/didcomm'
88
import {
99
OpenId4VcVerificationSessionStateChangedEvent,
1010
OpenId4VcIssuanceSessionStateChangedEvent,
1111
} from '@credo-ts/openid4vc'
1212

1313
export type NotificationEvent =
14-
| ConnectionDidRotatedEvent
15-
| ConnectionStateChangedEvent
16-
| CredentialStateChangedEvent
17-
| RevocationNotificationReceivedEvent
18-
| ProofStateChangedEvent
14+
| DidCommConnectionDidRotatedEvent
15+
| DidCommConnectionStateChangedEvent
16+
| DidCommCredentialStateChangedEvent
17+
| DidCommRevocationNotificationReceivedEvent
18+
| DidCommProofStateChangedEvent
1919
| OpenId4VcIssuanceSessionStateChangedEvent
2020
| OpenId4VcVerificationSessionStateChangedEvent
2121

heka-identity-service/src/config/agent.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ export default registerAs('agent', () => {
9595
}
9696

9797
const initConfig: InitConfig = {
98-
label,
9998
autoUpdateStorageOnStartup: true,
10099
allowInsecureHttpUrls: true,
101100
}

0 commit comments

Comments
 (0)