Skip to content

Commit

Permalink
fix: key's id name according to the DID Peer new specs #126 (#148)
Browse files Browse the repository at this point in the history
Fix for #126

Signed-off-by: Francisco Javier Ribó Labrador <[email protected]>
Signed-off-by: Francisco Javier Ribo Labrador <[email protected]>
  • Loading branch information
elribonazo committed May 2, 2024
1 parent 749f4dd commit 09cab81
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 39 deletions.
15 changes: 9 additions & 6 deletions src/castor/resolver/PeerDIDResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)));
Expand Down Expand Up @@ -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,
Expand Down
36 changes: 19 additions & 17 deletions src/peer-did/PeerDID.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@ export namespace PeerDID {

export interface PeerDIDEncoded {
t: string;
s: string;
r: string[];
a: string[];
s: {
uri: string;
r?: string[];
a?: string[];
}
}

export class PeerDID {
constructor(
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) {
Expand All @@ -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;
Expand All @@ -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
);
}
}
6 changes: 3 additions & 3 deletions tests/agent/Agent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/agent/mocks/CastorMock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const castorVars = {
_peerDID: new DID(
"did",
"peer",
"2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOiJodHRwczovL21lZGlhdG9yLnJvb3RzaWQuY2xvdWQiLCJhIjpbImRpZGNvbW0vdjIiXX0"
"2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOnsidXJpIjoiaHR0cHM6Ly9tZWRpYXRvci5yb290c2lkLmNsb3VkIiwiYSI6WyJkaWRjb21tL3YyIl19fQ"
),
}

Expand Down
2 changes: 1 addition & 1 deletion tests/agent/mocks/ConnectionManagerMock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class ConnectionsManagerMock implements ConnectionsManagerClass {
mediatorDID: new DID(
"did",
"peer",
"2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOiJodHRwczovL21lZGlhdG9yLnJvb3RzaWQuY2xvdWQiLCJhIjpbImRpZGNvbW0vdjIiXX0"
"2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOnsidXJpIjoiaHR0cHM6Ly9tZWRpYXRvci5yb290c2lkLmNsb3VkIiwiYSI6WyJkaWRjb21tL3YyIl19fQ"
),
},
} as any;
Expand Down
28 changes: 26 additions & 2 deletions tests/castor/PeerDID.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
PublicKey,
KeyTypes,
Curve,
VerificationMethods,
} from "../../src/domain";
import Apollo from "../../src/apollo/Apollo";

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -95,14 +96,37 @@ 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);
const document = await castor.resolveDID(mypeerDID.toString());
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);
Expand Down
8 changes: 4 additions & 4 deletions tests/mercury/Mercury.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
"{}",
Expand Down Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions tests/mercury/didcomm/SecretsResolver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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();

Expand All @@ -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();

Expand All @@ -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 = {
Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit 09cab81

Please sign in to comment.