@veramo/credential-ld 4.1.2-next.5 → 4.1.3-next.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/build/contexts/did_v0.11.json +6 -0
  2. package/build/contexts/ed25519-signature-2020-v1.json +77 -0
  3. package/build/contexts/json-web-signature-2020-v1.json +71 -0
  4. package/build/index.d.ts +2 -0
  5. package/build/index.d.ts.map +1 -1
  6. package/build/index.js +2 -0
  7. package/build/index.js.map +1 -1
  8. package/build/ld-credential-module.js +6 -4
  9. package/build/ld-credential-module.js.map +1 -1
  10. package/build/ld-default-contexts.d.ts.map +1 -1
  11. package/build/ld-default-contexts.js +2 -0
  12. package/build/ld-default-contexts.js.map +1 -1
  13. package/build/ld-suite-loader.d.ts +1 -1
  14. package/build/ld-suite-loader.d.ts.map +1 -1
  15. package/build/ld-suite-loader.js +8 -5
  16. package/build/ld-suite-loader.js.map +1 -1
  17. package/build/suites/Ed25519Signature2020.d.ts +19 -0
  18. package/build/suites/Ed25519Signature2020.d.ts.map +1 -0
  19. package/build/suites/Ed25519Signature2020.js +104 -0
  20. package/build/suites/Ed25519Signature2020.js.map +1 -0
  21. package/build/suites/JsonWebSignature2020.d.ts +16 -0
  22. package/build/suites/JsonWebSignature2020.d.ts.map +1 -0
  23. package/build/suites/JsonWebSignature2020.js +105 -0
  24. package/build/suites/JsonWebSignature2020.js.map +1 -0
  25. package/package.json +8 -6
  26. package/src/contexts/did_v0.11.json +6 -0
  27. package/src/contexts/ed25519-signature-2020-v1.json +77 -0
  28. package/src/contexts/json-web-signature-2020-v1.json +71 -0
  29. package/src/index.ts +2 -0
  30. package/src/ld-credential-module.ts +4 -4
  31. package/src/ld-default-contexts.ts +2 -0
  32. package/src/ld-suite-loader.ts +9 -7
  33. package/src/module-types/jsonld/index.d.ts +2 -0
  34. package/src/suites/Ed25519Signature2020.ts +80 -0
  35. package/src/suites/JsonWebSignature2020.ts +85 -0
@@ -12,6 +12,10 @@
12
12
  "EcdsaSecp256k1VerificationKey2019": "sec:EcdsaSecp256k1VerificationKey2019",
13
13
  "Ed25519Signature2018": "sec:Ed25519Signature2018",
14
14
  "Ed25519VerificationKey2018": "sec:Ed25519VerificationKey2018",
15
+ "Ed25519Signature2020": "sec:Ed25519Signature2020",
16
+ "Ed25519VerificationKey2020": "sec:Ed25519VerificationKey2020",
17
+ "JsonWebSignature2020": "sec:JsonWebSignature2020",
18
+ "JsonWebKey2020": "sec:JsonWebKey2020",
15
19
  "RsaSignature2018": "sec:RsaSignature2018",
16
20
  "RsaVerificationKey2018": "sec:RsaVerificationKey2018",
17
21
  "SchnorrSecp256k1Signature2019": "sec:SchnorrSecp256k1Signature2019",
@@ -46,6 +50,8 @@
46
50
  "proofValue": "sec:proofValue",
47
51
  "publicKey": { "@id": "sec:publicKey", "@type": "@id", "@container": "@set" },
48
52
  "publicKeyBase58": "sec:publicKeyBase58",
53
+ "publicKeyMultibase": "sec:publicKeyMultibase",
54
+ "publicKeyJwk": "sec:publicKeyJwk",
49
55
  "publicKeyPem": "sec:publicKeyPem",
50
56
  "revoked": { "@id": "sec:revoked", "@type": "xsd:dateTime" },
51
57
  "service": { "@id": "didv:service", "@type": "@id", "@container": "@set" },
@@ -0,0 +1,77 @@
1
+ {
2
+ "@context": {
3
+ "id": "@id",
4
+ "type": "@type",
5
+ "@protected": true,
6
+ "proof": {
7
+ "@id": "https://w3id.org/security#proof",
8
+ "@type": "@id",
9
+ "@container": "@graph"
10
+ },
11
+ "Ed25519VerificationKey2020": {
12
+ "@id": "https://w3id.org/security#Ed25519VerificationKey2020"
13
+ },
14
+ "Ed25519Signature2020": {
15
+ "@id": "https://w3id.org/security#Ed25519Signature2020",
16
+ "@context": {
17
+ "@protected": true,
18
+ "id": "@id",
19
+ "type": "@type",
20
+ "challenge": "https://w3id.org/security#challenge",
21
+ "created": {
22
+ "@id": "http://purl.org/dc/terms/created",
23
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
24
+ },
25
+ "domain": "https://w3id.org/security#domain",
26
+ "expires": {
27
+ "@id": "https://w3id.org/security#expiration",
28
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
29
+ },
30
+ "nonce": "https://w3id.org/security#nonce",
31
+ "proofPurpose": {
32
+ "@id": "https://w3id.org/security#proofPurpose",
33
+ "@type": "@vocab",
34
+ "@context": {
35
+ "@version": 1.1,
36
+ "@protected": true,
37
+ "id": "@id",
38
+ "type": "@type",
39
+ "assertionMethod": {
40
+ "@id": "https://w3id.org/security#assertionMethod",
41
+ "@type": "@id",
42
+ "@container": "@set"
43
+ },
44
+ "authentication": {
45
+ "@id": "https://w3id.org/security#authenticationMethod",
46
+ "@type": "@id",
47
+ "@container": "@set"
48
+ },
49
+ "capabilityInvocation": {
50
+ "@id": "https://w3id.org/security#capabilityInvocationMethod",
51
+ "@type": "@id",
52
+ "@container": "@set"
53
+ },
54
+ "capabilityDelegation": {
55
+ "@id": "https://w3id.org/security#capabilityDelegationMethod",
56
+ "@type": "@id",
57
+ "@container": "@set"
58
+ },
59
+ "keyAgreement": {
60
+ "@id": "https://w3id.org/security#keyAgreementMethod",
61
+ "@type": "@id",
62
+ "@container": "@set"
63
+ }
64
+ }
65
+ },
66
+ "proofValue": {
67
+ "@id": "https://w3id.org/security#proofValue",
68
+ "@type": "https://w3id.org/security#multibase"
69
+ },
70
+ "verificationMethod": {
71
+ "@id": "https://w3id.org/security#verificationMethod",
72
+ "@type": "@id"
73
+ }
74
+ }
75
+ }
76
+ }
77
+ }
@@ -0,0 +1,71 @@
1
+ {
2
+ "@context": {
3
+ "@version": 1.1,
4
+ "id": "@id",
5
+ "type": "@type",
6
+ "@protected": true,
7
+ "JsonWebKey2020": {
8
+ "@id": "https://w3id.org/security#JsonWebKey2020"
9
+ },
10
+ "JsonWebSignature2020": {
11
+ "@id": "https://w3id.org/security#JsonWebSignature2020",
12
+ "@context": {
13
+ "@version": 1.1,
14
+ "id": "@id",
15
+ "type": "@type",
16
+ "@protected": true,
17
+ "challenge": "https://w3id.org/security#challenge",
18
+ "created": {
19
+ "@id": "http://purl.org/dc/terms/created",
20
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
21
+ },
22
+ "domain": "https://w3id.org/security#domain",
23
+ "expires": {
24
+ "@id": "https://w3id.org/security#expiration",
25
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
26
+ },
27
+ "jws": "https://w3id.org/security#jws",
28
+ "nonce": "https://w3id.org/security#nonce",
29
+ "proofPurpose": {
30
+ "@id": "https://w3id.org/security#proofPurpose",
31
+ "@type": "@vocab",
32
+ "@context": {
33
+ "@version": 1.1,
34
+ "@protected": true,
35
+ "id": "@id",
36
+ "type": "@type",
37
+ "assertionMethod": {
38
+ "@id": "https://w3id.org/security#assertionMethod",
39
+ "@type": "@id",
40
+ "@container": "@set"
41
+ },
42
+ "authentication": {
43
+ "@id": "https://w3id.org/security#authenticationMethod",
44
+ "@type": "@id",
45
+ "@container": "@set"
46
+ },
47
+ "capabilityInvocation": {
48
+ "@id": "https://w3id.org/security#capabilityInvocationMethod",
49
+ "@type": "@id",
50
+ "@container": "@set"
51
+ },
52
+ "capabilityDelegation": {
53
+ "@id": "https://w3id.org/security#capabilityDelegationMethod",
54
+ "@type": "@id",
55
+ "@container": "@set"
56
+ },
57
+ "keyAgreement": {
58
+ "@id": "https://w3id.org/security#keyAgreementMethod",
59
+ "@type": "@id",
60
+ "@container": "@set"
61
+ }
62
+ }
63
+ },
64
+ "verificationMethod": {
65
+ "@id": "https://w3id.org/security#verificationMethod",
66
+ "@type": "@id"
67
+ }
68
+ }
69
+ }
70
+ }
71
+ }
package/build/index.d.ts CHANGED
@@ -16,6 +16,8 @@ export { LdDefaultContexts } from './ld-default-contexts';
16
16
  export { VeramoLdSignature } from './ld-suites';
