diff --git a/package-lock.json b/package-lock.json index 3b4193a15d..91e1e17b87 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "aries-framework-javascript", - "version": "0.0.1-datatransfer.0", + "version": "0.0.1-datatransfer.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 575945ce03..665346fad7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aries-framework-javascript", - "version": "0.0.1-datatransfer.1", + "version": "0.0.1-datatransfer.2", "license": "Apache-2.0", "main": "build/src/index.js", "types": "build/src/index.d.ts", diff --git a/src/modules/connections/__tests__/ConnectionService.test.ts b/src/modules/connections/__tests__/ConnectionService.test.ts index 1c8170d1b0..64b12ccfb4 100644 --- a/src/modules/connections/__tests__/ConnectionService.test.ts +++ b/src/modules/connections/__tests__/ConnectionService.test.ts @@ -211,6 +211,7 @@ describe('ConnectionService', () => { expect(connection.invitation).toMatchObject(invitation) expect(connection.alias).toBeUndefined() expect(connectionAlias.alias).toBe('test-alias') + expect(connection.theirLabel).toBe('test label') }) it('returns a connection record with the autoAcceptConnection parameter from the config', async () => { @@ -302,7 +303,7 @@ describe('ConnectionService', () => { describe('processRequest', () => { it('returns a connection record containing the information from the connection request', async () => { - expect.assertions(5) + expect.assertions(6) const connectionRecord = getMockConnection({ state: ConnectionState.Invited, @@ -343,6 +344,7 @@ describe('ConnectionService', () => { expect(processedConnection.theirDid).toBe(theirDid) // TODO: we should transform theirDidDoc to didDoc instance after retrieving from persistence expect(processedConnection.theirDidDoc).toEqual(theirDidDoc) + expect(processedConnection.theirLabel).toBe('test-label') expect(processedConnection.tags.theirKey).toBe(theirVerkey) expect(processedConnection.tags.threadId).toBe(connectionRequest.id) }) diff --git a/src/modules/connections/repository/ConnectionRecord.ts b/src/modules/connections/repository/ConnectionRecord.ts index 33593efacc..de7d63ee3a 100644 --- a/src/modules/connections/repository/ConnectionRecord.ts +++ b/src/modules/connections/repository/ConnectionRecord.ts @@ -22,6 +22,7 @@ interface ConnectionProps { role: ConnectionRole endpoint?: string alias?: string + theirLabel?: string autoAcceptConnection?: boolean } @@ -47,6 +48,7 @@ export class ConnectionRecord extends BaseRecord implements ConnectionStoragePro public role: ConnectionRole public endpoint?: string public alias?: string + public theirLabel?: string public autoAcceptConnection?: boolean public tags: ConnectionTags @@ -64,6 +66,7 @@ export class ConnectionRecord extends BaseRecord implements ConnectionStoragePro this.role = props.role this.endpoint = props.endpoint this.alias = props.alias + this.theirLabel = props.theirLabel this.autoAcceptConnection = props.autoAcceptConnection this.tags = props.tags this.invitation = props.invitation diff --git a/src/modules/connections/services/ConnectionService.ts b/src/modules/connections/services/ConnectionService.ts index 3b9e72c7b5..a3b1c6140d 100644 --- a/src/modules/connections/services/ConnectionService.ts +++ b/src/modules/connections/services/ConnectionService.ts @@ -114,6 +114,7 @@ export class ConnectionService extends EventEmitter { role: ConnectionRole.Invitee, state: ConnectionState.Invited, alias: config?.alias, + theirLabel: invitation.label, autoAcceptConnection: config?.autoAcceptConnection, invitation, tags: { @@ -186,6 +187,7 @@ export class ConnectionService extends EventEmitter { connectionRecord.theirDid = message.connection.did connectionRecord.theirDidDoc = message.connection.didDoc + connectionRecord.theirLabel = message.label if (!connectionRecord.theirKey) { throw new Error(`Connection with id ${connectionRecord.id} has no recipient keys.`) @@ -353,6 +355,7 @@ export class ConnectionService extends EventEmitter { state: ConnectionState invitation?: ConnectionInvitationMessage alias?: string + theirLabel?: string autoAcceptConnection?: boolean tags?: ConnectionTags }): Promise { @@ -394,6 +397,7 @@ export class ConnectionService extends EventEmitter { }, invitation: options.invitation, alias: options.alias, + theirLabel: options.theirLabel, autoAcceptConnection: options.autoAcceptConnection, })