diff --git a/packages/core/src/modules/connections/DidExchangeProtocol.ts b/packages/core/src/modules/connections/DidExchangeProtocol.ts index bc2a4e939e..53490db0a3 100644 --- a/packages/core/src/modules/connections/DidExchangeProtocol.ts +++ b/packages/core/src/modules/connections/DidExchangeProtocol.ts @@ -189,6 +189,7 @@ export class DidExchangeProtocol { protocol: HandshakeProtocol.DidExchange, role: DidExchangeRole.Responder, state: DidExchangeState.RequestReceived, + alias: outOfBandRecord.alias, theirDid: message.did, theirLabel: message.label, threadId: message.threadId, diff --git a/packages/core/src/modules/connections/services/ConnectionService.ts b/packages/core/src/modules/connections/services/ConnectionService.ts index 5b7de49125..719e80429f 100644 --- a/packages/core/src/modules/connections/services/ConnectionService.ts +++ b/packages/core/src/modules/connections/services/ConnectionService.ts @@ -173,6 +173,7 @@ export class ConnectionService { protocol: HandshakeProtocol.Connections, role: DidExchangeRole.Responder, state: DidExchangeState.RequestReceived, + alias: outOfBandRecord.alias, theirLabel: message.label, imageUrl: message.imageUrl, outOfBandId: outOfBandRecord.id, diff --git a/packages/core/src/modules/oob/OutOfBandModule.ts b/packages/core/src/modules/oob/OutOfBandModule.ts index cdd722aefc..463f2f1a13 100644 --- a/packages/core/src/modules/oob/OutOfBandModule.ts +++ b/packages/core/src/modules/oob/OutOfBandModule.ts @@ -46,7 +46,7 @@ const didCommProfiles = ['didcomm/aip1', 'didcomm/aip2;env=rfc19'] export interface CreateOutOfBandInvitationConfig { label?: string - alias?: string + alias?: string // alias for a connection record to be created imageUrl?: string goalCode?: string goal?: string @@ -61,7 +61,7 @@ export interface CreateOutOfBandInvitationConfig { export interface CreateLegacyInvitationConfig { label?: string - alias?: string + alias?: string // alias for a connection record to be created imageUrl?: string multiUseInvitation?: boolean autoAcceptConnection?: boolean @@ -208,6 +208,7 @@ export class OutOfBandModule { mediatorId: routing.mediatorId, role: OutOfBandRole.Sender, state: OutOfBandState.AwaitResponse, + alias: config.alias, outOfBandInvitation: outOfBandInvitation, reusable: multiUseInvitation, autoAcceptConnection, diff --git a/packages/core/src/modules/oob/repository/OutOfBandRecord.ts b/packages/core/src/modules/oob/repository/OutOfBandRecord.ts index 3a67aa4aa7..ec291225c2 100644 --- a/packages/core/src/modules/oob/repository/OutOfBandRecord.ts +++ b/packages/core/src/modules/oob/repository/OutOfBandRecord.ts @@ -27,6 +27,7 @@ export interface OutOfBandRecordProps { outOfBandInvitation: OutOfBandInvitation role: OutOfBandRole state: OutOfBandState + alias?: string autoAcceptConnection?: boolean reusable?: boolean mediatorId?: string @@ -38,6 +39,7 @@ export class OutOfBandRecord extends BaseRecord { goal: 'To make a connection', goalCode: 'p2p-messaging', label: 'Faber College', + alias: `Faber's connection with Alice`, } const issueCredentialConfig = { @@ -158,10 +159,11 @@ describe('out of band', () => { expect(outOfBandRecord.autoAcceptConnection).toBe(true) expect(outOfBandRecord.role).toBe(OutOfBandRole.Sender) expect(outOfBandRecord.state).toBe(OutOfBandState.AwaitResponse) + expect(outOfBandRecord.alias).toBe(makeConnectionConfig.alias) expect(outOfBandRecord.reusable).toBe(false) - expect(outOfBandRecord.outOfBandInvitation.goal).toBe('To make a connection') - expect(outOfBandRecord.outOfBandInvitation.goalCode).toBe('p2p-messaging') - expect(outOfBandRecord.outOfBandInvitation.label).toBe('Faber College') + expect(outOfBandRecord.outOfBandInvitation.goal).toBe(makeConnectionConfig.goal) + expect(outOfBandRecord.outOfBandInvitation.goalCode).toBe(makeConnectionConfig.goalCode) + expect(outOfBandRecord.outOfBandInvitation.label).toBe(makeConnectionConfig.label) }) test('create OOB message only with handshake', async () => { @@ -290,6 +292,7 @@ describe('out of band', () => { expect(aliceFaberConnection).toBeConnectedWith(faberAliceConnection!) expect(faberAliceConnection).toBeConnectedWith(aliceFaberConnection) + expect(faberAliceConnection.alias).toBe(makeConnectionConfig.alias) }) test(`make a connection with ${HandshakeProtocol.Connections} based on OOB invitation encoded in URL`, async () => { @@ -311,6 +314,7 @@ describe('out of band', () => { expect(aliceFaberConnection).toBeConnectedWith(faberAliceConnection) expect(faberAliceConnection).toBeConnectedWith(aliceFaberConnection) + expect(faberAliceConnection.alias).toBe(makeConnectionConfig.alias) }) test('make a connection based on old connection invitation encoded in URL', async () => {