17
17
  export * from './suites/EcdsaSecp256k1RecoverySignature2020';
18
18
  export * from './suites/Ed25519Signature2018';
19
+ export * from './suites/Ed25519Signature2020';
20
+ export * from './suites/JsonWebSignature2020';
19
21
  /**
20
22
  * The parameter and return types schemas for the {@link @veramo/credential-ld#CredentialIssuerLD | CredentialIssuerLD}
21
23
  * plugin methods.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,cAAc,8CAA8C,CAAA;AAC5D,cAAc,+BAA+B,CAAA;AAE7C;;;;;GAKG;AACH,QAAA,MAAM,MAAM,KAAmC,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,cAAc,8CAA8C,CAAA;AAC5D,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAE7C;;;;;GAKG;AACH,QAAA,MAAM,MAAM,KAAmC,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,CAAA"}
package/build/index.js CHANGED
@@ -36,6 +36,8 @@ var ld_suites_1 = require("./ld-suites");
36
36
  Object.defineProperty(exports, "VeramoLdSignature", { enumerable: true, get: function () { return ld_suites_1.VeramoLdSignature; } });
37
37
  __exportStar(require("./suites/EcdsaSecp256k1RecoverySignature2020"), exports);
38
38
  __exportStar(require("./suites/Ed25519Signature2018"), exports);
39
+ __exportStar(require("./suites/Ed25519Signature2020"), exports);
40
+ __exportStar(require("./suites/JsonWebSignature2020"), exports);
39
41
  /**
40
42
  * The parameter and return types schemas for the {@link @veramo/credential-ld#CredentialIssuerLD | CredentialIssuerLD}
41
43
  * plugin methods.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;GAWG;AACH,mDAAqD;AAA5C,oHAAA,kBAAkB,OAAA;AAC3B,0CAAuB;AACvB,6DAAyD;AAAhD,wHAAA,iBAAiB,OAAA;AAC1B,yCAA+C;AAAtC,8GAAA,iBAAiB,OAAA;AAC1B,+EAA4D;AAC5D,gEAA6C;AAE7C;;;;;GAKG;AACH,MAAM,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;AACtC,wBAAM"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;GAWG;AACH,mDAAqD;AAA5C,oHAAA,kBAAkB,OAAA;AAC3B,0CAAuB;AACvB,6DAAyD;AAAhD,wHAAA,iBAAiB,OAAA;AAC1B,yCAA+C;AAAtC,8GAAA,iBAAiB,OAAA;AAC1B,+EAA4D;AAC5D,gEAA6C;AAC7C,gEAA6C;AAC7C,gEAA6C;AAE7C;;;;;GAKG;AACH,MAAM,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;AACtC,wBAAM"}
@@ -99,20 +99,22 @@ class LdCredentialModule {
99
99
  }));
100
100
  }
101
101
  issueLDVerifiableCredential(credential, issuerDid, key, verificationMethodId, options, context) {
102
+ var _a, _b, _c;
102
103
  return __awaiter(this, void 0, void 0, function* () {
103
- const suite = this.ldSuiteLoader.getSignatureSuiteForKeyType(key.type);
104
+ const suite = this.ldSuiteLoader.getSignatureSuiteForKeyType(key.type, (_c = (_b = (_a = key.meta) === null || _a === void 0 ? void 0 : _a.verificationMethod) === null || _b === void 0 ? void 0 : _b.type) !== null && _c !== void 0 ? _c : '');
104
105
  const documentLoader = this.getDocumentLoader(context, options.fetchRemoteContexts);
105
106
  // some suites can modify the incoming credential (e.g. add required contexts)
106
107
  suite.preSigningCredModification(credential);
107
- return yield vc.issue(Object.assign(Object.assign({}, options), { credential, suite: suite.getSuiteForSigning(key, issuerDid, verificationMethodId, context), documentLoader, compactProof: false }));
108
+ return yield vc.issue(Object.assign(Object.assign({}, options), { credential, suite: yield suite.getSuiteForSigning(key, issuerDid, verificationMethodId, context), documentLoader, compactProof: false }));
108
109
  });
109
110
  }
110
111
  signLDVerifiablePresentation(presentation, holderDid, key, verificationMethodId, challenge, domain, options, context) {
112
+ var _a, _b, _c;
111
113
  return __awaiter(this, void 0, void 0, function* () {
112
- const suite = this.ldSuiteLoader.getSignatureSuiteForKeyType(key.type);
114
+ const suite = this.ldSuiteLoader.getSignatureSuiteForKeyType(key.type, (_c = (_b = (_a = key.meta) === null || _a === void 0 ? void 0 : _a.verificationMethod) === null || _b === void 0 ? void 0 : _b.type) !== null && _c !== void 0 ? _c : '');
113
115
  const documentLoader = this.getDocumentLoader(context, options.fetchRemoteContexts);
114
116
  suite.preSigningPresModification(presentation);
115
- return yield vc.signPresentation(Object.assign(Object.assign({}, options), { presentation, suite: suite.getSuiteForSigning(key, holderDid, verificationMethodId, context), challenge,
117
+ return yield vc.signPresentation(Object.assign(Object.assign({}, options), { presentation, suite: yield suite.getSuiteForSigning(key, holderDid, verificationMethodId, context), challenge,
116
118
  domain,
117
119
  documentLoader, compactProof: false }));
118
120
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ld-credential-module.js","sourceRoot":"","sources":["../src/ld-credential-module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,8DAA+B;AAC/B,kDAAyB;AACzB,6EAA2E;AAC3E,2DAA4C;AAK5C,MAAM,KAAK,GAAG,IAAA,eAAK,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OAAY,EACZ,OAAiC;;YAEjC,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,MAAM,iCACzB,OAAO,KACV,YAAY,EACZ,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,qBAAqB,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,uBAAuB,EAAE,CAAC,EACzF,cAAc,EAAE,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,mBAAmB,CAAC,EACpE,SAAS;gBACT,MAAM,EACN,YAAY,EAAE,KAAK,IACnB,CAAA;YAEF,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;gBACpB,+BAA+B;gBAC/B,KAAK,CAAC,oCAAoC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAA;aAC7E;YACD,OAAO,MAAM,CAAA;QACf,CAAC;KAAA;CACF;AA5KD,gDA4KC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ld-default-contexts.d.ts","sourceRoot":"","sources":["../src/ld-default-contexts.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,kBAkB5B,CAAA"}
1
+ {"version":3,"file":"ld-default-contexts.d.ts","sourceRoot":"","sources":["../src/ld-default-contexts.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,kBAoB5B,CAAA"}
@@ -17,6 +17,8 @@ exports.LdDefaultContexts = new Map([
17
17
  ['https://w3id.org/security/v3-unstable', require('./contexts/w3id.org_security_v3-unstable.json')],
18
18
  ['https://w3id.org/security/suites/ed25519-2018/v1', require('./contexts/w3id.org_security_suites_ed25519-2018_v1.json')],
19
19
  ['https://w3id.org/security/suites/x25519-2019/v1', require('./contexts/w3id.org_security_suites_x25519-2019_v1.json')],
20
+ ['https://w3id.org/security/suites/ed25519-2020/v1', require('./contexts/ed25519-signature-2020-v1.json')],
21
+ ['https://w3id.org/security/suites/jws-2020/v1', require('./contexts/json-web-signature-2020-v1.json')],
20
22
  // ['https://w3id.org/did/v0.11', require('./contexts/did_v0.11.json')],
21
23
  // ['https://veramo.io/contexts/socialmedia/v1', require('./contexts/socialmedia-v1.json')],
22
24
  // ['https://veramo.io/contexts/kyc/v1', require('./contexts/kyc-v1.json')],
@@ -1 +1 @@
1
- {"version":3,"file":"ld-default-contexts.js","sourceRoot":"","sources":["../src/ld-default-contexts.ts"],"names":[],"mappings":";;;AAEA;;;;;;;GAOG;AACU,QAAA,iBAAiB,GAAG,IAAI,GAAG,CAAC;IACvC,CAAC,wCAAwC,EAAE,OAAO,CAAC,2CAA2C,CAAC,CAAC;IAChG,CAAC,8BAA8B,EAAE,OAAO,CAAC,iCAAiC,CAAC,CAAC;IAC5E,CAAC,8BAA8B,EAAE,OAAO,CAAC,iCAAiC,CAAC,CAAC;IAC5E,CAAC,8BAA8B,EAAE,OAAO,CAAC,sCAAsC,CAAC,CAAC;IACjF,CAAC,uCAAuC,EAAE,OAAO,CAAC,+CAA+C,CAAC,CAAC;IACnG,CAAC,kDAAkD,EAAE,OAAO,CAAC,0DAA0D,CAAC,CAAC;IACzH,CAAC,iDAAiD,EAAE,OAAO,CAAC,yDAAyD,CAAC,CAAC;IACvH,wEAAwE;IACxE,4FAA4F;IAC5F,4EAA4E;IAC5E,CAAC,uCAAuC,EAAE,OAAO,CAAC,+CAA+C,CAAC,CAAC;IACnG,+EAA+E;IAC/E,CAAC,6GAA6G,EAAE,OAAO,CAAC,sDAAsD,CAAC,CAAC;IAChL,CAAC,6GAA6G,EAAE,OAAO,CAAC,oEAAoE,CAAC,CAAC;IAC9L,CAAC,4DAA4D,EAAE,OAAO,CAAC,oEAAoE,CAAC,CAAC;IAC7I,8GAA8G;IAC9G,6GAA6G;CAC9G,CAAC,CAAA"}
1
+ {"version":3,"file":"ld-default-contexts.js","sourceRoot":"","sources":["../src/ld-default-contexts.ts"],"names":[],"mappings":";;;AAEA;;;;;;;GAOG;AACU,QAAA,iBAAiB,GAAG,IAAI,GAAG,CAAC;IACvC,CAAC,wCAAwC,EAAE,OAAO,CAAC,2CAA2C,CAAC,CAAC;IAChG,CAAC,8BAA8B,EAAE,OAAO,CAAC,iCAAiC,CAAC,CAAC;IAC5E,CAAC,8BAA8B,EAAE,OAAO,CAAC,iCAAiC,CAAC,CAAC;IAC5E,CAAC,8BAA8B,EAAE,OAAO,CAAC,sCAAsC,CAAC,CAAC;IACjF,CAAC,uCAAuC,EAAE,OAAO,CAAC,+CAA+C,CAAC,CAAC;IACnG,CAAC,kDAAkD,EAAE,OAAO,CAAC,0DAA0D,CAAC,CAAC;IACzH,CAAC,iDAAiD,EAAE,OAAO,CAAC,yDAAyD,CAAC,CAAC;IACvH,CAAC,kDAAkD,EAAE,OAAO,CAAC,2CAA2C,CAAC,CAAC;IAC1G,CAAC,8CAA8C,EAAE,OAAO,CAAC,4CAA4C,CAAC,CAAC;IACvG,wEAAwE;IACxE,4FAA4F;IAC5F,4EAA4E;IAC5E,CAAC,uCAAuC,EAAE,OAAO,CAAC,+CAA+C,CAAC,CAAC;IACnG,+EAA+E;IAC/E,CAAC,6GAA6G,EAAE,OAAO,CAAC,sDAAsD,CAAC,CAAC;IAChL,CAAC,6GAA6G,EAAE,OAAO,CAAC,oEAAoE,CAAC,CAAC;IAC9L,CAAC,4DAA4D,EAAE,OAAO,CAAC,oEAAoE,CAAC,CAAC;IAC7I,8GAA8G;IAC9G,6GAA6G;CAC9G,CAAC,CAAA"}
@@ -8,7 +8,7 @@ export declare class LdSuiteLoader {
8
8
  veramoLdSignatures: VeramoLdSignature[];
9
9
  });
10
10
  private signatureMap;
11
- getSignatureSuiteForKeyType(type: TKeyType): VeramoLdSignature;
11
+ getSignatureSuiteForKeyType(type: TKeyType, verificationType: string): VeramoLdSignature;
12
12
  getAllSignatureSuites(): VeramoLdSignature[];
13
13
  getAllSignatureSuiteTypes(): string[];
14
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ld-suite-loader.d.ts","sourceRoot":"","sources":["../src/ld-suite-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEvC;;GAEG;AACH,qBAAa,aAAa;gBACZ,OAAO,EAAE;QAAE,kBAAkB,EAAE,iBAAiB,EAAE,CAAA;KAAE;IAKhE,OAAO,CAAC,YAAY,CAAwC;IAE5D,2BAA2B,CAAC,IAAI,EAAE,QAAQ;IAO1C,qBAAqB;IAIrB,yBAAyB;CAG1B"}
1
+ {"version":3,"file":"ld-suite-loader.d.ts","sourceRoot":"","sources":["../src/ld-suite-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEvC;;GAEG;AACH,qBAAa,aAAa;gBACZ,OAAO,EAAE;QAAE,kBAAkB,EAAE,iBAAiB,EAAE,CAAA;KAAE;IAOhE,OAAO,CAAC,YAAY,CAAwD;IAE5E,2BAA2B,CAAC,IAAI,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM;IAOpE,qBAAqB,IAAI,iBAAiB,EAAE;IAI5C,yBAAyB;CAG1B"}
@@ -8,20 +8,23 @@ class LdSuiteLoader {
8
8
  constructor(options) {
9
9
  this.signatureMap = {};
10
10
  options.veramoLdSignatures.forEach((obj) => {
11
- this.signatureMap[obj.getSupportedVeramoKeyType()] = obj;
11
+ const keyType = obj.getSupportedVeramoKeyType();
12
+ const verificationType = obj.getSupportedVerificationType();
13
+ return this.signatureMap[keyType] = Object.assign(Object.assign({}, this.signatureMap[keyType]), { [verificationType]: obj });
12
14
  });
13
15
  }
14
- getSignatureSuiteForKeyType(type) {
15
- const suite = this.signatureMap[type];
16
+ getSignatureSuiteForKeyType(type, verificationType) {
17
+ var _a;
18
+ const suite = (_a = this.signatureMap[type]) === null || _a === void 0 ? void 0 : _a[verificationType];
16
19
  if (suite)
17
20
  return suite;
18
21
  throw new Error('No Veramo LD Signature Suite for ' + type);
19
22
  }
20
23
  getAllSignatureSuites() {
21
- return Object.values(this.signatureMap);
24
+ return Object.values(this.signatureMap).map((x) => Object.values(x)).flat();
22
25
  }
23
26
  getAllSignatureSuiteTypes() {
24
- return Object.values(this.signatureMap).map((x) => x.getSupportedVerificationType());
27
+ return Object.values(this.signatureMap).map((x) => Object.keys(x)).flat();
25
28
  }
26
29
  }
27
30
  exports.LdSuiteLoader = LdSuiteLoader;
@@ -1 +1 @@
1
- {"version":3,"file":"ld-suite-loader.js","sourceRoot":"","sources":["../src/ld-suite-loader.ts"],"names":[],"mappings":";;;AAGA;;GAEG;AACH,MAAa,aAAa;IACxB,YAAY,OAAoD;QAKxD,iBAAY,GAAsC,EAAE,CAAA;QAJ1D,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACzC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,yBAAyB,EAAE,CAAC,GAAG,GAAG,CAAA;QAC1D,CAAC,CAAC,CAAA;IACJ,CAAC;IAGD,2BAA2B,CAAC,IAAc;QACxC,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;QACrC,IAAI,KAAK;YAAE,OAAO,KAAK,CAAA;QAEvB,MAAM,IAAI,KAAK,CAAC,mCAAmC,GAAG,IAAI,CAAC,CAAA;IAC7D,CAAC;IAED,qBAAqB;QACnB,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;IACzC,CAAC;IAED,yBAAyB;QACvB,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,4BAA4B,EAAE,CAAC,CAAA;IACtF,CAAC;CACF;AAtBD,sCAsBC"}
1
+ {"version":3,"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Methods, VeramoLdSignature } from '../ld-suites';
2
+ import { CredentialPayload, DIDDocument, IAgentContext, IKey, TKeyType } from '@veramo/core';
3
+ /**
4
+ * Veramo wrapper for the Ed25519Signature2020 suite by digitalcredentials
5
+ *
6
+ * @alpha This API is experimental and is very likely to change or disappear in future releases without notice.
7
+ */
8
+ export declare class VeramoEd25519Signature2020 extends VeramoLdSignature {
9
+ private readonly MULTIBASE_BASE58BTC_PREFIX;
10
+ private readonly MULTICODEC_PREFIX;
11
+ getSupportedVerificationType(): string;
12
+ getSupportedVeramoKeyType(): TKeyType;
13
+ getSuiteForSigning(key: IKey, issuerDid: string, verificationMethodId: string, context: IAgentContext<RequiredAgentMethods>): Promise<any>;
14
+ getSuiteForVerification(): any;
15
+ preSigningCredModification(credential: CredentialPayload): void;
16
+ preDidResolutionModification(didUrl: string, didDoc: DIDDocument): void;
17
+ preSigningKeyModification(key: Uint8Array): string;
18
+ }
19
+ //# sourceMappingURL=Ed25519Signature2020.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Ed25519Signature2020.d.ts","sourceRoot":"","sources":["../../src/suites/Ed25519Signature2020.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AACtE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAK5F;;;;GAIG;AACH,qBAAa,0BAA2B,SAAQ,iBAAiB;IAC/D,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAAM;IACjD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAe;IAEjD,4BAA4B,IAAI,MAAM;IAItC,yBAAyB,IAAI,QAAQ;IAIrC,kBAAkB,CAChB,GAAG,EAAE,IAAI,EACT,SAAS,EAAE,MAAM,EACjB,oBAAoB,EAAE,MAAM,EAC5B,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,GAC3C,OAAO,CAAC,GAAG,CAAC;IAmCf,uBAAuB,IAAI,GAAG;IAI9B,0BAA0B,CAAC,UAAU,EAAE,iBAAiB,GAAG,IAAI;IAI/D,4BAA4B,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI;IAIvE,yBAAyB,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM;CAInD"}
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.VeramoEd25519Signature2020 = void 0;
36
+ const ld_suites_1 = require("../ld-suites");
37
+ const u8a = __importStar(require("uint8arrays"));
38
+ const ed25519_signature_2020_1 = require("@digitalcredentials/ed25519-signature-2020");
39
+ const ed25519_verification_key_2020_1 = require("@digitalcredentials/ed25519-verification-key-2020");
40
+ const util_1 = require("util");
41
+ /**
42
+ * Veramo wrapper for the Ed25519Signature2020 suite by digitalcredentials
43
+ *
44
+ * @alpha This API is experimental and is very likely to change or disappear in future releases without notice.
45
+ */
46
+ class VeramoEd25519Signature2020 extends ld_suites_1.VeramoLdSignature {
47
+ constructor() {
48
+ super(...arguments);
49
+ this.MULTIBASE_BASE58BTC_PREFIX = 'z';
50
+ this.MULTICODEC_PREFIX = [0xed, 0x01];
51
+ }
52
+ getSupportedVerificationType() {
53
+ return 'Ed25519VerificationKey2020';
54
+ }
55
+ getSupportedVeramoKeyType() {
56
+ return 'Ed25519';
57
+ }
58
+ getSuiteForSigning(key, issuerDid, verificationMethodId, context) {
59
+ const controller = issuerDid;
60
+ // DID Key ID
61
+ let id = verificationMethodId;
62
+ const signer = {
63
+ // returns signatureBytes
64
+ sign: (args) => __awaiter(this, void 0, void 0, function* () {
65
+ const messageString = u8a.toString(args.data, 'base64');
66
+ const signature = yield context.agent.keyManagerSign({
67
+ keyRef: key.kid,
68
+ data: messageString,
69
+ encoding: 'base64',
70
+ });
71
+ const utf8Encode = new util_1.TextEncoder();
72
+ return utf8Encode.encode(signature);
73
+ }),
74
+ };
75
+ const verificationKey = new ed25519_verification_key_2020_1.Ed25519VerificationKey2020({
76
+ id,
77
+ controller,
78
+ publicKeyMultibase: this.preSigningKeyModification(u8a.fromString(key.publicKeyHex, 'hex')),
79
+ signer: () => signer,
80
+ type: this.getSupportedVerificationType(),
81
+ });
82
+ // overwrite the signer since we're not passing the private key
83
+ verificationKey.signer = () => signer;
84
+ return new ed25519_signature_2020_1.Ed25519Signature2020({
85
+ key: verificationKey,
86
+ signer: signer
87
+ });
88
+ }
89
+ getSuiteForVerification() {
90
+ return new ed25519_signature_2020_1.Ed25519Signature2020();
91
+ }
92
+ preSigningCredModification(credential) {
93
+ // nothing to do here
94
+ }
95
+ preDidResolutionModification(didUrl, didDoc) {
96
+ // nothing to do here
97
+ }
98
+ preSigningKeyModification(key) {
99
+ const modifiedKey = Uint8Array.from([...this.MULTICODEC_PREFIX, ...key]);
100
+ return `${this.MULTIBASE_BASE58BTC_PREFIX}${u8a.toString(modifiedKey, 'base58btc')}`;
101
+ }
102
+ }
103
+ exports.VeramoEd25519Signature2020 = VeramoEd25519Signature2020;
104
+ //# sourceMappingURL=Ed25519Signature2020.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Ed25519Signature2020.js","sourceRoot":"","sources":["../../src/suites/Ed25519Signature2020.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAsE;AAEtE,iDAAkC;AAClC,uFAAiF;AACjF,qGAA8F;AAC9F,+BAAkC;AAClC;;;;GAIG;AACH,MAAa,0BAA2B,SAAQ,6BAAiB;IAAjE;;QACmB,+BAA0B,GAAG,GAAG,CAAA;QAChC,sBAAiB,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IAkEnD,CAAC;IAhEC,4BAA4B;QAC1B,OAAO,4BAA4B,CAAA;IACrC,CAAC;IAED,yBAAyB;QACvB,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,kBAAkB,CAChB,GAAS,EACT,SAAiB,EACjB,oBAA4B,EAC5B,OAA4C;QAE5C,MAAM,UAAU,GAAG,SAAS,CAAA;QAE5B,aAAa;QACb,IAAI,EAAE,GAAG,oBAAoB,CAAA;QAE7B,MAAM,MAAM,GAAG;YACb,yBAAyB;YACzB,IAAI,EAAE,CAAO,IAA0B,EAAuB,EAAE;gBAC9D,MAAM,aAAa,GAAG,GAAG,CAAC,QAAQ,CAAC,IAA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,CAAC,EAAE,CAAA;IACtF,CAAC;CACF;AApED,gEAoEC"}
@@ -0,0 +1,16 @@
1
+ import { CredentialPayload, DIDDocument, IAgentContext, IKey, TKeyType } from "@veramo/core";
2
+ import { RequiredAgentMethods, VeramoLdSignature } from "../ld-suites";
3
+ /**
4
+ * Veramo wrapper for the JsonWebSignature2020 suite by Transmute Industries
5
+ *
6
+ * @alpha This API is experimental and is very likely to change or disappear in future releases without notice.
7
+ */
8
+ export declare class VeramoJsonWebSignature2020 extends VeramoLdSignature {
9
+ getSupportedVerificationType(): 'JsonWebKey2020';
10
+ getSupportedVeramoKeyType(): TKeyType;
11
+ getSuiteForSigning(key: IKey, issuerDid: string, verificationMethodId: string, context: IAgentContext<RequiredAgentMethods>): Promise<any>;
12
+ getSuiteForVerification(): any;
13
+ preSigningCredModification(credential: CredentialPayload): void;
14
+ preDidResolutionModification(didUrl: string, didDoc: DIDDocument): void;
15
+ }
16
+ //# sourceMappingURL=JsonWebSignature2020.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JsonWebSignature2020.d.ts","sourceRoot":"","sources":["../../src/suites/JsonWebSignature2020.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7F,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAMvE;;;;GAIG;AACH,qBAAa,0BAA2B,SAAQ,iBAAiB;IAC7D,4BAA4B,IAAI,gBAAgB;IAIhD,yBAAyB,IAAI,QAAQ;IAI/B,kBAAkB,CACpB,GAAG,EAAE,IAAI,EACT,SAAS,EAAE,MAAM,EACjB,oBAAoB,EAAE,MAAM,EAC5B,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,GAC7C,OAAO,CAAC,GAAG,CAAC;IA+Cf,uBAAuB,IAAI,GAAG;IAI9B,0BAA0B,CAAC,UAAU,EAAE,iBAAiB,GAAG,IAAI;IAI/D,4BAA4B,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI;CAG1E"}
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.VeramoJsonWebSignature2020 = void 0;
36
+ const ld_suites_1 = require("../ld-suites");
37
+ const u8a = __importStar(require("uint8arrays"));
38
+ const json_web_signature_1 = require("@transmute/json-web-signature");
39
+ const utils_1 = require("@veramo/utils");
40
+ /**
41
+ * Veramo wrapper for the JsonWebSignature2020 suite by Transmute Industries
42
+ *
43
+ * @alpha This API is experimental and is very likely to change or disappear in future releases without notice.
44
+ */
45
+ class VeramoJsonWebSignature2020 extends ld_suites_1.VeramoLdSignature {
46
+ getSupportedVerificationType() {
47
+ return 'JsonWebKey2020';
48
+ }
49
+ getSupportedVeramoKeyType() {
50
+ return 'Ed25519';
51
+ }
52
+ getSuiteForSigning(key, issuerDid, verificationMethodId, context) {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ const controller = issuerDid;
55
+ // DID Key ID
56
+ let id = verificationMethodId;
57
+ const signer = {
58
+ // returns a JWS detached
59
+ sign: (args) => __awaiter(this, void 0, void 0, function* () {
60
+ const header = {
61
+ alg: 'EdDSA',
62
+ b64: false,
63
+ crit: ['b64'],
64
+ };
65
+ const headerString = (0, utils_1.encodeJoseBlob)(header);
66
+ const messageBuffer = u8a.concat([u8a.fromString(`${headerString}.`, 'utf-8'), args.data]);
67
+ const messageString = u8a.toString(messageBuffer, 'base64');
68
+ const signature = yield context.agent.keyManagerSign({
69
+ keyRef: key.kid,
70
+ algorithm: 'EdDSA',
71
+ data: messageString,
72
+ encoding: 'base64',
73
+ });
74
+ return `${headerString}..${signature}`;
75
+ }),
76
+ };
77
+ const verificationKey = yield json_web_signature_1.JsonWebKey.from({
78
+ id: id,
79
+ type: this.getSupportedVerificationType(),
80
+ controller: controller,
81
+ publicKeyJwk: {
82
+ kty: 'OKP',
83
+ crv: 'Ed25519',
84
+ x: u8a.toString(u8a.fromString(key.publicKeyHex, 'hex'), 'base64url'),
85
+ },
86
+ });
87
+ verificationKey.signer = () => signer;
88
+ const suite = new json_web_signature_1.JsonWebSignature({
89
+ key: verificationKey,
90
+ });
91
+ return suite;
92
+ });
93
+ }
94
+ getSuiteForVerification() {
95
+ return new json_web_signature_1.JsonWebSignature();
96
+ }
97
+ preSigningCredModification(credential) {
98
+ credential['@context'] = [...credential['@context'] || [], 'https://w3id.org/security/suites/jws-2020/v1'];
99
+ }
100
+ preDidResolutionModification(didUrl, didDoc) {
101
+ // do nothing
102
+ }
103
+ }
104
+ exports.VeramoJsonWebSignature2020 = VeramoJsonWebSignature2020;
105
+ //# sourceMappingURL=JsonWebSignature2020.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JsonWebSignature2020.js","sourceRoot":"","sources":["../../src/suites/JsonWebSignature2020.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4CAAuE;AACvE,iDAAmC;AACnC,sEAA6E;AAC7E,yCAA+C;AAG/C;;;;GAIG;AACH,MAAa,0BAA2B,SAAQ,6BAAiB;IAC7D,4BAA4B;QACxB,OAAO,gBAAgB,CAAA;IAC3B,CAAC;IAED,yBAAyB;QACrB,OAAO,SAAS,CAAA;IACpB,CAAC;IAEK,kBAAkB,CACpB,GAAS,EACT,SAAiB,EACjB,oBAA4B,EAC5B,OAA4C;;YAE5C,MAAM,UAAU,GAAG,SAAS,CAAA;YAE5B,aAAa;YACb,IAAI,EAAE,GAAG,oBAAoB,CAAA;YAE7B,MAAM,MAAM,GAAG;gBACX,yBAAyB;gBACzB,IAAI,EAAE,CAAO,IAA0B,EAAmB,EAAE;oBACxD,MAAM,MAAM,GAAG;wBACX,GAAG,EAAE,OAAO;wBACZ,GAAG,EAAE,KAAK;wBACV,IAAI,EAAE,CAAC,KAAK,CAAC;qBAChB,CAAA;oBACD,MAAM,YAAY,GAAG,IAAA,sBAAc,EAAC,MAAM,CAAC,CAAA;oBAC3C,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,YAAY,GAAG,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;oBAC1F,MAAM,aAAa,GAAG,GAAG,CAAC,QAAQ,CAAC,aA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",
3
3
  "description": "Veramo plugin for working with W3C JSON-LD Verifiable Credentials & Presentations.",
