From 09cab819b19be948edd30b7aa9edc641f9add0d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Javier=20Rib=C3=B3=20Labrador?= Date: Tue, 6 Feb 2024 14:49:42 +0000 Subject: [PATCH] fix: key's id name according to the DID Peer new specs #126 (#148) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix for #126 Signed-off-by: Francisco Javier Ribó Labrador Signed-off-by: Francisco Javier Ribo Labrador --- src/castor/resolver/PeerDIDResolver.ts | 15 ++++---- src/peer-did/PeerDID.ts | 36 ++++++++++--------- tests/agent/Agent.test.ts | 6 ++-- tests/agent/mocks/CastorMock.ts | 2 +- tests/agent/mocks/ConnectionManagerMock.ts | 2 +- tests/castor/PeerDID.test.ts | 28 +++++++++++++-- tests/mercury/Mercury.test.ts | 8 ++--- tests/mercury/didcomm/SecretsResolver.test.ts | 10 +++--- 8 files changed, 68 insertions(+), 39 deletions(-) diff --git a/src/castor/resolver/PeerDIDResolver.ts b/src/castor/resolver/PeerDIDResolver.ts index 244a4bc0e..cf0e584de 100644 --- a/src/castor/resolver/PeerDIDResolver.ts +++ b/src/castor/resolver/PeerDIDResolver.ts @@ -51,7 +51,7 @@ export class PeerDIDResolver implements DIDResolver { const keyAgreementMethods: VerificationMethod[] = []; const services: DIDDocumentService[] = []; - composition.forEach((part) => { + composition.forEach((part, index) => { let decoded: [ string, VerificationMaterialAuthentication | VerificationMaterialAgreement, @@ -61,14 +61,14 @@ export class PeerDIDResolver implements DIDResolver { switch (type) { case Numalgo2Prefix.authentication: decoded = this.decodeMultibaseEncnumbasisAuth(part.slice(1), format); - authenticationMethods.push(this.getVerificationMethod(did, decoded)); + authenticationMethods.push(this.getVerificationMethod(did, decoded, index)); break; case Numalgo2Prefix.keyAgreement: decoded = this.decodeMultibaseEcnumbasisAgreement( part.slice(1), format ); - keyAgreementMethods.push(this.getVerificationMethod(did, decoded)); + keyAgreementMethods.push(this.getVerificationMethod(did, decoded, index)); break; case Numalgo2Prefix.service: services.push(...this.decodeService(did, part.slice(1))); @@ -193,14 +193,17 @@ export class PeerDIDResolver implements DIDResolver { public getVerificationMethod( did: DID, - decodedEncnumbasis: [string, VerificationMaterialPeerDID] + decodedEncnumbasis: [string, VerificationMaterialPeerDID], + index: number ): VerificationMethod { const jsonObject = JSON.parse(decodedEncnumbasis[1].value); + const keyId = "key-" + (index + 1) - jsonObject["kid"] = did.toString() + "#" + decodedEncnumbasis[0]; + // jsonObject["kid"] = did.toString() + "#" + decodedEncnumbasis[0]; //Before https://github.com/decentralized-identity/peer-did-method-spec/pull/62 + jsonObject["kid"] = did.toString() + "#" + keyId; return { - id: new DIDUrl(did, [], new Map(), decodedEncnumbasis[0]).string(), + id: new DIDUrl(did, [], new Map(), keyId).string(), controller: did.toString(), type: decodedEncnumbasis[1].keyType.value, publicKeyJwk: jsonObject, diff --git a/src/peer-did/PeerDID.ts b/src/peer-did/PeerDID.ts index f82bd45e7..8e9ede6ef 100644 --- a/src/peer-did/PeerDID.ts +++ b/src/peer-did/PeerDID.ts @@ -20,9 +20,11 @@ export namespace PeerDID { export interface PeerDIDEncoded { t: string; - s: string; - r: string[]; - a: string[]; + s: { + uri: string; + r?: string[]; + a?: string[]; + } } export class PeerDID { @@ -30,7 +32,7 @@ export class PeerDID { public readonly did: DID, public readonly privateKeys: PeerDID.PrivateKey[] = [] ) { - const regex = /(([01](z)([1-9a-km-zA-HJ-NP-Z]{46,47}))|(2((\.[AEVID](z)([1-9a-km-zA-HJ-NP-Z]{46,47}))+(\.(S)[0-9a-zA-Z=]*)?)))$/; + const regex = /(([01](z)([1-9a-km-zA-HJ-NP-Z]{46,47}))|(2((\.[AEVID](z)([1-9a-km-zA-HJ-NP-Z]{46,47}))+(\.(S)[0-9a-zA-Z=]*)*)))$/; const isValid = did.schema === "did" && did.method === "peer" && regex.test(did.methodId); if (isValid === false) { @@ -45,14 +47,14 @@ export class PeerDID { export class PeerDIDService { readonly type: string; readonly serviceEndpoint: string; - readonly routingKeys: string[]; - readonly accept: string[]; + readonly routingKeys?: string[]; + readonly accept?: string[]; constructor( type: string, serviceEndpoint: string, - routingKeys: string[], - accept: string[] + routingKeys?: string[], + accept?: string[] ) { this.type = type; this.serviceEndpoint = serviceEndpoint; @@ -72,24 +74,24 @@ export class PeerDIDService { encode(): PeerDIDEncoded { return { - r: this.routingKeys, - s: this.serviceEndpoint, - a: this.accept, t: this.type.replace( PeerDIDService.DIDCommMessagingKey, PeerDIDService.DIDCommMessagingEncodedKey ), + s: { + uri: this.serviceEndpoint, + r: this.routingKeys, + a: this.accept, + }, }; } static decode(encoded: PeerDIDEncoded): PeerDIDService { return new PeerDIDService( - encoded.t === PeerDIDService.DIDCommMessagingEncodedKey - ? PeerDIDService.DIDCommMessagingKey - : encoded.t, - encoded.s, - encoded.r, - encoded.a + encoded.t === PeerDIDService.DIDCommMessagingEncodedKey ? PeerDIDService.DIDCommMessagingKey : encoded.t, + encoded.s.uri, + encoded.s.r, + encoded.s.a ); } } diff --git a/tests/agent/Agent.test.ts b/tests/agent/Agent.test.ts index b013cacf3..9554a73b9 100644 --- a/tests/agent/Agent.test.ts +++ b/tests/agent/Agent.test.ts @@ -147,7 +147,7 @@ describe("Agent Tests", () => { const didHigherFunctions = (agent as any).agentDIDHigherFunctions; const did = DID.fromString( - "did:peer:2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOiJodHRwczovL21lZGlhdG9yLnJvb3RzaWQuY2xvdWQiLCJhIjpbImRpZGNvbW0vdjIiXX0" + "did:peer:2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOnsidXJpIjoiaHR0cHM6Ly9tZWRpYXRvci5yb290c2lkLmNsb3VkIiwiYSI6WyJkaWRjb21tL3YyIl19fQ" ); const validOOB = "https://my.domain.com/path?_oob=eyJpZCI6Ijg5NWYzMWZhLTIyNWUtNDRlNi1hNzkyLWFhN2E0OGY1MjgzYiIsInR5cGUiOiJodHRwczovL2RpZGNvbW0ub3JnL291dC1vZi1iYW5kLzIuMC9pbnZpdGF0aW9uIiwiZnJvbSI6ImRpZDpwZWVyOjIuRXo2TFNlenlrY0JqTUtnR1BFRGg0NHBDOFFmdTdjQ3pKb3NWdVY0anA2eDVZNUJITC5WejZNa3dSSnQxU21acDNhRERoTFVuNGZLMzNtOExMWlhXOTJYVDh2clVIdTR1cEE2LlNleUowSWpvaVpHMGlMQ0p6SWpvaWFIUjBjSE02THk5ck9ITXRaR1YyTG1GMFlXeGhjSEpwYzIwdWFXOHZjSEpwYzIwdFlXZGxiblF2Wkdsa1kyOXRiU0lzSW5JaU9sdGRMQ0poSWpwYkltUnBaR052YlcwdmRqSWlYWDAiLCJib2R5Ijp7ImdvYWxfY29kZSI6ImlvLmF0YWxhcHJpc20uY29ubmVjdCIsImdvYWwiOiJFc3RhYmxpc2ggYSB0cnVzdCBjb25uZWN0aW9uIGJldHdlZW4gdHdvIHBlZXJzIHVzaW5nIHRoZSBwcm90b2NvbCAnaHR0cHM6Ly9hdGFsYXByaXNtLmlvL21lcmN1cnkvY29ubmVjdGlvbnMvMS4wL3JlcXVlc3QnIiwiYWNjZXB0IjpbXX19"; @@ -234,10 +234,10 @@ describe("Agent Tests", () => { const mypeerDID = new DID( "did", "peer", - "2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOiJodHRwczovL21lZGlhdG9yLnJvb3RzaWQuY2xvdWQiLCJhIjpbImRpZGNvbW0vdjIiXX0" + "2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOnsidXJpIjoiaHR0cHM6Ly9tZWRpYXRvci5yb290c2lkLmNsb3VkIiwiYSI6WyJkaWRjb21tL3YyIl19fQ" ); const validPeerDID = DID.fromString( - `did:peer:2.Ez6LSoHkfN1Y4nK9RCjx7vopWsLrMGNFNgTNZgoCNQrTzmb1n.Vz6MknRZmapV7uYZQuZez9n9N3tQotjRN18UGS68Vcfo6gR4h.SeyJyIjpbImRpZDpleGFtcGxlOnNvbWVtZWRpYXRvciNzb21la2V5Il0sInMiOiJodHRwczovL2V4YW1wbGUuY29tL2VuZHBvaW50IiwiYSI6W10sInQiOiJkbSJ9` + `did:peer:2.Ez6LSoHkfN1Y4nK9RCjx7vopWsLrMGNFNgTNZgoCNQrTzmb1n.Vz6MknRZmapV7uYZQuZez9n9N3tQotjRN18UGS68Vcfo6gR4h.SeyJ0IjoiZG0iLCJzIjp7InVyaSI6Imh0dHBzOi8vZXhhbXBsZS5jb20vZW5kcG9pbnQiLCJyIjpbImRpZDpleGFtcGxlOnNvbWVtZWRpYXRvciNzb21la2V5Il0sImEiOltdfX0` ); const createOffer = (credType: CredentialType) => { diff --git a/tests/agent/mocks/CastorMock.ts b/tests/agent/mocks/CastorMock.ts index 7adf32392..1744e0a64 100644 --- a/tests/agent/mocks/CastorMock.ts +++ b/tests/agent/mocks/CastorMock.ts @@ -12,7 +12,7 @@ const castorVars = { _peerDID: new DID( "did", "peer", - "2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOiJodHRwczovL21lZGlhdG9yLnJvb3RzaWQuY2xvdWQiLCJhIjpbImRpZGNvbW0vdjIiXX0" + "2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOnsidXJpIjoiaHR0cHM6Ly9tZWRpYXRvci5yb290c2lkLmNsb3VkIiwiYSI6WyJkaWRjb21tL3YyIl19fQ" ), } diff --git a/tests/agent/mocks/ConnectionManagerMock.ts b/tests/agent/mocks/ConnectionManagerMock.ts index cced7bf83..36c02abfc 100644 --- a/tests/agent/mocks/ConnectionManagerMock.ts +++ b/tests/agent/mocks/ConnectionManagerMock.ts @@ -21,7 +21,7 @@ export class ConnectionsManagerMock implements ConnectionsManagerClass { mediatorDID: new DID( "did", "peer", - "2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOiJodHRwczovL21lZGlhdG9yLnJvb3RzaWQuY2xvdWQiLCJhIjpbImRpZGNvbW0vdjIiXX0" + "2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOnsidXJpIjoiaHR0cHM6Ly9tZWRpYXRvci5yb290c2lkLmNsb3VkIiwiYSI6WyJkaWRjb21tL3YyIl19fQ" ), }, } as any; diff --git a/tests/castor/PeerDID.test.ts b/tests/castor/PeerDID.test.ts index 94a02a163..81febaaa7 100644 --- a/tests/castor/PeerDID.test.ts +++ b/tests/castor/PeerDID.test.ts @@ -7,6 +7,7 @@ import { PublicKey, KeyTypes, Curve, + VerificationMethods, } from "../../src/domain"; import Apollo from "../../src/apollo/Apollo"; @@ -50,7 +51,7 @@ describe("PEERDID CreateTest", () => { expect(result.format).to.equal(ecnumbasisResult[1].format); }); it("Should create the peerDID correctly", async () => { - const validPeerDID = `did:peer:2.Ez6LSoHkfN1Y4nK9RCjx7vopWsLrMGNFNgTNZgoCNQrTzmb1n.Vz6MknRZmapV7uYZQuZez9n9N3tQotjRN18UGS68Vcfo6gR4h.SeyJyIjpbImRpZDpleGFtcGxlOnNvbWVtZWRpYXRvciNzb21la2V5Il0sInMiOiJodHRwczovL2V4YW1wbGUuY29tL2VuZHBvaW50IiwiYSI6W10sInQiOiJkbSJ9`; + const validPeerDID = `did:peer:2.Ez6LSoHkfN1Y4nK9RCjx7vopWsLrMGNFNgTNZgoCNQrTzmb1n.Vz6MknRZmapV7uYZQuZez9n9N3tQotjRN18UGS68Vcfo6gR4h.SeyJ0IjoiZG0iLCJzIjp7InVyaSI6Imh0dHBzOi8vZXhhbXBsZS5jb20vZW5kcG9pbnQiLCJyIjpbImRpZDpleGFtcGxlOnNvbWVtZWRpYXRvciNzb21la2V5Il0sImEiOltdfX0`; const apollo = new Apollo(); const castor = new Castor(apollo); @@ -95,7 +96,7 @@ describe("PEERDID CreateTest", () => { const mypeerDID = new DID( "did", "peer", - "2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOiJodHRwczovL21lZGlhdG9yLnJvb3RzaWQuY2xvdWQiLCJhIjpbImRpZGNvbW0vdjIiXX0" + "2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOnsidXJpIjoiaHR0cHM6Ly9tZWRpYXRvci5yb290c2lkLmNsb3VkIiwiYSI6WyJkaWRjb21tL3YyIl19fQ" ); const apollo = new Apollo(); const castor = new Castor(apollo); @@ -103,6 +104,29 @@ describe("PEERDID CreateTest", () => { expect(document.id.toString()).to.equal(mypeerDID.toString()); }); + it("Should resolver peerdid's kid of the keys correctly according to https://github.com/decentralized-identity/peer-did-method-spec/pull/62", async () => { + const mypeerDID = new DID( + "did", + "peer", + "2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOnsidXJpIjoiaHR0cHM6Ly9tZWRpYXRvci5yb290c2lkLmNsb3VkIiwiYSI6WyJkaWRjb21tL3YyIl19fQ" + ); + const apollo = new Apollo(); + const castor = new Castor(apollo); + const document = await castor.resolveDID(mypeerDID.toString()); + document.coreProperties.forEach((element) => { + if (element instanceof VerificationMethods) { + expect(element.values.length).to.equal(2); + expect(element.values[0].id) + .to.equal(element.values[0].publicKeyJwk?.kid) + .to.equal("did:peer:2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOnsidXJpIjoiaHR0cHM6Ly9tZWRpYXRvci5yb290c2lkLmNsb3VkIiwiYSI6WyJkaWRjb21tL3YyIl19fQ#key-2"); + expect(element.values[1].id) + .to.equal(element.values[1].publicKeyJwk?.kid) + .to.equal("did:peer:2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOnsidXJpIjoiaHR0cHM6Ly9tZWRpYXRvci5yb290c2lkLmNsb3VkIiwiYSI6WyJkaWRjb21tL3YyIl19fQ#key-1"); + } + }); + expect(document.id.toString()).to.equal(mypeerDID.toString()); + }); + it("Create a PeerDID and verify a signature", async () => { const apollo = new Apollo(); const castor = new Castor(apollo); diff --git a/tests/mercury/Mercury.test.ts b/tests/mercury/Mercury.test.ts index bc304261c..ad0651c25 100644 --- a/tests/mercury/Mercury.test.ts +++ b/tests/mercury/Mercury.test.ts @@ -87,10 +87,10 @@ describe("Mercury", () => { describe("PackMessage", () => { it("should call DIDCommProtocol.packEncrypted with [message, message.to, message.from]", () => { const fromDid = DID.fromString( - "did:peer:2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOiJodHRwczovL21lZGlhdG9yLnJvb3RzaWQuY2xvdWQiLCJhIjpbImRpZGNvbW0vdjIiXX0" + "did:peer:2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOnsidXJpIjoiaHR0cHM6Ly9tZWRpYXRvci5yb290c2lkLmNsb3VkIiwiYSI6WyJkaWRjb21tL3YyIl19fQ" ); const toDid = DID.fromString( - "did:peer:2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOiJodHRwczovL21lZGlhdG9yLnJvb3RzaWQuY2xvdWQiLCJhIjpbImRpZGNvbW0vdjIiXX0" + "did:peer:2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOnsidXJpIjoiaHR0cHM6Ly9tZWRpYXRvci5yb290c2lkLmNsb3VkIiwiYSI6WyJkaWRjb21tL3YyIl19fQ" ); const message = new Message( "{}", @@ -151,10 +151,10 @@ describe("Mercury", () => { beforeEach(() => { ctx = makeTestContext(); fromDID = DID.fromString( - "did:peer:2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOiJodHRwczovL21lZGlhdG9yLnJvb3RzaWQuY2xvdWQiLCJhIjpbImRpZGNvbW0vdjIiXX0" + "did:peer:2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOnsidXJpIjoiaHR0cHM6Ly9tZWRpYXRvci5yb290c2lkLmNsb3VkIiwiYSI6WyJkaWRjb21tL3YyIl19fQ" ); toDID = DID.fromString( - "did:peer:2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOiJodHRwczovL21lZGlhdG9yLnJvb3RzaWQuY2xvdWQiLCJhIjpbImRpZGNvbW0vdjIiXX0" + "did:peer:2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOnsidXJpIjoiaHR0cHM6Ly9tZWRpYXRvci5yb290c2lkLmNsb3VkIiwiYSI6WyJkaWRjb21tL3YyIl19fQ" ); sandbox.stub(ctx.castor, "parseDID").returns(fromDID); diff --git a/tests/mercury/didcomm/SecretsResolver.test.ts b/tests/mercury/didcomm/SecretsResolver.test.ts index 62425db85..08e45ab99 100644 --- a/tests/mercury/didcomm/SecretsResolver.test.ts +++ b/tests/mercury/didcomm/SecretsResolver.test.ts @@ -69,7 +69,7 @@ describe("Mercury DIDComm SecretsResolver", () => { it("should return matched secret", async () => { const ctx = makeTestContext(); const did = Domain.DID.fromString( - "did:peer:2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOiJodHRwczovL21lZGlhdG9yLnJvb3RzaWQuY2xvdWQiLCJhIjpbImRpZGNvbW0vdjIiXX0" + "did:peer:2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOnsidXJpIjoiaHR0cHM6Ly9tZWRpYXRvci5yb290c2lkLmNsb3VkIiwiYSI6WyJkaWRjb21tL3YyIl19fQ" ); const secret = did.toString(); @@ -87,7 +87,7 @@ describe("Mercury DIDComm SecretsResolver", () => { it("should return matched secret - no duplicates", async () => { const ctx = makeTestContext(); const did = Domain.DID.fromString( - "did:peer:2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOiJodHRwczovL21lZGlhdG9yLnJvb3RzaWQuY2xvdWQiLCJhIjpbImRpZGNvbW0vdjIiXX0" + "did:peer:2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOnsidXJpIjoiaHR0cHM6Ly9tZWRpYXRvci5yb290c2lkLmNsb3VkIiwiYSI6WyJkaWRjb21tL3YyIl19fQ" ); const secret = did.toString(); @@ -104,7 +104,7 @@ describe("Mercury DIDComm SecretsResolver", () => { it("should return empty array with unmatched secret", async () => { const ctx = makeTestContext(); const did = Domain.DID.fromString( - "did:peer:2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOiJodHRwczovL21lZGlhdG9yLnJvb3RzaWQuY2xvdWQiLCJhIjpbImRpZGNvbW0vdjIiXX0" + "did:peer:2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOnsidXJpIjoiaHR0cHM6Ly9tZWRpYXRvci5yb290c2lkLmNsb3VkIiwiYSI6WyJkaWRjb21tL3YyIl19fQ" ); const secret = did.toString(); @@ -120,7 +120,7 @@ describe("Mercury DIDComm SecretsResolver", () => { it("should return matched secret", async () => { const ctx = makeTestContext(); const did = Domain.DID.fromString( - "did:peer:2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOiJodHRwczovL21lZGlhdG9yLnJvb3RzaWQuY2xvdWQiLCJhIjpbImRpZGNvbW0vdjIiXX0" + "did:peer:2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOnsidXJpIjoiaHR0cHM6Ly9tZWRpYXRvci5yb290c2lkLmNsb3VkIiwiYSI6WyJkaWRjb21tL3YyIl19fQ" ); const secret = did.toString(); const publicKeyJwk: Domain.PublicKeyJWK = { @@ -204,7 +204,7 @@ describe("Mercury DIDComm SecretsResolver", () => { it("should return null when unmatched secret", async () => { const ctx = makeTestContext(); const did = Domain.DID.fromString( - "did:peer:2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOiJodHRwczovL21lZGlhdG9yLnJvb3RzaWQuY2xvdWQiLCJhIjpbImRpZGNvbW0vdjIiXX0" + "did:peer:2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOnsidXJpIjoiaHR0cHM6Ly9tZWRpYXRvci5yb290c2lkLmNsb3VkIiwiYSI6WyJkaWRjb21tL3YyIl19fQ" ); const secret = did.toString();