@veramo/credential-ld 4.3.1-next.7 → 4.3.1-unstable.0
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/action-handler.d.ts +3 -389
- package/build/action-handler.d.ts.map +1 -1
- package/build/action-handler.js +136 -118
- package/build/action-handler.js.map +1 -1
- package/build/index.d.ts +16 -8
- package/build/index.d.ts.map +1 -1
- package/build/index.js +36 -8
- package/build/index.js.map +1 -1
- package/build/ld-context-loader.d.ts +1 -1
- package/build/ld-context-loader.d.ts.map +1 -1
- package/build/ld-context-loader.js +20 -6
- package/build/ld-context-loader.js.map +1 -1
- package/build/ld-credential-module.d.ts +3 -3
- package/build/ld-credential-module.d.ts.map +1 -1
- package/build/ld-credential-module.js +85 -72
- package/build/ld-credential-module.js.map +1 -1
- package/build/ld-default-contexts.d.ts +1 -315
- package/build/ld-default-contexts.d.ts.map +1 -1
- package/build/ld-default-contexts.js +17 -28
- package/build/ld-default-contexts.js.map +1 -1
- package/build/ld-suite-loader.d.ts +1 -1
- package/build/ld-suite-loader.d.ts.map +1 -1
- package/build/ld-suite-loader.js +9 -4
- package/build/ld-suite-loader.js.map +1 -1
- package/build/ld-suites.js +7 -2
- package/build/ld-suites.js.map +1 -1
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.d.ts +1 -1
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.d.ts.map +1 -1
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.js +52 -16
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.js.map +1 -1
- package/build/suites/Ed25519Signature2018.d.ts +1 -1
- package/build/suites/Ed25519Signature2018.d.ts.map +1 -1
- package/build/suites/Ed25519Signature2018.js +48 -12
- package/build/suites/Ed25519Signature2018.js.map +1 -1
- package/build/suites/Ed25519Signature2020.d.ts +1 -1
- package/build/suites/Ed25519Signature2020.d.ts.map +1 -1
- package/build/suites/Ed25519Signature2020.js +52 -13
- package/build/suites/Ed25519Signature2020.js.map +1 -1
- package/build/suites/JsonWebSignature2020.d.ts +1 -1
- package/build/suites/JsonWebSignature2020.d.ts.map +1 -1
- package/build/suites/JsonWebSignature2020.js +82 -44
- package/build/suites/JsonWebSignature2020.js.map +1 -1
- package/build/tsdoc-metadata.json +1 -1
- package/build/types.js +2 -1
- package/package.json +8 -17
- package/src/__tests__/context.loader.test.ts +3 -3
- package/src/__tests__/issue-verify-flow.test.ts +5 -6
- package/src/action-handler.ts +7 -8
- package/src/index.ts +17 -8
- package/src/ld-context-loader.ts +1 -1
- package/src/ld-credential-module.ts +4 -5
- package/src/ld-default-contexts.ts +14 -27
- package/src/ld-suite-loader.ts +1 -1
- package/src/suites/EcdsaSecp256k1RecoverySignature2020.ts +4 -4
- package/src/suites/Ed25519Signature2018.ts +1 -1
- package/src/suites/Ed25519Signature2020.ts +1 -1
- package/src/suites/JsonWebSignature2020.ts +1 -1
- package/build/plugin.schema.json +0 -430
- /package/{src/plugin.schema.json → plugin.schema.json} +0 -0
|
@@ -1,61 +1,98 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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");
|
|
5
40
|
/**
|
|
6
41
|
* Veramo wrapper for the JsonWebSignature2020 suite by Transmute Industries
|
|
7
42
|
*
|
|
8
43
|
* @alpha This API is experimental and is very likely to change or disappear in future releases without notice.
|
|
9
44
|
*/
|
|
10
|
-
|
|
45
|
+
class VeramoJsonWebSignature2020 extends ld_suites_1.VeramoLdSignature {
|
|
11
46
|
getSupportedVerificationType() {
|
|
12
47
|
return 'JsonWebKey2020';
|
|
13
48
|
}
|
|
14
49
|
getSupportedVeramoKeyType() {
|
|
15
50
|
return 'Ed25519';
|
|
16
51
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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;
|
|
54
92
|
});
|
|
55
|
-
return suite;
|
|
56
93
|
}
|
|
57
94
|
getSuiteForVerification() {
|
|
58
|
-
return new JsonWebSignature();
|
|
95
|
+
return new json_web_signature_1.JsonWebSignature();
|
|
59
96
|
}
|
|
60
97
|
preSigningCredModification(credential) {
|
|
61
98
|
credential['@context'] = [...credential['@context'] || [], 'https://w3id.org/security/suites/jws-2020/v1'];
|
|
@@ -64,4 +101,5 @@ export class VeramoJsonWebSignature2020 extends VeramoLdSignature {
|
|
|
64
101
|
// do nothing
|
|
65
102
|
}
|
|
66
103
|
}
|
|
104
|
+
exports.VeramoJsonWebSignature2020 = VeramoJsonWebSignature2020;
|
|
67
105
|
//# sourceMappingURL=JsonWebSignature2020.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonWebSignature2020.js","sourceRoot":"","sources":["../../src/suites/JsonWebSignature2020.ts"],"names":[],"mappings":"AACA,
|
|
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,aAAa,EAAE,QAAQ,CAAC,CAAA;oBAC3D,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC;wBACjD,MAAM,EAAE,GAAG,CAAC,GAAG;wBACf,SAAS,EAAE,OAAO;wBAClB,IAAI,EAAE,aAAa;wBACnB,QAAQ,EAAE,QAAQ;qBACrB,CAAC,CAAA;oBACF,OAAO,GAAG,YAAY,KAAK,SAAS,EAAE,CAAA;gBAC1C,CAAC,CAAA;aACJ,CAAA;YAED,MAAM,eAAe,GAAG,MAAM,+BAAU,CAAC,IAAI,CAAC;gBAC1C,EAAE,EAAE,EAAE;gBACN,IAAI,EAAE,IAAI,CAAC,4BAA4B,EAAE;gBACzC,UAAU,EAAE,UAAU;gBACtB,YAAY,EAAE;oBACV,GAAG,EAAE,KAAK;oBACV,GAAG,EAAE,SAAS;oBACd,CAAC,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,EAAE,KAAK,CAAC,EAAE,WAAW,CAAC;iBACxE;aACJ,CAAC,CAAA;YAEF,eAAe,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC,MAAM,CAAA;YAErC,MAAM,KAAK,GAAG,IAAI,qCAAgB,CAAC;gBAC/B,GAAG,EAAE,eAAe;aACvB,CAAC,CAAA;YAEF,OAAO,KAAK,CAAA;QAChB,CAAC;KAAA;IAED,uBAAuB;QACnB,OAAO,IAAI,qCAAgB,EAAE,CAAA;IACjC,CAAC;IAED,0BAA0B,CAAC,UAA6B;QACpD,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,8CAA8C,CAAC,CAAA;IAC9G,CAAC;IAED,4BAA4B,CAAC,MAAc,EAAE,MAAmB;QAC5D,aAAa;IACjB,CAAC;CACJ;AAxED,gEAwEC"}
|
package/build/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veramo/credential-ld",
|
|
3
3
|
"description": "Veramo plugin for working with W3C JSON-LD Verifiable Credentials & Presentations.",
|
|
4
|
-
"version": "4.3.1-
|
|
4
|
+
"version": "4.3.1-unstable.0+7e89dddf",
|
|
5
5
|
"main": "build/index.js",
|
|
6
|
-
"exports": {
|
|
7
|
-
".": "./build/index.js",
|
|
8
|
-
"./build/plugin.schema.json": "./build/plugin.schema.json"
|
|
9
|
-
},
|
|
10
6
|
"types": "build/index.d.ts",
|
|
11
7
|
"scripts": {
|
|
12
8
|
"build": "tsc",
|
|
@@ -23,13 +19,13 @@
|
|
|
23
19
|
"@digitalcredentials/jsonld": "^5.2.1",
|
|
24
20
|
"@digitalcredentials/jsonld-signatures": "^9.3.1",
|
|
25
21
|
"@digitalcredentials/vc": "^5.0.0",
|
|
26
|
-
"@transmute/credentials-context": "^0.7.0-unstable.
|
|
27
|
-
"@transmute/ed25519-signature-2018": "^0.7.0-unstable.
|
|
28
|
-
"@transmute/json-web-signature": "^0.7.0-unstable.
|
|
22
|
+
"@transmute/credentials-context": "^0.7.0-unstable.77",
|
|
23
|
+
"@transmute/ed25519-signature-2018": "^0.7.0-unstable.77",
|
|
24
|
+
"@transmute/json-web-signature": "^0.7.0-unstable.77",
|
|
29
25
|
"@veramo-community/lds-ecdsa-secp256k1-recovery2020": "uport-project/EcdsaSecp256k1RecoverySignature2020",
|
|
30
|
-
"@veramo/core": "^4.3.1-
|
|
31
|
-
"@veramo/did-resolver": "^4.3.1-
|
|
32
|
-
"@veramo/utils": "^4.3.1-
|
|
26
|
+
"@veramo/core": "^4.3.1-unstable.0+7e89dddf",
|
|
27
|
+
"@veramo/did-resolver": "^4.3.1-unstable.0+7e89dddf",
|
|
28
|
+
"@veramo/utils": "^4.3.1-unstable.0+7e89dddf",
|
|
33
29
|
"cross-fetch": "^3.1.5",
|
|
34
30
|
"debug": "^4.3.3",
|
|
35
31
|
"did-resolver": "^4.0.1",
|
|
@@ -59,10 +55,5 @@
|
|
|
59
55
|
"author": "Mircea Nistor <mircea.nistor@mesh.xyz>",
|
|
60
56
|
"license": "Apache-2.0",
|
|
61
57
|
"keywords": [],
|
|
62
|
-
"
|
|
63
|
-
"moduleDirectories": [
|
|
64
|
-
"node_modules",
|
|
65
|
-
"src"
|
|
66
|
-
],
|
|
67
|
-
"gitHead": "b5cea3c0d80d900a47bd1d9eea68f84b70a35e7b"
|
|
58
|
+
"gitHead": "7e89dddf1043fe91b7b84ad2b2b276fdef33884d"
|
|
68
59
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ContextDoc } from '../types
|
|
2
|
-
import { LdContextLoader } from '../ld-context-loader
|
|
3
|
-
import { LdDefaultContexts } from '../ld-default-contexts
|
|
1
|
+
import { ContextDoc } from '../types'
|
|
2
|
+
import { LdContextLoader } from '../ld-context-loader'
|
|
3
|
+
import { LdDefaultContexts } from '../ld-default-contexts'
|
|
4
4
|
|
|
5
5
|
describe('credential-ld context loader', () => {
|
|
6
6
|
const customContext: Record<string, ContextDoc> = {
|
|
@@ -15,14 +15,13 @@ import { KeyManagementSystem } from '../../../kms-local/src'
|
|
|
15
15
|
import { getDidKeyResolver, KeyDIDProvider } from '../../../did-provider-key/src'
|
|
16
16
|
import { DIDResolverPlugin } from '../../../did-resolver/src'
|
|
17
17
|
import { EthrDIDProvider } from '../../../did-provider-ethr/src'
|
|
18
|
-
import { ContextDoc } from '../types
|
|
19
|
-
import { CredentialIssuerLD } from '../action-handler
|
|
20
|
-
import { LdDefaultContexts } from '../ld-default-contexts
|
|
21
|
-
import { VeramoEd25519Signature2018 } from '../suites/Ed25519Signature2018
|
|
18
|
+
import { ContextDoc } from '../types'
|
|
19
|
+
import { CredentialIssuerLD } from '../action-handler'
|
|
20
|
+
import { LdDefaultContexts } from '../ld-default-contexts'
|
|
21
|
+
import { VeramoEd25519Signature2018 } from '../suites/Ed25519Signature2018'
|
|
22
22
|
import { Resolver } from 'did-resolver'
|
|
23
23
|
import { getResolver as ethrDidResolver } from 'ethr-did-resolver'
|
|
24
|
-
import { VeramoEcdsaSecp256k1RecoverySignature2020 } from '../suites/EcdsaSecp256k1RecoverySignature2020
|
|
25
|
-
import { jest } from '@jest/globals'
|
|
24
|
+
import { VeramoEcdsaSecp256k1RecoverySignature2020 } from '../suites/EcdsaSecp256k1RecoverySignature2020'
|
|
26
25
|
|
|
27
26
|
import 'cross-fetch/polyfill'
|
|
28
27
|
jest.setTimeout(300000)
|
package/src/action-handler.ts
CHANGED
|
@@ -9,10 +9,9 @@ import {
|
|
|
9
9
|
VerifiableCredential,
|
|
10
10
|
VerifiablePresentation,
|
|
11
11
|
} from '@veramo/core'
|
|
12
|
-
import { VeramoLdSignature } from './
|
|
13
|
-
import schema from './plugin.schema.json' assert { type: 'json' }
|
|
12
|
+
import { schema, VeramoLdSignature } from './'
|
|
14
13
|
import Debug from 'debug'
|
|
15
|
-
import { LdContextLoader } from './ld-context-loader
|
|
14
|
+
import { LdContextLoader } from './ld-context-loader'
|
|
16
15
|
import {
|
|
17
16
|
_ExtendedIKey,
|
|
18
17
|
extractIssuer,
|
|
@@ -24,8 +23,8 @@ import {
|
|
|
24
23
|
RecordLike,
|
|
25
24
|
} from '@veramo/utils'
|
|
26
25
|
|
|
27
|
-
import { LdCredentialModule } from './ld-credential-module
|
|
28
|
-
import { LdSuiteLoader } from './ld-suite-loader
|
|
26
|
+
import { LdCredentialModule } from './ld-credential-module'
|
|
27
|
+
import { LdSuiteLoader } from './ld-suite-loader'
|
|
29
28
|
import {
|
|
30
29
|
ContextDoc,
|
|
31
30
|
ICreateVerifiableCredentialLDArgs,
|
|
@@ -34,7 +33,7 @@ import {
|
|
|
34
33
|
IRequiredContext,
|
|
35
34
|
IVerifyCredentialLDArgs,
|
|
36
35
|
IVerifyPresentationLDArgs,
|
|
37
|
-
} from './types
|
|
36
|
+
} from './types'
|
|
38
37
|
|
|
39
38
|
const debug = Debug('veramo:w3c:action-handler')
|
|
40
39
|
|
|
@@ -45,7 +44,7 @@ const debug = Debug('veramo:w3c:action-handler')
|
|
|
45
44
|
*/
|
|
46
45
|
export class CredentialIssuerLD implements IAgentPlugin {
|
|
47
46
|
readonly methods: ICredentialIssuerLD
|
|
48
|
-
readonly schema = schema.
|
|
47
|
+
readonly schema = schema.ICredentialIssuer
|
|
49
48
|
|
|
50
49
|
private ldCredentialModule: LdCredentialModule
|
|
51
50
|
|
|
@@ -229,7 +228,7 @@ export class CredentialIssuerLD implements IAgentPlugin {
|
|
|
229
228
|
context: IAgentContext<IResolver>,
|
|
230
229
|
identifier: IIdentifier,
|
|
231
230
|
keyRef?: string,
|
|
232
|
-
): Promise<{ signingKey:
|
|
231
|
+
): Promise<{ signingKey: IKey; verificationMethodId: string }> {
|
|
233
232
|
const extendedKeys: _ExtendedIKey[] = await mapIdentifierKeysToDoc(identifier, 'assertionMethod', context)
|
|
234
233
|
let supportedTypes = this.ldCredentialModule.ldSuiteLoader.getAllSignatureSuiteTypes()
|
|
235
234
|
let signingKey: _ExtendedIKey | undefined
|
package/src/index.ts
CHANGED
|
@@ -10,11 +10,20 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @packageDocumentation
|
|
12
12
|
*/
|
|
13
|
-
export { CredentialIssuerLD } from './action-handler
|
|
14
|
-
export * from './types
|
|
15
|
-
export { LdDefaultContexts } from './ld-default-contexts
|
|
16
|
-
export { VeramoLdSignature } from './ld-suites
|
|
17
|
-
export * from './suites/EcdsaSecp256k1RecoverySignature2020
|
|
18
|
-
export * from './suites/Ed25519Signature2018
|
|
19
|
-
export * from './suites/Ed25519Signature2020
|
|
20
|
-
export * from './suites/JsonWebSignature2020
|
|
13
|
+
export { CredentialIssuerLD } from './action-handler'
|
|
14
|
+
export * from './types'
|
|
15
|
+
export { LdDefaultContexts } from './ld-default-contexts'
|
|
16
|
+
export { VeramoLdSignature } from './ld-suites'
|
|
17
|
+
export * from './suites/EcdsaSecp256k1RecoverySignature2020'
|
|
18
|
+
export * from './suites/Ed25519Signature2018'
|
|
19
|
+
export * from './suites/Ed25519Signature2020'
|
|
20
|
+
export * from './suites/JsonWebSignature2020'
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The parameter and return types schemas for the {@link @veramo/credential-ld#CredentialIssuerLD | CredentialIssuerLD}
|
|
24
|
+
* plugin methods.
|
|
25
|
+
*
|
|
26
|
+
* @beta This API may change without a BREAKING CHANGE notice.
|
|
27
|
+
*/
|
|
28
|
+
const schema = require('../plugin.schema.json')
|
|
29
|
+
export { schema }
|
package/src/ld-context-loader.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* the w3c credential module.
|
|
5
5
|
*/
|
|
6
6
|
import { isIterable, OrPromise, RecordLike } from '@veramo/utils'
|
|
7
|
-
import { ContextDoc } from './types
|
|
7
|
+
import { ContextDoc } from './types'
|
|
8
8
|
|
|
9
9
|
export class LdContextLoader {
|
|
10
10
|
private readonly contexts: Record<string, OrPromise<ContextDoc>>
|
|
@@ -9,12 +9,11 @@ import {
|
|
|
9
9
|
} from '@veramo/core'
|
|
10
10
|
import fetch from 'cross-fetch'
|
|
11
11
|
import Debug from 'debug'
|
|
12
|
-
import
|
|
13
|
-
const { extendContextLoader } = jsonldSignatures
|
|
12
|
+
import { extendContextLoader } from '@digitalcredentials/jsonld-signatures'
|
|
14
13
|
import * as vc from '@digitalcredentials/vc'
|
|
15
|
-
import { LdContextLoader } from './ld-context-loader
|
|
16
|
-
import { LdSuiteLoader } from './ld-suite-loader
|
|
17
|
-
import { RequiredAgentMethods } from './ld-suites
|
|
14
|
+
import { LdContextLoader } from './ld-context-loader'
|
|
15
|
+
import { LdSuiteLoader } from './ld-suite-loader'
|
|
16
|
+
import { RequiredAgentMethods } from './ld-suites'
|
|
18
17
|
|
|
19
18
|
const debug = Debug('veramo:w3c:ld-credential-module')
|
|
20
19
|
|
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import contextDidV1 from "./contexts/www.w3.org_ns_did_v1.json" assert { type: 'json' }
|
|
3
|
-
import contextSecurityV1 from "./contexts/w3id.org_security_v1.json" assert { type: 'json' }
|
|
4
|
-
import contextSecurityV2 from "./contexts/w3id.org_security_v2.json" assert { type: 'json' }
|
|
5
|
-
import contextSecurityV3 from "./contexts/w3id.org_security_v3-unstable.json" assert { type: 'json' }
|
|
6
|
-
import contextSuitesEd25519 from "./contexts/w3id.org_security_suites_ed25519-2018_v1.json" assert { type: 'json' }
|
|
7
|
-
import contextSuitesX25519 from "./contexts/w3id.org_security_suites_x25519-2019_v1.json" assert { type: 'json' }
|
|
8
|
-
import contextProfile from "./contexts/veramo.io_contexts_profile_v1.json" assert { type: 'json' }
|
|
9
|
-
import contextLdsEcdsaSecpRecovery2020_0 from "./contexts/lds-ecdsa-secp256k1-recovery2020-0.0.json" assert { type: 'json' }
|
|
10
|
-
import contextLdsEcdsaSecpRecovery2020_2 from "./contexts/w3id.org_security_suites_secp256k1recovery-2020_v2.json" assert { type: 'json' }
|
|
11
|
-
import contextSuitesSecp from "./contexts/w3id.org_security_suites_secp256k1recovery-2020_v2.json" assert { type: 'json' }
|
|
12
|
-
import contextSuitesEd25519_2020 from './contexts/ed25519-signature-2020-v1.json' assert { type: 'json' }
|
|
13
|
-
import contextSuitesJws_2020 from './contexts/json-web-signature-2020-v1.json' assert { type: 'json' }
|
|
1
|
+
import { ContextDoc } from './types'
|
|
14
2
|
|
|
15
3
|
/**
|
|
16
4
|
* Provides a hardcoded map of common Linked Data `@context` definitions.
|
|
@@ -20,25 +8,24 @@ import contextSuitesJws_2020 from './contexts/json-web-signature-2020-v1.json' a
|
|
|
20
8
|
*
|
|
21
9
|
* @beta This API may change without a BREAKING CHANGE notice.
|
|
22
10
|
*/
|
|
23
|
-
// @ts-ignore
|
|
24
11
|
export const LdDefaultContexts = new Map([
|
|
25
|
-
['https://www.w3.org/2018/credentials/v1',
|
|
26
|
-
['https://www.w3.org/ns/did/v1',
|
|
27
|
-
['https://w3id.org/security/v1',
|
|
28
|
-
['https://w3id.org/security/v2',
|
|
29
|
-
['https://w3id.org/security/v3-unstable',
|
|
30
|
-
['https://w3id.org/security/suites/ed25519-2018/v1',
|
|
31
|
-
['https://w3id.org/security/suites/x25519-2019/v1',
|
|
32
|
-
['https://w3id.org/security/suites/ed25519-2020/v1',
|
|
33
|
-
['https://w3id.org/security/suites/jws-2020/v1',
|
|
12
|
+
['https://www.w3.org/2018/credentials/v1', require('./contexts/www.w3.org_2018_credentials_v1.json')],
|
|
13
|
+
['https://www.w3.org/ns/did/v1', require('./contexts/www.w3.org_ns_did_v1.json')],
|
|
14
|
+
['https://w3id.org/security/v1', require('./contexts/w3id.org_security_v1.json')],
|
|
15
|
+
['https://w3id.org/security/v2', require('./contexts/w3id.org_security_v2.json')],
|
|
16
|
+
['https://w3id.org/security/v3-unstable', require('./contexts/w3id.org_security_v3-unstable.json')],
|
|
17
|
+
['https://w3id.org/security/suites/ed25519-2018/v1', require('./contexts/w3id.org_security_suites_ed25519-2018_v1.json')],
|
|
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')],
|
|
34
21
|
// ['https://w3id.org/did/v0.11', require('./contexts/did_v0.11.json')],
|
|
35
22
|
// ['https://veramo.io/contexts/socialmedia/v1', require('./contexts/socialmedia-v1.json')],
|
|
36
23
|
// ['https://veramo.io/contexts/kyc/v1', require('./contexts/kyc-v1.json')],
|
|
37
|
-
['https://veramo.io/contexts/profile/v1',
|
|
24
|
+
['https://veramo.io/contexts/profile/v1', require('./contexts/veramo.io_contexts_profile_v1.json')],
|
|
38
25
|
// ['https://ns.did.ai/transmute/v1', require('./contexts/transmute_v1.json')],
|
|
39
|
-
['https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld',
|
|
40
|
-
['https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-2.0.jsonld',
|
|
41
|
-
['https://w3id.org/security/suites/secp256k1recovery-2020/v2',
|
|
26
|
+
['https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld', require('./contexts/lds-ecdsa-secp256k1-recovery2020-0.0.json')],
|
|
27
|
+
['https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-2.0.jsonld', require('./contexts/w3id.org_security_suites_secp256k1recovery-2020_v2.json')],
|
|
28
|
+
['https://w3id.org/security/suites/secp256k1recovery-2020/v2', require('./contexts/w3id.org_security_suites_secp256k1recovery-2020_v2.json')],
|
|
42
29
|
// ['https://w3id.org/security/suites/ed25519-2018/v1', require('./contexts/ed25519-signature-2018-v1.json')],
|
|
43
30
|
// ['https://w3id.org/security/suites/x25519-2019/v1', require('./contexts/X25519KeyAgreementKey2019.json')],
|
|
44
31
|
])
|
package/src/ld-suite-loader.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites
|
|
1
|
+
import { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites'
|
|
2
2
|
import { CredentialPayload, DIDDocument, IAgentContext, IKey, TKeyType } from '@veramo/core'
|
|
3
|
-
import
|
|
4
|
-
const {
|
|
3
|
+
import {
|
|
5
4
|
EcdsaSecp256k1RecoveryMethod2020,
|
|
6
5
|
EcdsaSecp256k1RecoverySignature2020,
|
|
7
|
-
}
|
|
6
|
+
} from '@veramo-community/lds-ecdsa-secp256k1-recovery2020'
|
|
7
|
+
|
|
8
8
|
import * as u8a from 'uint8arrays'
|
|
9
9
|
import { asArray, encodeJoseBlob } from '@veramo/utils'
|
|
10
10
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { encodeJoseBlob } from '@veramo/utils'
|
|
2
|
-
import { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites
|
|
2
|
+
import { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites'
|
|
3
3
|
import { CredentialPayload, DIDDocument, IAgentContext, IKey, TKeyType } from '@veramo/core'
|
|
4
4
|
import * as u8a from 'uint8arrays'
|
|
5
5
|
import { Ed25519Signature2018, Ed25519VerificationKey2018 } from '@transmute/ed25519-signature-2018'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites
|
|
1
|
+
import { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites'
|
|
2
2
|
import { CredentialPayload, DIDDocument, IAgentContext, IKey, TKeyType } from '@veramo/core'
|
|
3
3
|
import * as u8a from 'uint8arrays'
|
|
4
4
|
import { Ed25519Signature2020 } from '@digitalcredentials/ed25519-signature-2020'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CredentialPayload, DIDDocument, IAgentContext, IKey, TKeyType } from "@veramo/core";
|
|
2
|
-
import { RequiredAgentMethods, VeramoLdSignature } from "../ld-suites
|
|
2
|
+
import { RequiredAgentMethods, VeramoLdSignature } from "../ld-suites";
|
|
3
3
|
import * as u8a from "uint8arrays";
|
|
4
4
|
import { JsonWebKey, JsonWebSignature } from "@transmute/json-web-signature";
|
|
5
5
|
import { encodeJoseBlob } from "@veramo/utils";
|