4
- "version": "4.1.2-next.5+5ebd899b",
4
+ "version": "4.1.3-next.11+6df85207",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
7
7
  "scripts": {
@@ -14,15 +14,17 @@
14
14
  }
15
15
  },
16
16
  "dependencies": {
17
+ "@digitalcredentials/ed25519-signature-2020": "3.0.2",
17
18
  "@digitalcredentials/jsonld": "^5.2.1",
18
19
  "@digitalcredentials/jsonld-signatures": "^9.3.1",
19
- "@digitalcredentials/vc": "^4.2.0",
20
+ "@digitalcredentials/vc": "^5.0.0",
20
21
  "@transmute/credentials-context": "^0.7.0-unstable.67",
21
22
  "@transmute/ed25519-signature-2018": "^0.7.0-unstable.67",
23
+ "@transmute/json-web-signature": "^0.7.0-unstable.67",
22
24
  "@veramo-community/lds-ecdsa-secp256k1-recovery2020": "uport-project/EcdsaSecp256k1RecoverySignature2020",
23
- "@veramo/core": "^4.1.2-next.5+5ebd899b",
24
- "@veramo/did-resolver": "^4.1.2-next.5+5ebd899b",
25
- "@veramo/utils": "^4.1.2-next.5+5ebd899b",
25
+ "@veramo/core": "^4.1.3-next.11+6df85207",
26
+ "@veramo/did-resolver": "^4.1.3-next.11+6df85207",
27
+ "@veramo/utils": "^4.1.3-next.11+6df85207",
26
28
  "debug": "^4.3.3",
27
29
  "did-resolver": "^4.0.1",
28
30
  "uint8arrays": "^3.0.0"
@@ -51,5 +53,5 @@
51
53
  "author": "Mircea Nistor <mircea.nistor@mesh.xyz>",
52
54
  "license": "Apache-2.0",
53
55
  "keywords": [],
54
- "gitHead": "5ebd899b652b9a2fa4e42ff347c239b93766b8c2"
56
+ "gitHead": "6df8520778a8bd3224a4effeed73d459ed6444a4"
55
57
  }
