@veramo/credential-ld 3.1.5-next.115 → 3.1.5-next.119
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.
- package/build/ld-credential-module.js +1 -1
- package/build/ld-credential-module.js.map +1 -1
- package/build/ld-default-contexts.d.ts.map +1 -1
- package/build/ld-default-contexts.js +18 -14
- package/build/ld-default-contexts.js.map +1 -1
- package/build/ld-suites.js +2 -1
- package/build/ld-suites.js.map +1 -1
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.d.ts +2 -1
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.d.ts.map +1 -1
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.js +20 -7
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.js.map +1 -1
- package/package.json +8 -8
- package/src/__tests__/issue-verify-flow.test.ts +106 -3
- package/{contexts → src/contexts}/did_v0.11.json +0 -0
- package/{contexts → src/contexts}/ed25519-signature-2018-v1.json +0 -0
- package/{contexts → src/contexts}/kyc-v1.json +0 -0
- package/src/contexts/lds-ecdsa-secp256k1-recovery2020-0.0.json +21 -0
- package/{contexts → src/contexts}/socialmedia-v1.json +0 -0
- package/{contexts → src/contexts}/transmute_v1.json +0 -0
- package/{contexts/profile-v1.json → src/contexts/veramo.io_contexts_profile_v1.json} +0 -0
- package/src/contexts/w3id.org_security_suites_ed25519-2018_v1.json +59 -0
- package/src/contexts/w3id.org_security_suites_secp256k1recovery-2020_v2.json +87 -0
- package/{contexts/X25519KeyAgreementKey2019.json → src/contexts/w3id.org_security_suites_x25519-2019_v1.json} +0 -0
- package/src/contexts/w3id.org_security_v1.json +50 -0
- package/src/contexts/w3id.org_security_v2.json +59 -0
- package/src/contexts/w3id.org_security_v3-unstable.json +720 -0
- package/{contexts/w3_2018_credentials_v1.json → src/contexts/www.w3.org_2018_credentials_v1.json} +0 -0
- package/{contexts/security_context_v1.json → src/contexts/www.w3.org_ns_did_v1.json} +0 -0
- package/src/ld-credential-module.ts +1 -1
- package/src/ld-default-contexts.ts +18 -15
- package/src/ld-suites.ts +1 -1
- package/src/suites/EcdsaSecp256k1RecoverySignature2020.ts +21 -6
- package/contexts/lds-ecdsa-secp256k1-recovery2020-0.0.json +0 -60
|
@@ -39,7 +39,7 @@ exports.LdCredentialModule = void 0;
|
|
|
39
39
|
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
40
40
|
const debug_1 = __importDefault(require("debug"));
|
|
41
41
|
const jsonld_signatures_1 = require("jsonld-signatures");
|
|
42
|
-
const vc = __importStar(require("vc
|
|
42
|
+
const vc = __importStar(require("@digitalbazaar/vc"));
|
|
43
43
|
const AssertionProofPurpose = jsonld_signatures_1.purposes.AssertionProofPurpose;
|
|
44
44
|
const debug = (0, debug_1.default)('veramo:w3c:ld-credential-module');
|
|
45
45
|
class LdCredentialModule {
|
|
@@ -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,yDAAiE;AACjE,
|
|
1
|
+
{"version":3,"file":"ld-credential-module.js","sourceRoot":"","sources":["../src/ld-credential-module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,8DAA+B;AAC/B,kDAAyB;AACzB,yDAAiE;AACjE,sDAAuC;AAKvC,MAAM,qBAAqB,GAAG,4BAAQ,CAAC,qBAAqB,CAAA;AAE5D,MAAM,KAAK,GAAG,IAAA,eAAK,EAAC,iCAAiC,CAAC,CAAA;AAEtD,MAAa,kBAAkB;IAW7B,YAAY,OAA2E;QACrF,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAA;QAC9C,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAA;IAC5C,CAAC;IAED,iBAAiB,CAAC,OAAiC,EAAE,yB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CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAA;YACrF,gDAAgD;YAChD,MAAM,KAAK,CAAC,0CAA0C,CAAC,CAAA;QACzD,CAAC;KAAA;IAEK,kBAAkB,CACtB,YAAoC,EACpC,SAA6B,EAC7B,MAA0B,EAC1B,sBAA+B,KAAK,EACpC,OAAiC;;YAEjC,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC;gBAC7B,YAAY;gBACZ,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,qBAAqB,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,uBAAuB,EAAE,CAAC;gBACzF,cAAc,EAAE,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,mBAAmB,CAAC;gBACpE,SAAS;gBACT,MAAM;gBACN,OAAO,EAAE,IAAI,qBAAqB,EAAE;gBACpC,YAAY,EAAE,KAAK;aACpB,CAAC,CAAA;YAEF,IAAI,MAAM,CAAC,QAAQ;gBAAE,OAAO,IAAI,CAAA;YAEhC,gBAAgB;YAEhB,+BAA+B;YAC/B,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAA;YACzD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;YAC5C,MAAM,KAAK,CAAC,4CAA4C,CAAC,CAAA;QAC3D,CAAC;KAAA;CACF;AArLD,gDAqLC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ld-default-contexts.d.ts","sourceRoot":"","sources":["../src/ld-default-contexts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAMpC;;GAEG;AACH,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"ld-default-contexts.d.ts","sourceRoot":"","sources":["../src/ld-default-contexts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAMpC;;GAEG;AACH,eAAO,MAAM,iBAAiB,kCAkB5B,CAAA"}
|
|
@@ -35,25 +35,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
35
35
|
exports.LdDefaultContexts = void 0;
|
|
36
36
|
function _read(_path) {
|
|
37
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
return yield Promise.resolve().then(() => __importStar(require('
|
|
38
|
+
return yield Promise.resolve().then(() => __importStar(require('./contexts/' + _path)));
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Provides a hardcoded map of common context definitions
|
|
43
43
|
*/
|
|
44
44
|
exports.LdDefaultContexts = new Map([
|
|
45
|
-
['https://www.w3.org/2018/credentials/v1', _read('
|
|
46
|
-
['https://www.w3.org/ns/did/v1', _read('
|
|
47
|
-
['https://w3id.org/
|
|
48
|
-
['https://
|
|
49
|
-
['https://
|
|
50
|
-
['https://
|
|
51
|
-
['https://
|
|
52
|
-
[
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
],
|
|
56
|
-
['https://
|
|
57
|
-
['https://
|
|
45
|
+
['https://www.w3.org/2018/credentials/v1', _read('www.w3.org_2018_credentials_v1.json')],
|
|
46
|
+
['https://www.w3.org/ns/did/v1', _read('www.w3.org_ns_did_v1.json')],
|
|
47
|
+
['https://w3id.org/security/v1', _read('w3id.org_security_v1.json')],
|
|
48
|
+
['https://w3id.org/security/v2', _read('w3id.org_security_v2.json')],
|
|
49
|
+
['https://w3id.org/security/v3-unstable', _read('w3id.org_security_v3-unstable.json')],
|
|
50
|
+
['https://w3id.org/security/suites/ed25519-2018/v1', _read('w3id.org_security_suites_ed25519-2018_v1.json')],
|
|
51
|
+
['https://w3id.org/security/suites/x25519-2019/v1', _read('w3id.org_security_suites_x25519-2019_v1.json')],
|
|
52
|
+
// ['https://w3id.org/did/v0.11', _read('did_v0.11.json')],
|
|
53
|
+
// ['https://veramo.io/contexts/socialmedia/v1', _read('socialmedia-v1.json')],
|
|
54
|
+
// ['https://veramo.io/contexts/kyc/v1', _read('kyc-v1.json')],
|
|
55
|
+
['https://veramo.io/contexts/profile/v1', _read('veramo.io_contexts_profile_v1.json')],
|
|
56
|
+
// ['https://ns.did.ai/transmute/v1', _read('transmute_v1.json')],
|
|
57
|
+
['https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld', _read('lds-ecdsa-secp256k1-recovery2020-0.0.json')],
|
|
58
|
+
['https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-2.0.jsonld', _read('w3id.org_security_suites_secp256k1recovery-2020_v2.json')],
|
|
59
|
+
['https://w3id.org/security/suites/secp256k1recovery-2020/v2', _read('w3id.org_security_suites_secp256k1recovery-2020_v2.json')],
|
|
60
|
+
// ['https://w3id.org/security/suites/ed25519-2018/v1', _read('ed25519-signature-2018-v1.json')],
|
|
61
|
+
// ['https://w3id.org/security/suites/x25519-2019/v1', _read('X25519KeyAgreementKey2019.json')],
|
|
58
62
|
]);
|
|
59
63
|
//# sourceMappingURL=ld-default-contexts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ld-default-contexts.js","sourceRoot":"","sources":["../src/ld-default-contexts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAe,KAAK,CAAC,KAAa;;QAChC,OAAO,wDAAa,
|
|
1
|
+
{"version":3,"file":"ld-default-contexts.js","sourceRoot":"","sources":["../src/ld-default-contexts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAe,KAAK,CAAC,KAAa;;QAChC,OAAO,wDAAa,aAAa,GAAG,KAAK,GAAC,CAAC;IAC7C,CAAC;CAAA;AAED;;GAEG;AACU,QAAA,iBAAiB,GAAG,IAAI,GAAG,CAAC;IACvC,CAAC,wCAAwC,EAAE,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACxF,CAAC,8BAA8B,EAAE,KAAK,CAAC,2BAA2B,CAAC,CAAC;IACpE,CAAC,8BAA8B,EAAE,KAAK,CAAC,2BAA2B,CAAC,CAAC;IACpE,CAAC,8BAA8B,EAAE,KAAK,CAAC,2BAA2B,CAAC,CAAC;IACpE,CAAC,uCAAuC,EAAE,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACtF,CAAC,kDAAkD,EAAE,KAAK,CAAC,+CAA+C,CAAC,CAAC;IAC5G,CAAC,iDAAiD,EAAE,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAC1G,2DAA2D;IAC3D,+EAA+E;IAC/E,+DAA+D;IAC/D,CAAC,uCAAuC,EAAE,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACtF,kEAAkE;IAClE,CAAC,6GAA6G,EAAE,KAAK,CAAC,2CAA2C,CAAC,CAAC;IACnK,CAAC,6GAA6G,EAAE,KAAK,CAAC,yDAAyD,CAAC,CAAC;IACjL,CAAC,4DAA4D,EAAE,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAChI,iGAAiG;IACjG,gGAAgG;CACjG,CAAC,CAAA"}
|
package/build/ld-suites.js
CHANGED
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.VeramoLdSignature = void 0;
|
|
4
4
|
class VeramoLdSignature {
|
|
5
5
|
preSigningPresModification(presentation) {
|
|
6
|
+
var _a;
|
|
6
7
|
// TODO: Remove invalid field 'verifiers' from Presentation. Needs to be adapted for LD credentials
|
|
7
8
|
// Only remove empty array (vc.signPresentation will throw then)
|
|
8
9
|
const sanitizedPresentation = presentation;
|
|
9
|
-
if (sanitizedPresentation.verifier.length == 0) {
|
|
10
|
+
if (((_a = sanitizedPresentation.verifier) === null || _a === void 0 ? void 0 : _a.length) == 0) {
|
|
10
11
|
delete sanitizedPresentation.verifier;
|
|
11
12
|
}
|
|
12
13
|
}
|
package/build/ld-suites.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ld-suites.js","sourceRoot":"","sources":["../src/ld-suites.ts"],"names":[],"mappings":";;;AAaA,MAAsB,iBAAiB;IAuBrC,0BAA0B,CAAC,YAAiC
|
|
1
|
+
{"version":3,"file":"ld-suites.js","sourceRoot":"","sources":["../src/ld-suites.ts"],"names":[],"mappings":";;;AAaA,MAAsB,iBAAiB;IAuBrC,0BAA0B,CAAC,YAAiC;;QAC1D,mGAAmG;QACnG,gEAAgE;QAChE,MAAM,qBAAqB,GAAG,YAAmB,CAAA;QACjD,IAAI,CAAA,MAAA,qBAAqB,CAAC,QAAQ,0CAAE,MAAM,KAAI,CAAC,EAAE;YAC/C,OAAO,qBAAqB,CAAC,QAAQ,CAAA;SACtC;IACH,CAAC;CACF;AA/BD,8CA+BC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites';
|
|
2
|
-
import { CredentialPayload, DIDDocument, IAgentContext, IKey, TKeyType } from '@veramo/core';
|
|
2
|
+
import { CredentialPayload, DIDDocument, IAgentContext, IKey, PresentationPayload, TKeyType } from '@veramo/core';
|
|
3
3
|
export declare class VeramoEcdsaSecp256k1RecoverySignature2020 extends VeramoLdSignature {
|
|
4
4
|
getSupportedVerificationType(): string;
|
|
5
5
|
getSupportedVeramoKeyType(): TKeyType;
|
|
6
6
|
getSuiteForSigning(key: IKey, did: string, verifiableMethodId: string, context: IAgentContext<RequiredAgentMethods>): any;
|
|
7
7
|
getSuiteForVerification(): any;
|
|
8
8
|
preSigningCredModification(credential: CredentialPayload): void;
|
|
9
|
+
preSigningPresModification(presentation: PresentationPayload): void;
|
|
9
10
|
preDidResolutionModification(didUrl: string, didDoc: DIDDocument): void;
|
|
10
11
|
}
|
|
11
12
|
//# sourceMappingURL=EcdsaSecp256k1RecoverySignature2020.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EcdsaSecp256k1RecoverySignature2020.d.ts","sourceRoot":"","sources":["../../src/suites/EcdsaSecp256k1RecoverySignature2020.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;
|
|
1
|
+
{"version":3,"file":"EcdsaSecp256k1RecoverySignature2020.d.ts","sourceRoot":"","sources":["../../src/suites/EcdsaSecp256k1RecoverySignature2020.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AACtE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,aAAa,EAAE,IAAI,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AASjH,qBAAa,yCAA0C,SAAQ,iBAAiB;IAC9E,4BAA4B,IAAI,MAAM;IAItC,yBAAyB,IAAI,QAAQ;IAIrC,kBAAkB,CAChB,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,MAAM,EACX,kBAAkB,EAAE,MAAM,EAC1B,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,GAC3C,GAAG;IAmCN,uBAAuB,IAAI,GAAG;IAI9B,0BAA0B,CAAC,UAAU,EAAE,iBAAiB,GAAG,IAAI;IAO/D,0BAA0B,CAAC,YAAY,EAAE,mBAAmB,GAAG,IAAI;IAQnE,4BAA4B,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI;CAmBxE"}
|
|
@@ -83,18 +83,31 @@ class VeramoEcdsaSecp256k1RecoverySignature2020 extends ld_suites_1.VeramoLdSign
|
|
|
83
83
|
preSigningCredModification(credential) {
|
|
84
84
|
credential['@context'] = [
|
|
85
85
|
...(0, utils_1.asArray)(credential['@context'] || []),
|
|
86
|
-
'https://
|
|
86
|
+
'https://w3id.org/security/suites/secp256k1recovery-2020/v2',
|
|
87
|
+
];
|
|
88
|
+
}
|
|
89
|
+
preSigningPresModification(presentation) {
|
|
90
|
+
super.preSigningPresModification(presentation);
|
|
91
|
+
presentation['@context'] = [
|
|
92
|
+
...(0, utils_1.asArray)(presentation['@context'] || []),
|
|
93
|
+
'https://w3id.org/security/suites/secp256k1recovery-2020/v2',
|
|
87
94
|
];
|
|
88
95
|
}
|
|
89
96
|
preDidResolutionModification(didUrl, didDoc) {
|
|
90
|
-
var _a;
|
|
91
|
-
//
|
|
97
|
+
var _a, _b;
|
|
98
|
+
// did:ethr
|
|
99
|
+
const idx = ((_a = didDoc['@context']) === null || _a === void 0 ? void 0 : _a.indexOf('https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld')) || -1;
|
|
100
|
+
if (Array.isArray(didDoc['@context']) && idx !== -1) {
|
|
101
|
+
didDoc['@context'][idx] = "https://w3id.org/security/suites/secp256k1recovery-2020/v2";
|
|
102
|
+
}
|
|
92
103
|
if (didUrl.toLowerCase().startsWith('did:ethr')) {
|
|
93
|
-
//
|
|
94
|
-
|
|
95
|
-
(_a = didDoc.verificationMethod) === null || _a === void 0 ? void 0 : _a.forEach((x) => {
|
|
104
|
+
//EcdsaSecp256k1RecoveryMethod2020 does not support older format blockchainAccountId
|
|
105
|
+
(_b = didDoc.verificationMethod) === null || _b === void 0 ? void 0 : _b.forEach((x) => {
|
|
96
106
|
if (x.blockchainAccountId) {
|
|
97
|
-
|
|
107
|
+
if (x.blockchainAccountId.lastIndexOf('@eip155:') !== -1) {
|
|
108
|
+
const [address, chain] = x.blockchainAccountId.split("@eip155:");
|
|
109
|
+
x.blockchainAccountId = `eip155:${chain}:${address}`;
|
|
110
|
+
}
|
|
98
111
|
}
|
|
99
112
|
});
|
|
100
113
|
}
|
|
@@ -1 +1 @@
|
|
|
1
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;SACF,CAAA;QAED,OAAO,IAAI,sEAAmC,CAAC;YAC7C,UAAU;YACV,GAAG,EAAE,IAAI,mEAAgC,CAAC;gBACxC,YAAY,EAAE,GAAG,CAAC,YAAY;gBAC9B,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM;gBACpB,IAAI,EAAE,IAAI,CAAC,4BAA4B,EAAE;gBACzC,UAAU;gBACV,EAAE,EAAE,kBAAkB;aACvB,CAAC;SACH,CAAC,CAAA;IACJ,CAAC;IAED,uBAAuB;QACrB,OAAO,IAAI,sEAAmC,EAAE,CAAA;IAClD,CAAC;IAED,0BAA0B,CAAC,UAA6B;QACtD,UAAU,CAAC,UAAU,CAAC,GAAG;YACvB,GAAG,IAAA,eAAO,EAAC,UAAU,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;YACxC,
|
|
1
|
+
{"version":3,"file":"EcdsaSecp256k1RecoverySignature2020.js","sourceRoot":"","sources":["../../src/suites/EcdsaSecp256k1RecoverySignature2020.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAsE;AAEtE,kGAGoD;AAEpD,iDAAkC;AAClC,yCAAuD;AAEvD,MAAa,yCAA0C,SAAQ,6BAAiB;IAC9E,4BAA4B;QAC1B,OAAO,kCAAkC,CAAA;IAC3C,CAAC;IAED,yBAAyB;QACvB,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,kBAAkB,CAChB,GAAS,EACT,GAAW,EACX,kBAA0B,EAC1B,OAA4C;QAE5C,MAAM,UAAU,GAAG,GAAG,CAAA;QACtB,MAAM,MAAM,GAAG;YACb,wBAAwB;YACxB,IAAI,EAAE,CAAO,IAA0B,EAAmB,EAAE;gBAC1D,MAAM,MAAM,GAAG;oBACb,GAAG,EAAE,UAAU;oBACf,GAAG,EAAE,KAAK;oBACV,IAAI,EAAE,CAAC,KAAK,CAAC;iBACd,CAAA;gBACD,MAAM,YAAY,GAAG,IAAA,sBAAc,EAAC,MAAM,CAAC,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AE,CAAC;YAC1C,4DAA4D;SAC7D,CAAA;IACH,CAAC;IAED,4BAA4B,CAAC,MAAc,EAAE,MAAmB;;QAClE,cAAc;QACV,MAAM,GAAG,GAAG,CAAA,MAAA,MAAM,CAAC,UAAU,CAAC,0CAAE,OAAO,CAAC,6GAA6G,CAAC,KAAI,CAAC,CAAC,CAAA;QAC5J,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE;YACnD,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,GAAG,4DAA4D,CAAA;SACvF;QAED,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;YAC/C,oFAAoF;YACpF,MAAA,MAAM,CAAC,kBAAkB,0CAAE,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;gBACvC,IAAI,CAAC,CAAC,mBAAmB,EAAE;oBACzB,IAAI,CAAC,CAAC,mBAAmB,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE;wBACxD,MAAM,CAAE,OAAO,EAAE,KAAK,CAAE,GAAG,CAAC,CAAC,mBAAmB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;wBAClE,CAAC,CAAC,mBAAmB,GAAG,UAAU,KAAK,IAAI,OAAO,EAAE,CAAA;qBACrD;iBACF;YACH,CAAC,CAAC,CAAA;SACH;IACH,CAAC;CACF;AAvFD,8FAuFC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veramo/credential-ld",
|
|
3
3
|
"description": "Veramo plugin for working with W3C JSON-LD Verifiable Credentials & Presentations.",
|
|
4
|
-
"version": "3.1.5-next.
|
|
4
|
+
"version": "3.1.5-next.119+3a0765ef",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -14,18 +14,18 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
+
"@digitalbazaar/vc": "^2.1.0",
|
|
17
18
|
"@transmute/credentials-context": "^0.7.0-unstable.34",
|
|
18
19
|
"@transmute/ed25519-signature-2018": "^0.7.0-unstable.34",
|
|
19
|
-
"@transmute/lds-ecdsa-secp256k1-recovery2020": "
|
|
20
|
-
"@veramo/core": "^3.1.5-next.
|
|
21
|
-
"@veramo/did-resolver": "^3.1.5-next.
|
|
22
|
-
"@veramo/utils": "^3.1.5-next.
|
|
20
|
+
"@transmute/lds-ecdsa-secp256k1-recovery2020": "decentralized-identity/EcdsaSecp256k1RecoverySignature2020",
|
|
21
|
+
"@veramo/core": "^3.1.5-next.119+3a0765ef",
|
|
22
|
+
"@veramo/did-resolver": "^3.1.5-next.119+3a0765ef",
|
|
23
|
+
"@veramo/utils": "^3.1.5-next.119+3a0765ef",
|
|
23
24
|
"debug": "^4.3.3",
|
|
24
25
|
"did-resolver": "^3.1.5",
|
|
25
26
|
"jsonld": "^5.2.0",
|
|
26
27
|
"jsonld-signatures": "^9.3.1",
|
|
27
|
-
"uint8arrays": "^3.0.0"
|
|
28
|
-
"vc-js": "^0.6.4"
|
|
28
|
+
"uint8arrays": "^3.0.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/debug": "4.1.7",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"author": "Mircea Nistor <mircea.nistor@mesh.xyz>",
|
|
48
48
|
"license": "Apache-2.0",
|
|
49
49
|
"keywords": [],
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "3a0765ef632aae29701004cbfbeb38a2de7bc847"
|
|
51
51
|
}
|
|
@@ -13,11 +13,16 @@ import { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../../../key-
|
|
|
13
13
|
import { KeyManagementSystem } from '../../../kms-local/src'
|
|
14
14
|
import { getDidKeyResolver, KeyDIDProvider } from '../../../did-provider-key/src'
|
|
15
15
|
import { DIDResolverPlugin } from '../../../did-resolver/src'
|
|
16
|
+
import { EthrDIDProvider } from "../../../did-provider-ethr/src";
|
|
16
17
|
import { ContextDoc } from '../types'
|
|
17
18
|
import { CredentialIssuerLD } from '../action-handler'
|
|
18
19
|
import { LdDefaultContexts } from '../ld-default-contexts'
|
|
19
20
|
import { VeramoEd25519Signature2018 } from '../suites/Ed25519Signature2018'
|
|
20
21
|
import { Resolver } from 'did-resolver'
|
|
22
|
+
import { getResolver as ethrDidResolver } from 'ethr-did-resolver'
|
|
23
|
+
import { VeramoEcdsaSecp256k1RecoverySignature2020 } from "../suites/EcdsaSecp256k1RecoverySignature2020";
|
|
24
|
+
|
|
25
|
+
jest.setTimeout(300000)
|
|
21
26
|
|
|
22
27
|
const customContext: Record<string, ContextDoc> = {
|
|
23
28
|
'custom:example.context': {
|
|
@@ -27,8 +32,11 @@ const customContext: Record<string, ContextDoc> = {
|
|
|
27
32
|
},
|
|
28
33
|
}
|
|
29
34
|
|
|
35
|
+
const infuraProjectId = '3586660d179141e3801c3895de1c2eba'
|
|
36
|
+
|
|
30
37
|
describe('credential-LD full flow', () => {
|
|
31
38
|
let didKeyIdentifier: IIdentifier
|
|
39
|
+
let didEthrIdentifier: IIdentifier
|
|
32
40
|
let agent: TAgent<IResolver & IKeyManager & IDIDManager & ICredentialIssuer>
|
|
33
41
|
|
|
34
42
|
beforeAll(async () => {
|
|
@@ -43,24 +51,32 @@ describe('credential-LD full flow', () => {
|
|
|
43
51
|
new DIDManager({
|
|
44
52
|
providers: {
|
|
45
53
|
'did:key': new KeyDIDProvider({ defaultKms: 'local' }),
|
|
54
|
+
'did:ethr:goerli': new EthrDIDProvider({
|
|
55
|
+
defaultKms: 'local',
|
|
56
|
+
network: 'goerli',
|
|
57
|
+
}),
|
|
46
58
|
},
|
|
47
59
|
store: new MemoryDIDStore(),
|
|
48
60
|
defaultProvider: 'did:key',
|
|
49
61
|
}),
|
|
50
62
|
new DIDResolverPlugin({
|
|
51
|
-
resolver: new Resolver({
|
|
63
|
+
resolver: new Resolver({
|
|
64
|
+
...getDidKeyResolver(),
|
|
65
|
+
...ethrDidResolver({ infuraProjectId, }),
|
|
66
|
+
}),
|
|
52
67
|
}),
|
|
53
68
|
new CredentialIssuer(),
|
|
54
69
|
new CredentialIssuerLD({
|
|
55
70
|
contextMaps: [LdDefaultContexts, customContext],
|
|
56
|
-
suites: [new VeramoEd25519Signature2018()],
|
|
71
|
+
suites: [new VeramoEd25519Signature2018(), new VeramoEcdsaSecp256k1RecoverySignature2020()],
|
|
57
72
|
}),
|
|
58
73
|
],
|
|
59
74
|
})
|
|
60
75
|
didKeyIdentifier = await agent.didManagerCreate()
|
|
76
|
+
didEthrIdentifier = await agent.didManagerCreate({ provider: "did:ethr:goerli" })
|
|
61
77
|
})
|
|
62
78
|
|
|
63
|
-
it('works with Ed25519Signature2018', async () => {
|
|
79
|
+
it('works with Ed25519Signature2018 credential', async () => {
|
|
64
80
|
const credential: CredentialPayload = {
|
|
65
81
|
issuer: didKeyIdentifier.did,
|
|
66
82
|
'@context': ['custom:example.context'],
|
|
@@ -81,4 +97,91 @@ describe('credential-LD full flow', () => {
|
|
|
81
97
|
|
|
82
98
|
expect(verified).toBe(true)
|
|
83
99
|
})
|
|
100
|
+
|
|
101
|
+
it.only('works with EcdsaSecp256k1RecoveryMethod2020 credentials', async () => {
|
|
102
|
+
const credential: CredentialPayload = {
|
|
103
|
+
issuer: didEthrIdentifier.did,
|
|
104
|
+
'@context': ['custom:example.context'],
|
|
105
|
+
credentialSubject: {
|
|
106
|
+
nothing: 'else matters',
|
|
107
|
+
},
|
|
108
|
+
}
|
|
109
|
+
const verifiableCredential = await agent.createVerifiableCredential({
|
|
110
|
+
credential,
|
|
111
|
+
proofFormat: 'lds',
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
expect(verifiableCredential).toBeDefined()
|
|
115
|
+
|
|
116
|
+
const verified = await agent.verifyCredential({
|
|
117
|
+
credential: verifiableCredential,
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
expect(verified).toBe(true)
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
it('works with Ed25519Signature2018 credential and presentation', async () => {
|
|
124
|
+
const credential: CredentialPayload = {
|
|
125
|
+
issuer: didKeyIdentifier.did,
|
|
126
|
+
'@context': ['custom:example.context'],
|
|
127
|
+
credentialSubject: {
|
|
128
|
+
nothing: 'else matters',
|
|
129
|
+
},
|
|
130
|
+
}
|
|
131
|
+
const verifiableCredential1 = await agent.createVerifiableCredential({
|
|
132
|
+
credential,
|
|
133
|
+
proofFormat: 'lds',
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
const verifiablePresentation = await agent.createVerifiablePresentation({
|
|
137
|
+
presentation: {
|
|
138
|
+
verifiableCredential: [verifiableCredential1],
|
|
139
|
+
holder: didKeyIdentifier.did
|
|
140
|
+
},
|
|
141
|
+
proofFormat: 'lds',
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
expect(verifiablePresentation).toBeDefined()
|
|
145
|
+
|
|
146
|
+
const verified = await agent.verifyPresentation({
|
|
147
|
+
presentation: verifiablePresentation,
|
|
148
|
+
challenge: "VERAMO",
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
expect(verified).toBe(true)
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
it('works with EcdsaSecp256k1RecoveryMethod2020 credential and presentation', async () => {
|
|
155
|
+
const credential: CredentialPayload = {
|
|
156
|
+
issuer: { id: didEthrIdentifier.did },
|
|
157
|
+
'@context': ['https://www.w3.org/2018/credentials/v1', 'https://veramo.io/contexts/profile/v1'],
|
|
158
|
+
type: ['VerifiableCredential', 'Profile'],
|
|
159
|
+
issuanceDate: new Date().toISOString(),
|
|
160
|
+
credentialSubject: {
|
|
161
|
+
id: didKeyIdentifier.did,
|
|
162
|
+
name: 'Martin, the great',
|
|
163
|
+
},
|
|
164
|
+
}
|
|
165
|
+
const verifiableCredential1 = await agent.createVerifiableCredential({
|
|
166
|
+
credential,
|
|
167
|
+
proofFormat: 'lds',
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
const verifiablePresentation = await agent.createVerifiablePresentation({
|
|
171
|
+
presentation: {
|
|
172
|
+
verifiableCredential: [verifiableCredential1],
|
|
173
|
+
holder: didEthrIdentifier.did
|
|
174
|
+
},
|
|
175
|
+
proofFormat: 'lds',
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
expect(verifiablePresentation).toBeDefined()
|
|
179
|
+
|
|
180
|
+
const verified = await agent.verifyPresentation({
|
|
181
|
+
presentation: verifiablePresentation,
|
|
182
|
+
challenge: "VERAMO",
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
expect(verified).toBe(true)
|
|
186
|
+
})
|
|
84
187
|
})
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": {
|
|
3
|
+
"@version": 1.1,
|
|
4
|
+
"id": "@id",
|
|
5
|
+
"type": "@type",
|
|
6
|
+
"esrs2020": "https://identity.foundation/EcdsaSecp256k1RecoverySignature2020#",
|
|
7
|
+
"EcdsaSecp256k1RecoverySignature2020": "esrs2020:EcdsaSecp256k1RecoverySignature2020",
|
|
8
|
+
"EcdsaSecp256k1RecoveryMethod2020": "esrs2020:EcdsaSecp256k1RecoveryMethod2020",
|
|
9
|
+
"publicKeyJwk": {
|
|
10
|
+
"@id": "esrs2020:publicKeyJwk",
|
|
11
|
+
"@type": "@json"
|
|
12
|
+
},
|
|
13
|
+
"privateKeyJwk": {
|
|
14
|
+
"@id": "esrs2020:privateKeyJwk",
|
|
15
|
+
"@type": "@json"
|
|
16
|
+
},
|
|
17
|
+
"publicKeyHex": "esrs2020:publicKeyHex",
|
|
18
|
+
"privateKeyHex": "esrs2020:privateKeyHex",
|
|
19
|
+
"ethereumAddress": "esrs2020:ethereumAddress"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [{
|
|
3
|
+
"@version": 1.1
|
|
4
|
+
}, "https://w3id.org/security/v1", {
|
|
5
|
+
"AesKeyWrappingKey2019": "sec:AesKeyWrappingKey2019",
|
|
6
|
+
"DeleteKeyOperation": "sec:DeleteKeyOperation",
|
|
7
|
+
"DeriveSecretOperation": "sec:DeriveSecretOperation",
|
|
8
|
+
"EcdsaSecp256k1Signature2019": "sec:EcdsaSecp256k1Signature2019",
|
|
9
|
+
"EcdsaSecp256r1Signature2019": "sec:EcdsaSecp256r1Signature2019",
|
|
10
|
+
"EcdsaSecp256k1VerificationKey2019": "sec:EcdsaSecp256k1VerificationKey2019",
|
|
11
|
+
"EcdsaSecp256r1VerificationKey2019": "sec:EcdsaSecp256r1VerificationKey2019",
|
|
12
|
+
"Ed25519Signature2018": "sec:Ed25519Signature2018",
|
|
13
|
+
"Ed25519VerificationKey2018": "sec:Ed25519VerificationKey2018",
|
|
14
|
+
"EquihashProof2018": "sec:EquihashProof2018",
|
|
15
|
+
"ExportKeyOperation": "sec:ExportKeyOperation",
|
|
16
|
+
"GenerateKeyOperation": "sec:GenerateKeyOperation",
|
|
17
|
+
"KmsOperation": "sec:KmsOperation",
|
|
18
|
+
"RevokeKeyOperation": "sec:RevokeKeyOperation",
|
|
19
|
+
"RsaSignature2018": "sec:RsaSignature2018",
|
|
20
|
+
"RsaVerificationKey2018": "sec:RsaVerificationKey2018",
|
|
21
|
+
"Sha256HmacKey2019": "sec:Sha256HmacKey2019",
|
|
22
|
+
"SignOperation": "sec:SignOperation",
|
|
23
|
+
"UnwrapKeyOperation": "sec:UnwrapKeyOperation",
|
|
24
|
+
"VerifyOperation": "sec:VerifyOperation",
|
|
25
|
+
"WrapKeyOperation": "sec:WrapKeyOperation",
|
|
26
|
+
"X25519KeyAgreementKey2019": "sec:X25519KeyAgreementKey2019",
|
|
27
|
+
|
|
28
|
+
"allowedAction": "sec:allowedAction",
|
|
29
|
+
"assertionMethod": {"@id": "sec:assertionMethod", "@type": "@id", "@container": "@set"},
|
|
30
|
+
"authentication": {"@id": "sec:authenticationMethod", "@type": "@id", "@container": "@set"},
|
|
31
|
+
"capability": {"@id": "sec:capability", "@type": "@id"},
|
|
32
|
+
"capabilityAction": "sec:capabilityAction",
|
|
33
|
+
"capabilityChain": {"@id": "sec:capabilityChain", "@type": "@id", "@container": "@list"},
|
|
34
|
+
"capabilityDelegation": {"@id": "sec:capabilityDelegationMethod", "@type": "@id", "@container": "@set"},
|
|
35
|
+
"capabilityInvocation": {"@id": "sec:capabilityInvocationMethod", "@type": "@id", "@container": "@set"},
|
|
36
|
+
"caveat": {"@id": "sec:caveat", "@type": "@id", "@container": "@set"},
|
|
37
|
+
"challenge": "sec:challenge",
|
|
38
|
+
"ciphertext": "sec:ciphertext",
|
|
39
|
+
"controller": {"@id": "sec:controller", "@type": "@id"},
|
|
40
|
+
"delegator": {"@id": "sec:delegator", "@type": "@id"},
|
|
41
|
+
"equihashParameterK": {"@id": "sec:equihashParameterK", "@type": "xsd:integer"},
|
|
42
|
+
"equihashParameterN": {"@id": "sec:equihashParameterN", "@type": "xsd:integer"},
|
|
43
|
+
"invocationTarget": {"@id": "sec:invocationTarget", "@type": "@id"},
|
|
44
|
+
"invoker": {"@id": "sec:invoker", "@type": "@id"},
|
|
45
|
+
"jws": "sec:jws",
|
|
46
|
+
"keyAgreement": {"@id": "sec:keyAgreementMethod", "@type": "@id", "@container": "@set"},
|
|
47
|
+
"kmsModule": {"@id": "sec:kmsModule"},
|
|
48
|
+
"parentCapability": {"@id": "sec:parentCapability", "@type": "@id"},
|
|
49
|
+
"plaintext": "sec:plaintext",
|
|
50
|
+
"proof": {"@id": "sec:proof", "@type": "@id", "@container": "@graph"},
|
|
51
|
+
"proofPurpose": {"@id": "sec:proofPurpose", "@type": "@vocab"},
|
|
52
|
+
"proofValue": "sec:proofValue",
|
|
53
|
+
"referenceId": "sec:referenceId",
|
|
54
|
+
"unwrappedKey": "sec:unwrappedKey",
|
|
55
|
+
"verificationMethod": {"@id": "sec:verificationMethod", "@type": "@id"},
|
|
56
|
+
"verifyData": "sec:verifyData",
|
|
57
|
+
"wrappedKey": "sec:wrappedKey"
|
|
58
|
+
}]
|
|
59
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
"EcdsaSecp256k1RecoveryMethod2020": {
|
|
12
|
+
"@id": "https://identity.foundation/EcdsaSecp256k1RecoverySignature2020#EcdsaSecp256k1RecoveryMethod2020",
|
|
13
|
+
"@context": {
|
|
14
|
+
"@protected": true,
|
|
15
|
+
"id": "@id",
|
|
16
|
+
"type": "@type",
|
|
17
|
+
"controller": {
|
|
18
|
+
"@id": "https://w3id.org/security#controller",
|
|
19
|
+
"@type": "@id"
|
|
20
|
+
},
|
|
21
|
+
"blockchainAccountId": "https://w3id.org/security#blockchainAccountId",
|
|
22
|
+
"publicKeyJwk": {
|
|
23
|
+
"@id": "https://w3id.org/security#publicKeyJwk",
|
|
24
|
+
"@type": "@json"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"EcdsaSecp256k1RecoverySignature2020": {
|
|
29
|
+
"@id": "https://identity.foundation/EcdsaSecp256k1RecoverySignature2020#EcdsaSecp256k1RecoverySignature2020",
|
|
30
|
+
"@context": {
|
|
31
|
+
"@protected": true,
|
|
32
|
+
"id": "@id",
|
|
33
|
+
"type": "@type",
|
|
34
|
+
"challenge": "https://w3id.org/security#challenge",
|
|
35
|
+
"created": {
|
|
36
|
+
"@id": "http://purl.org/dc/terms/created",
|
|
37
|
+
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
|
|
38
|
+
},
|
|
39
|
+
"domain": "https://w3id.org/security#domain",
|
|
40
|
+
"expires": {
|
|
41
|
+
"@id": "https://w3id.org/security#expiration",
|
|
42
|
+
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
|
|
43
|
+
},
|
|
44
|
+
"jws": "https://w3id.org/security#jws",
|
|
45
|
+
"nonce": "https://w3id.org/security#nonce",
|
|
46
|
+
"proofPurpose": {
|
|
47
|
+
"@id": "https://w3id.org/security#proofPurpose",
|
|
48
|
+
"@type": "@vocab",
|
|
49
|
+
"@context": {
|
|
50
|
+
"@protected": true,
|
|
51
|
+
"id": "@id",
|
|
52
|
+
"type": "@type",
|
|
53
|
+
"assertionMethod": {
|
|
54
|
+
"@id": "https://w3id.org/security#assertionMethod",
|
|
55
|
+
"@type": "@id",
|
|
56
|
+
"@container": "@set"
|
|
57
|
+
},
|
|
58
|
+
"authentication": {
|
|
59
|
+
"@id": "https://w3id.org/security#authenticationMethod",
|
|
60
|
+
"@type": "@id",
|
|
61
|
+
"@container": "@set"
|
|
62
|
+
},
|
|
63
|
+
"capabilityInvocation": {
|
|
64
|
+
"@id": "https://w3id.org/security#capabilityInvocationMethod",
|
|
65
|
+
"@type": "@id",
|
|
66
|
+
"@container": "@set"
|
|
67
|
+
},
|
|
68
|
+
"capabilityDelegation": {
|
|
69
|
+
"@id": "https://w3id.org/security#capabilityDelegationMethod",
|
|
70
|
+
"@type": "@id",
|
|
71
|
+
"@container": "@set"
|
|
72
|
+
},
|
|
73
|
+
"keyAgreement": {
|
|
74
|
+
"@id": "https://w3id.org/security#keyAgreementMethod",
|
|
75
|
+
"@type": "@id",
|
|
76
|
+
"@container": "@set"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"verificationMethod": {
|
|
81
|
+
"@id": "https://w3id.org/security#verificationMethod",
|
|
82
|
+
"@type": "@id"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": {
|
|
3
|
+
"id": "@id",
|
|
4
|
+
"type": "@type",
|
|
5
|
+
|
|
6
|
+
"dc": "http://purl.org/dc/terms/",
|
|
7
|
+
"sec": "https://w3id.org/security#",
|
|
8
|
+
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
|
9
|
+
|
|
10
|
+
"EcdsaKoblitzSignature2016": "sec:EcdsaKoblitzSignature2016",
|
|
11
|
+
"Ed25519Signature2018": "sec:Ed25519Signature2018",
|
|
12
|
+
"EncryptedMessage": "sec:EncryptedMessage",
|
|
13
|
+
"GraphSignature2012": "sec:GraphSignature2012",
|
|
14
|
+
"LinkedDataSignature2015": "sec:LinkedDataSignature2015",
|
|
15
|
+
"LinkedDataSignature2016": "sec:LinkedDataSignature2016",
|
|
16
|
+
"CryptographicKey": "sec:Key",
|
|
17
|
+
|
|
18
|
+
"authenticationTag": "sec:authenticationTag",
|
|
19
|
+
"canonicalizationAlgorithm": "sec:canonicalizationAlgorithm",
|
|
20
|
+
"cipherAlgorithm": "sec:cipherAlgorithm",
|
|
21
|
+
"cipherData": "sec:cipherData",
|
|
22
|
+
"cipherKey": "sec:cipherKey",
|
|
23
|
+
"created": {"@id": "dc:created", "@type": "xsd:dateTime"},
|
|
24
|
+
"creator": {"@id": "dc:creator", "@type": "@id"},
|
|
25
|
+
"digestAlgorithm": "sec:digestAlgorithm",
|
|
26
|
+
"digestValue": "sec:digestValue",
|
|
27
|
+
"domain": "sec:domain",
|
|
28
|
+
"encryptionKey": "sec:encryptionKey",
|
|
29
|
+
"expiration": {"@id": "sec:expiration", "@type": "xsd:dateTime"},
|
|
30
|
+
"expires": {"@id": "sec:expiration", "@type": "xsd:dateTime"},
|
|
31
|
+
"initializationVector": "sec:initializationVector",
|
|
32
|
+
"iterationCount": "sec:iterationCount",
|
|
33
|
+
"nonce": "sec:nonce",
|
|
34
|
+
"normalizationAlgorithm": "sec:normalizationAlgorithm",
|
|
35
|
+
"owner": {"@id": "sec:owner", "@type": "@id"},
|
|
36
|
+
"password": "sec:password",
|
|
37
|
+
"privateKey": {"@id": "sec:privateKey", "@type": "@id"},
|
|
38
|
+
"privateKeyPem": "sec:privateKeyPem",
|
|
39
|
+
"publicKey": {"@id": "sec:publicKey", "@type": "@id"},
|
|
40
|
+
"publicKeyBase58": "sec:publicKeyBase58",
|
|
41
|
+
"publicKeyPem": "sec:publicKeyPem",
|
|
42
|
+
"publicKeyWif": "sec:publicKeyWif",
|
|
43
|
+
"publicKeyService": {"@id": "sec:publicKeyService", "@type": "@id"},
|
|
44
|
+
"revoked": {"@id": "sec:revoked", "@type": "xsd:dateTime"},
|
|
45
|
+
"salt": "sec:salt",
|
|
46
|
+
"signature": "sec:signature",
|
|
47
|
+
"signatureAlgorithm": "sec:signingAlgorithm",
|
|
48
|
+
"signatureValue": "sec:signatureValue"
|
|
49
|
+
}
|
|
50
|
+
}
|