@@ -14,6 +14,10 @@
14
14
  "EcdsaSecp256k1VerificationKey2019": "sec:EcdsaSecp256k1VerificationKey2019",
15
15
  "Ed25519Signature2018": "sec:Ed25519Signature2018",
16
16
  "Ed25519VerificationKey2018": "sec:Ed25519VerificationKey2018",
17
+ "Ed25519Signature2020": "sec:Ed25519Signature2020",
18
+ "Ed25519VerificationKey2020": "sec:Ed25519VerificationKey2020",
19
+ "JsonWebSignature2020": "sec:JsonWebSignature2020",
20
+ "JsonWebKey2020": "sec:JsonWebKey2020",
17
21
  "RsaSignature2018": "sec:RsaSignature2018",
18
22
  "RsaVerificationKey2018": "sec:RsaVerificationKey2018",
19
23
  "SchnorrSecp256k1Signature2019": "sec:SchnorrSecp256k1Signature2019",
@@ -49,6 +53,8 @@
49
53
  "proofValue": "sec:proofValue",
50
54
  "publicKey": {"@id": "sec:publicKey", "@type": "@id", "@container": "@set"},
51
55
  "publicKeyBase58": "sec:publicKeyBase58",
56
+ "publicKeyMultibase": "sec:publicKeyMultibase",
57
+ "publicKeyJwk": "sec:publicKeyJwk",
52
58
  "publicKeyPem": "sec:publicKeyPem",
53
59
  "revoked": {"@id": "sec:revoked", "@type": "xsd:dateTime"},
54
60
  "service": {"@id": "didv:service", "@type": "@id", "@container": "@set"},
@@ -0,0 +1,77 @@
1
+ {
2
+ "@context": {
3
+ "id": "@id",
4
+ "type": "@type",
5
+ "@protected": true,
6
+ "proof": {
7
+ "@id": "https://w3id.org/security#proof",
8
+ "@type": "@id",
9
+ "@container": "@graph"
10
+ },
11
+ "Ed25519VerificationKey2020": {
12
+ "@id": "https://w3id.org/security#Ed25519VerificationKey2020"
13
+ },
14
+ "Ed25519Signature2020": {
15
+ "@id": "https://w3id.org/security#Ed25519Signature2020",
16
+ "@context": {
17
+ "@protected": true,
18
+ "id": "@id",
19
+ "type": "@type",
20
+ "challenge": "https://w3id.org/security#challenge",
21
+ "created": {
22
+ "@id": "http://purl.org/dc/terms/created",
23
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
24
+ },
25
+ "domain": "https://w3id.org/security#domain",
26
+ "expires": {
27
+ "@id": "https://w3id.org/security#expiration",
28
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
29
+ },
30
+ "nonce": "https://w3id.org/security#nonce",
31
+ "proofPurpose": {
32
+ "@id": "https://w3id.org/security#proofPurpose",
33
+ "@type": "@vocab",
34
+ "@context": {
35
+ "@version": 1.1,
36
+ "@protected": true,
37
+ "id": "@id",
38
+ "type": "@type",
39
+ "assertionMethod": {
40
+ "@id": "https://w3id.org/security#assertionMethod",
41
+ "@type": "@id",
42
+ "@container": "@set"
43
+ },
44
+ "authentication": {
45
+ "@id": "https://w3id.org/security#authenticationMethod",
46
+ "@type": "@id",
47
+ "@container": "@set"
48
+ },
49
+ "capabilityInvocation": {
50
+ "@id": "https://w3id.org/security#capabilityInvocationMethod",
51
+ "@type": "@id",
52
+ "@container": "@set"
53
+ },
54
+ "capabilityDelegation": {
55
+ "@id": "https://w3id.org/security#capabilityDelegationMethod",
56
+ "@type": "@id",
57
+ "@container": "@set"
58
+ },
59
+ "keyAgreement": {
60
+ "@id": "https://w3id.org/security#keyAgreementMethod",
61
+ "@type": "@id",
62
+ "@container": "@set"
63
+ }
64
+ }
65
+ },
66
+ "proofValue": {
67
+ "@id": "https://w3id.org/security#proofValue",
68
+ "@type": "https://w3id.org/security#multibase"
69
+ },
70
+ "verificationMethod": {
71
+ "@id": "https://w3id.org/security#verificationMethod",
72
+ "@type": "@id"
73
+ }
74
+ }
75
+ }
76
+ }
77
+ }
@@ -0,0 +1,71 @@
1
+ {
2
+ "@context": {
3
+ "@version": 1.1,
4
+ "id": "@id",
5
+ "type": "@type",
6
+ "@protected": true,
7
+ "JsonWebKey2020": {
8
+ "@id": "https://w3id.org/security#JsonWebKey2020"
9
+ },
10
+ "JsonWebSignature2020": {
11
+ "@id": "https://w3id.org/security#JsonWebSignature2020",
12
+ "@context": {
13
+ "@version": 1.1,
14
+ "id": "@id",
15
+ "type": "@type",
16
+ "@protected": true,
17
+ "challenge": "https://w3id.org/security#challenge",
18
+ "created": {
19
+ "@id": "http://purl.org/dc/terms/created",
20
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
21
+ },
22
+ "domain": "https://w3id.org/security#domain",
23
+ "expires": {
24
+ "@id": "https://w3id.org/security#expiration",
25
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
26
+ },
27
+ "jws": "https://w3id.org/security#jws",
28
+ "nonce": "https://w3id.org/security#nonce",
29
+ "proofPurpose": {
30
+ "@id": "https://w3id.org/security#proofPurpose",
31
+ "@type": "@vocab",
32
+ "@context": {
33
+ "@version": 1.1,
34
+ "@protected": true,
35
+ "id": "@id",
36
+ "type": "@type",
37
+ "assertionMethod": {
38
+ "@id": "https://w3id.org/security#assertionMethod",
39
+ "@type": "@id",
40
+ "@container": "@set"
41
+ },
42
+ "authentication": {
43
+ "@id": "https://w3id.org/security#authenticationMethod",
44
+ "@type": "@id",
45
+ "@container": "@set"
46
+ },
47
+ "capabilityInvocation": {
48
+ "@id": "https://w3id.org/security#capabilityInvocationMethod",
49
+ "@type": "@id",
50
+ "@container": "@set"
51
+ },
52
+ "capabilityDelegation": {
53
+ "@id": "https://w3id.org/security#capabilityDelegationMethod",
54
+ "@type": "@id",
55
+ "@container": "@set"
56
+ },
57
+ "keyAgreement": {
58
+ "@id": "https://w3id.org/security#keyAgreementMethod",
59
+ "@type": "@id",
60
+ "@container": "@set"
61
+ }
62
+ }
63
+ },
64
+ "verificationMethod": {
65
+ "@id": "https://w3id.org/security#verificationMethod",
66
+ "@type": "@id"
67
+ }
68
+ }
69
+ }
70
+ }
71
+ }
package/src/index.ts CHANGED
@@ -16,6 +16,8 @@ export { LdDefaultContexts } from './ld-default-contexts'
16
16
  export { VeramoLdSignature } from './ld-suites'
17
17
  export * from './suites/EcdsaSecp256k1RecoverySignature2020'
18
18
  export * from './suites/Ed25519Signature2018'
19
+ export * from './suites/Ed25519Signature2020'
20
+ export * from './suites/JsonWebSignature2020'
19
21
 
20
22
  /**
21
23
  * The parameter and return types schemas for the {@link @veramo/credential-ld#CredentialIssuerLD | CredentialIssuerLD}
@@ -101,7 +101,7 @@ export class LdCredentialModule {
101
101
  options: any,
102
102
  context: IAgentContext<RequiredAgentMethods>,
103
103
  ): Promise<VerifiableCredential> {
104
- const suite = this.ldSuiteLoader.getSignatureSuiteForKeyType(key.type)
104
+ const suite = this.ldSuiteLoader.getSignatureSuiteForKeyType(key.type, key.meta?.verificationMethod?.type ?? '')
105
105
  const documentLoader = this.getDocumentLoader(context, options.fetchRemoteContexts)
106
106
 
107
107
  // some suites can modify the incoming credential (e.g. add required contexts)
@@ -110,7 +110,7 @@ export class LdCredentialModule {
110
110
  return await vc.issue({
111
111
  ...options,
112
112
  credential,
113
- suite: suite.getSuiteForSigning(key, issuerDid, verificationMethodId, context),
113
+ suite: await suite.getSuiteForSigning(key, issuerDid, verificationMethodId, context),
114
114
  documentLoader,
115
115
  compactProof: false,
116
116
  })
@@ -126,7 +126,7 @@ export class LdCredentialModule {
126
126
  options: any,
127
127
  context: IAgentContext<RequiredAgentMethods>,
128
128
  ): Promise<VerifiablePresentation> {
129
- const suite = this.ldSuiteLoader.getSignatureSuiteForKeyType(key.type)
129
+ const suite = this.ldSuiteLoader.getSignatureSuiteForKeyType(key.type, key.meta?.verificationMethod?.type ?? '')
130
130
  const documentLoader = this.getDocumentLoader(context, options.fetchRemoteContexts)
131
131
 
132
132
  suite.preSigningPresModification(presentation)
@@ -134,7 +134,7 @@ export class LdCredentialModule {
134
134
  return await vc.signPresentation({
135
135
  ...options,
136
136
  presentation,
137
- suite: suite.getSuiteForSigning(key, holderDid, verificationMethodId, context),
137
+ suite: await suite.getSuiteForSigning(key, holderDid, verificationMethodId, context),
138
138
  challenge,
139
139
  domain,
140
140
  documentLoader,
@@ -16,6 +16,8 @@ export const LdDefaultContexts = new Map([
16
16
  ['https://w3id.org/security/v3-unstable', require('./contexts/w3id.org_security_v3-unstable.json')],
17
17
  ['https://w3id.org/security/suites/ed25519-2018/v1', require('./contexts/w3id.org_security_suites_ed25519-2018_v1.json')],
18
18
  ['https://w3id.org/security/suites/x25519-2019/v1', require('./contexts/w3id.org_security_suites_x25519-2019_v1.json')],
19
+ ['https://w3id.org/security/suites/ed25519-2020/v1', require('./contexts/ed25519-signature-2020-v1.json')],
20
+ ['https://w3id.org/security/suites/jws-2020/v1', require('./contexts/json-web-signature-2020-v1.json')],
19
21
  // ['https://w3id.org/did/v0.11', require('./contexts/did_v0.11.json')],
20
22
  // ['https://veramo.io/contexts/socialmedia/v1', require('./contexts/socialmedia-v1.json')],
21
23
  // ['https://veramo.io/contexts/kyc/v1', require('./contexts/kyc-v1.json')],
@@ -7,23 +7,25 @@ import { TKeyType } from '@veramo/core'
7
7
  export class LdSuiteLoader {
8
8
  constructor(options: { veramoLdSignatures: VeramoLdSignature[] }) {
9
9
  options.veramoLdSignatures.forEach((obj) => {
10
- this.signatureMap[obj.getSupportedVeramoKeyType()] = obj
10
+ const keyType = obj.getSupportedVeramoKeyType()
11
+ const verificationType = obj.getSupportedVerificationType()
12
+ return this.signatureMap[keyType] = { ...this.signatureMap[keyType], [verificationType]: obj }
11
13
  })
12
14
  }
13
- private signatureMap: Record<string, VeramoLdSignature> = {}
15
+ private signatureMap: Record<string, Record<string, VeramoLdSignature>> = {}
14
16
 
15
- getSignatureSuiteForKeyType(type: TKeyType) {
16
- const suite = this.signatureMap[type]
17
+ getSignatureSuiteForKeyType(type: TKeyType, verificationType: string) {
18
+ const suite = this.signatureMap[type]?.[verificationType]
17
19
  if (suite) return suite
18
20
 
19
21
  throw new Error('No Veramo LD Signature Suite for ' + type)
20
22
  }
21
23
 
22
- getAllSignatureSuites() {
23
- return Object.values(this.signatureMap)
24
+ getAllSignatureSuites(): VeramoLdSignature[] {
25
+ return Object.values(this.signatureMap).map((x) => Object.values(x)).flat()
24
26
  }
25
27
 
26
28
  getAllSignatureSuiteTypes() {
27
- return Object.values(this.signatureMap).map((x) => x.getSupportedVerificationType())
29
+ return Object.values(this.signatureMap).map((x) => Object.keys(x)).flat()
28
30
  }
29
31
  }
@@ -1,6 +1,8 @@
1
1
  declare module '@digitalcredentials/jsonld'
2
2
  declare module '@digitalcredentials/jsonld-signatures'
3
3
  declare module '@digitalcredentials/vc'
4
+ declare module '@digitalcredentials/ed25519-signature-2020'
5
+ declare module '@digitalcredentials/ed25519-verification-key-2020'
4
6
  declare module '@veramo-community/lds-ecdsa-secp256k1-recovery2020'
5
7
 
6
8
  declare module "*.json" {
@@ -0,0 +1,80 @@
1
+ import { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites'
2
+ import { CredentialPayload, DIDDocument, IAgentContext, IKey, TKeyType } from '@veramo/core'
3
+ import * as u8a from 'uint8arrays'
4
+ import { Ed25519Signature2020 } from '@digitalcredentials/ed25519-signature-2020'
5
+ import { Ed25519VerificationKey2020 } from '@digitalcredentials/ed25519-verification-key-2020'
6
+ import { TextEncoder } from 'util'
7
+ /**
8
+ * Veramo wrapper for the Ed25519Signature2020 suite by digitalcredentials
9
+ *
10
+ * @alpha This API is experimental and is very likely to change or disappear in future releases without notice.
11
+ */
12
+ export class VeramoEd25519Signature2020 extends VeramoLdSignature {
13
+ private readonly MULTIBASE_BASE58BTC_PREFIX = 'z'
14
+ private readonly MULTICODEC_PREFIX = [0xed, 0x01]
15
+
16
+ getSupportedVerificationType(): string {
17
+ return 'Ed25519VerificationKey2020'
18
+ }
19
+
20
+ getSupportedVeramoKeyType(): TKeyType {
21
+ return 'Ed25519'
22
+ }
23
+
24
+ getSuiteForSigning(
25
+ key: IKey,
26
+ issuerDid: string,
27
+ verificationMethodId: string,
28
+ context: IAgentContext<RequiredAgentMethods>,
29
+ ): Promise<any> {
30
+ const controller = issuerDid
31
+
32
+ // DID Key ID
33
+ let id = verificationMethodId
34
+
35
+ const signer = {
36
+ // returns signatureBytes
37
+ sign: async (args: { data: Uint8Array }): Promise<Uint8Array> => {
38
+ const messageString = u8a.toString(args.data, 'base64')
39
+ const signature = await context.agent.keyManagerSign({
40
+ keyRef: key.kid,
41
+ data: messageString,
42
+ encoding: 'base64',
43
+ })
44
+ const utf8Encode = new TextEncoder()
45
+ return utf8Encode.encode(signature)
46
+ },
47
+ }
48
+
49
+ const verificationKey = new Ed25519VerificationKey2020({
50
+ id,
51
+ controller,
52
+ publicKeyMultibase: this.preSigningKeyModification(u8a.fromString(key.publicKeyHex, 'hex')),
53
+ signer: ()=> signer,
54
+ type: this.getSupportedVerificationType(),
55
+ })
56
+ // overwrite the signer since we're not passing the private key
57
+ verificationKey.signer = () => signer as any
58
+ return new Ed25519Signature2020({
59
+ key: verificationKey,
60
+ signer: signer
61
+ })
62
+ }
63
+
64
+ getSuiteForVerification(): any {
65
+ return new Ed25519Signature2020()
66
+ }
67
+
68
+ preSigningCredModification(credential: CredentialPayload): void {
69
+ // nothing to do here
70
+ }
71
+
72
+ preDidResolutionModification(didUrl: string, didDoc: DIDDocument): void {
73
+ // nothing to do here
74
+ }
75
+
76
+ preSigningKeyModification(key: Uint8Array): string {
77
+ const modifiedKey = Uint8Array.from([...this.MULTICODEC_PREFIX, ...key])
78
+ return `${this.MULTIBASE_BASE58BTC_PREFIX}${u8a.toString(modifiedKey, 'base58btc')}`
79
+ }
80
+ }
@@ -0,0 +1,85 @@
1
+ import { CredentialPayload, DIDDocument, IAgentContext, IKey, TKeyType } from "@veramo/core";
2
+ import { RequiredAgentMethods, VeramoLdSignature } from "../ld-suites";
3
+ import * as u8a from "uint8arrays";
4
+ import { JsonWebKey, JsonWebSignature } from "@transmute/json-web-signature";
5
+ import { encodeJoseBlob } from "@veramo/utils";
6
+
7
+
8
+ /**
9
+ * Veramo wrapper for the JsonWebSignature2020 suite by Transmute Industries
10
+ *
11
+ * @alpha This API is experimental and is very likely to change or disappear in future releases without notice.
12
+ */
13
+ export class VeramoJsonWebSignature2020 extends VeramoLdSignature {
14
+ getSupportedVerificationType(): 'JsonWebKey2020' {
15
+ return 'JsonWebKey2020'
16
+ }
17
+
18
+ getSupportedVeramoKeyType(): TKeyType {
19
+ return 'Ed25519'
20
+ }
21
+
22
+ async getSuiteForSigning(
23
+ key: IKey,
24
+ issuerDid: string,
25
+ verificationMethodId: string,
26
+ context: IAgentContext<RequiredAgentMethods>,
27
+ ): Promise<any> {
28
+ const controller = issuerDid
29
+
30
+ // DID Key ID
31
+ let id = verificationMethodId
32
+
33
+ const signer = {
34
+ // returns a JWS detached
35
+ sign: async (args: { data: Uint8Array }): Promise<string> => {
36
+ const header = {
37
+ alg: 'EdDSA',
38
+ b64: false,
39
+ crit: ['b64'],
40
+ }
41
+ const headerString = encodeJoseBlob(header)
42
+ const messageBuffer = u8a.concat([u8a.fromString(`${headerString}.`, 'utf-8'), args.data])
43
+ const messageString = u8a.toString(messageBuffer, 'base64')
44
+ const signature = await context.agent.keyManagerSign({
45
+ keyRef: key.kid,
46
+ algorithm: 'EdDSA',
47
+ data: messageString,
48
+ encoding: 'base64',
49
+ })
50
+ return `${headerString}..${signature}`
51
+ },
52
+ }
53
+
54
+ const verificationKey = await JsonWebKey.from({
55
+ id: id,
56
+ type: this.getSupportedVerificationType(),
57
+ controller: controller,
58
+ publicKeyJwk: {
59
+ kty: 'OKP',
60
+ crv: 'Ed25519',
61
+ x: u8a.toString(u8a.fromString(key.publicKeyHex, 'hex'), 'base64url'),
62
+ },
63
+ })
64
+
65
+ verificationKey.signer = () => signer
66
+
67
+ const suite = new JsonWebSignature({
68
+ key: verificationKey,
69
+ })
70
+
71
+ return suite
72
+ }
73
+
74
+ getSuiteForVerification(): any {
75
+ return new JsonWebSignature()
76
+ }
77
+
78
+ preSigningCredModification(credential: CredentialPayload): void {
79
+ credential['@context'] = [...credential['@context'] || [], 'https://w3id.org/security/suites/jws-2020/v1']
80
+ }
81
+
82
+ preDidResolutionModification(didUrl: string, didDoc: DIDDocument): void {
83
+ // do nothing
84
+ }
85
+ }