@veramo/credential-ld 4.0.1-next.8 → 4.0.1-unstable.4
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 +389 -3
- package/build/action-handler.d.ts.map +1 -1
- package/build/action-handler.js +118 -136
- package/build/action-handler.js.map +1 -1
- package/build/index.d.ts +6 -14
- package/build/index.d.ts.map +1 -1
- package/build/index.js +6 -34
- 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 +6 -20
- 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 +72 -83
- package/build/ld-credential-module.js.map +1 -1
- package/build/ld-default-contexts.d.ts +323 -1
- package/build/ld-default-contexts.d.ts.map +1 -1
- package/build/ld-default-contexts.js +24 -15
- 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 +2 -6
- package/build/ld-suite-loader.js.map +1 -1
- package/build/ld-suites.js +2 -7
- package/build/ld-suites.js.map +1 -1
- package/build/plugin.schema.json +430 -0
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.d.ts +1 -1
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.d.ts.map +1 -1
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.js +16 -52
- 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 +12 -48
- package/build/suites/Ed25519Signature2018.js.map +1 -1
- package/build/tsdoc-metadata.json +1 -1
- package/build/types.js +1 -2
- package/package.json +14 -5
- package/src/__tests__/context.loader.test.ts +3 -3
- package/src/__tests__/issue-verify-flow.test.ts +8 -7
- package/src/action-handler.ts +7 -6
- package/src/index.ts +6 -15
- package/src/ld-context-loader.ts +1 -1
- package/src/ld-credential-module.ts +5 -4
- package/src/ld-default-contexts.ts +23 -12
- package/src/ld-suite-loader.ts +1 -1
- package/{plugin.schema.json → src/plugin.schema.json} +0 -0
- package/src/suites/EcdsaSecp256k1RecoverySignature2020.ts +4 -3
- package/src/suites/Ed25519Signature2018.ts +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites';
|
|
1
|
+
import { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites.js';
|
|
2
2
|
import { CredentialPayload, DIDDocument, IAgentContext, IKey, TKeyType } from '@veramo/core';
|
|
3
3
|
/**
|
|
4
4
|
* Veramo wrapper for the Ed25519Signature2018 suite by Transmute Industries
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ed25519Signature2018.d.ts","sourceRoot":"","sources":["../../src/suites/Ed25519Signature2018.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Ed25519Signature2018.d.ts","sourceRoot":"","sources":["../../src/suites/Ed25519Signature2018.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACzE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAI5F;;;;GAIG;AACH,qBAAa,0BAA2B,SAAQ,iBAAiB;IAC/D,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,GAAG;IA2CN,uBAAuB,IAAI,GAAG;IAI9B,0BAA0B,CAAC,UAAU,EAAE,iBAAiB,GAAG,IAAI;IAI/D,4BAA4B,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI;CAGxE"}
|
|
@@ -1,48 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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.VeramoEd25519Signature2018 = void 0;
|
|
36
|
-
const utils_1 = require("@veramo/utils");
|
|
37
|
-
const ld_suites_1 = require("../ld-suites");
|
|
38
|
-
const u8a = __importStar(require("uint8arrays"));
|
|
39
|
-
const ed25519_signature_2018_1 = require("@transmute/ed25519-signature-2018");
|
|
1
|
+
import { encodeJoseBlob } from '@veramo/utils';
|
|
2
|
+
import { VeramoLdSignature } from '../ld-suites.js';
|
|
3
|
+
import * as u8a from 'uint8arrays';
|
|
4
|
+
import { Ed25519Signature2018, Ed25519VerificationKey2018 } from '@transmute/ed25519-signature-2018';
|
|
40
5
|
/**
|
|
41
6
|
* Veramo wrapper for the Ed25519Signature2018 suite by Transmute Industries
|
|
42
7
|
*
|
|
43
8
|
* @alpha This API is experimental and is very likely to change or disappear in future releases without notice.
|
|
44
9
|
*/
|
|
45
|
-
class VeramoEd25519Signature2018 extends
|
|
10
|
+
export class VeramoEd25519Signature2018 extends VeramoLdSignature {
|
|
46
11
|
getSupportedVerificationType() {
|
|
47
12
|
return 'Ed25519VerificationKey2018';
|
|
48
13
|
}
|
|
@@ -55,25 +20,25 @@ class VeramoEd25519Signature2018 extends ld_suites_1.VeramoLdSignature {
|
|
|
55
20
|
let id = verificationMethodId;
|
|
56
21
|
const signer = {
|
|
57
22
|
// returns a JWS detached
|
|
58
|
-
sign: (args) =>
|
|
23
|
+
sign: async (args) => {
|
|
59
24
|
const header = {
|
|
60
25
|
alg: 'EdDSA',
|
|
61
26
|
b64: false,
|
|
62
27
|
crit: ['b64'],
|
|
63
28
|
};
|
|
64
|
-
const headerString =
|
|
29
|
+
const headerString = encodeJoseBlob(header);
|
|
65
30
|
const messageBuffer = u8a.concat([u8a.fromString(`${headerString}.`, 'utf-8'), args.data]);
|
|
66
31
|
const messageString = u8a.toString(messageBuffer, 'base64');
|
|
67
|
-
const signature =
|
|
32
|
+
const signature = await context.agent.keyManagerSign({
|
|
68
33
|
keyRef: key.kid,
|
|
69
34
|
algorithm: 'EdDSA',
|
|
70
35
|
data: messageString,
|
|
71
36
|
encoding: 'base64',
|
|
72
37
|
});
|
|
73
38
|
return `${headerString}..${signature}`;
|
|
74
|
-
}
|
|
39
|
+
},
|
|
75
40
|
};
|
|
76
|
-
const verificationKey = new
|
|
41
|
+
const verificationKey = new Ed25519VerificationKey2018({
|
|
77
42
|
id,
|
|
78
43
|
controller,
|
|
79
44
|
publicKey: u8a.fromString(key.publicKeyHex, 'base16'),
|
|
@@ -82,13 +47,13 @@ class VeramoEd25519Signature2018 extends ld_suites_1.VeramoLdSignature {
|
|
|
82
47
|
});
|
|
83
48
|
// overwrite the signer since we're not passing the private key and transmute doesn't support that behavior
|
|
84
49
|
verificationKey.signer = () => signer;
|
|
85
|
-
return new
|
|
50
|
+
return new Ed25519Signature2018({
|
|
86
51
|
key: verificationKey,
|
|
87
52
|
signer: signer,
|
|
88
53
|
});
|
|
89
54
|
}
|
|
90
55
|
getSuiteForVerification() {
|
|
91
|
-
return new
|
|
56
|
+
return new Ed25519Signature2018();
|
|
92
57
|
}
|
|
93
58
|
preSigningCredModification(credential) {
|
|
94
59
|
// nothing to do here
|
|
@@ -97,5 +62,4 @@ class VeramoEd25519Signature2018 extends ld_suites_1.VeramoLdSignature {
|
|
|
97
62
|
// nothing to do here
|
|
98
63
|
}
|
|
99
64
|
}
|
|
100
|
-
exports.VeramoEd25519Signature2018 = VeramoEd25519Signature2018;
|
|
101
65
|
//# sourceMappingURL=Ed25519Signature2018.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ed25519Signature2018.js","sourceRoot":"","sources":["../../src/suites/Ed25519Signature2018.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Ed25519Signature2018.js","sourceRoot":"","sources":["../../src/suites/Ed25519Signature2018.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAwB,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAEzE,OAAO,KAAK,GAAG,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAA;AAEpG;;;;GAIG;AACH,MAAM,OAAO,0BAA2B,SAAQ,iBAAiB;IAC/D,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,KAAK,EAAE,IAA0B,EAAmB,EAAE;gBAC1D,MAAM,MAAM,GAAG;oBACb,GAAG,EAAE,OAAO;oBACZ,GAAG,EAAE,KAAK;oBACV,IAAI,EAAE,CAAC,KAAK,CAAC;iBACd,CAAA;gBACD,MAAM,YAAY,GAAG,cAAc,CAAC,MAAM,CAAC,CAAA;gBAC3C,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;gBAC1F,MAAM,aAAa,GAAG,GAAG,CAAC,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAA;gBAC3D,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC;oBACnD,MAAM,EAAE,GAAG,CAAC,GAAG;oBACf,SAAS,EAAE,OAAO;oBAClB,IAAI,EAAE,aAAa;oBACnB,QAAQ,EAAE,QAAQ;iBACnB,CAAC,CAAA;gBACF,OAAO,GAAG,YAAY,KAAK,SAAS,EAAE,CAAA;YACxC,CAAC;SACF,CAAA;QAED,MAAM,eAAe,GAAG,IAAI,0BAA0B,CAAC;YACrD,EAAE;YACF,UAAU;YACV,SAAS,EAAE,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,EAAE,QAAQ,CAAC;YACrD,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM;YACpB,IAAI,EAAE,IAAI,CAAC,4BAA4B,EAAE;SAC1C,CAAC,CAAA;QACF,2GAA2G;QAC3G,eAAe,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC,MAAa,CAAA;QAE5C,OAAO,IAAI,oBAAoB,CAAC;YAC9B,GAAG,EAAE,eAAe;YACpB,MAAM,EAAE,MAAM;SACf,CAAC,CAAA;IACJ,CAAC;IAED,uBAAuB;QACrB,OAAO,IAAI,oBAAoB,EAAE,CAAA;IACnC,CAAC;IAED,0BAA0B,CAAC,UAA6B;QACtD,qBAAqB;IACvB,CAAC;IAED,4BAA4B,CAAC,MAAc,EAAE,MAAmB;QAC9D,qBAAqB;IACvB,CAAC;CACF"}
|
package/build/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
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.0.1-
|
|
4
|
+
"version": "4.0.1-unstable.4+a20894d6",
|
|
5
5
|
"main": "build/index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./build/index.js",
|
|
8
|
+
"./plugin.schema.json": "./src/plugin.schema.json"
|
|
9
|
+
},
|
|
6
10
|
"types": "build/index.d.ts",
|
|
7
11
|
"scripts": {
|
|
8
12
|
"build": "tsc",
|
|
@@ -20,9 +24,9 @@
|
|
|
20
24
|
"@transmute/credentials-context": "^0.7.0-unstable.60",
|
|
21
25
|
"@transmute/ed25519-signature-2018": "^0.7.0-unstable.60",
|
|
22
26
|
"@veramo-community/lds-ecdsa-secp256k1-recovery2020": "uport-project/EcdsaSecp256k1RecoverySignature2020",
|
|
23
|
-
"@veramo/core": "^4.0.1-
|
|
24
|
-
"@veramo/did-resolver": "^4.0.1-
|
|
25
|
-
"@veramo/utils": "^4.0.1-
|
|
27
|
+
"@veramo/core": "^4.0.1-unstable.4+a20894d6",
|
|
28
|
+
"@veramo/did-resolver": "^4.0.1-unstable.4+a20894d6",
|
|
29
|
+
"@veramo/utils": "^4.0.1-unstable.4+a20894d6",
|
|
26
30
|
"debug": "^4.3.3",
|
|
27
31
|
"did-resolver": "^4.0.0",
|
|
28
32
|
"uint8arrays": "^3.0.0"
|
|
@@ -51,5 +55,10 @@
|
|
|
51
55
|
"author": "Mircea Nistor <mircea.nistor@mesh.xyz>",
|
|
52
56
|
"license": "Apache-2.0",
|
|
53
57
|
"keywords": [],
|
|
54
|
-
"
|
|
58
|
+
"type": "module",
|
|
59
|
+
"moduleDirectories": [
|
|
60
|
+
"node_modules",
|
|
61
|
+
"src"
|
|
62
|
+
],
|
|
63
|
+
"gitHead": "a20894d60b23ab098391dd9d8ff6f96474081dc5"
|
|
55
64
|
}
|
|
@@ -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.js'
|
|
2
|
+
import { LdContextLoader } from '../ld-context-loader.js'
|
|
3
|
+
import { LdDefaultContexts } from '../ld-default-contexts.js'
|
|
4
4
|
|
|
5
5
|
describe('credential-ld context loader', () => {
|
|
6
6
|
const customContext: Record<string, ContextDoc> = {
|
|
@@ -15,15 +15,16 @@ 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.js'
|
|
19
|
+
import { CredentialIssuerLD } from '../action-handler.js'
|
|
20
|
+
import { LdDefaultContexts } from '../ld-default-contexts.js'
|
|
21
|
+
import { VeramoEd25519Signature2018 } from '../suites/Ed25519Signature2018.js'
|
|
22
22
|
import { Resolver } from 'did-resolver'
|
|
23
|
-
import { getResolver as ethrDidResolver } from
|
|
24
|
-
import { VeramoEcdsaSecp256k1RecoverySignature2020 } from '../suites/EcdsaSecp256k1RecoverySignature2020'
|
|
23
|
+
import { getResolver as ethrDidResolver } from "ethr-did-resolver"
|
|
24
|
+
import { VeramoEcdsaSecp256k1RecoverySignature2020 } from '../suites/EcdsaSecp256k1RecoverySignature2020.js'
|
|
25
|
+
import { jest } from '@jest/globals'
|
|
25
26
|
|
|
26
|
-
jest.setTimeout(
|
|
27
|
+
jest.setTimeout(60000)
|
|
27
28
|
|
|
28
29
|
const customContext: Record<string, ContextDoc> = {
|
|
29
30
|
'custom:example.context': {
|
package/src/action-handler.ts
CHANGED
|
@@ -9,9 +9,10 @@ import {
|
|
|
9
9
|
VerifiableCredential,
|
|
10
10
|
VerifiablePresentation,
|
|
11
11
|
} from '@veramo/core'
|
|
12
|
-
import {
|
|
12
|
+
import { VeramoLdSignature } from './index.js'
|
|
13
|
+
import schema from "./plugin.schema.json" assert { type: 'json' }
|
|
13
14
|
import Debug from 'debug'
|
|
14
|
-
import { LdContextLoader } from './ld-context-loader'
|
|
15
|
+
import { LdContextLoader } from './ld-context-loader.js'
|
|
15
16
|
import {
|
|
16
17
|
_ExtendedIKey,
|
|
17
18
|
extractIssuer,
|
|
@@ -23,8 +24,8 @@ import {
|
|
|
23
24
|
RecordLike,
|
|
24
25
|
} from '@veramo/utils'
|
|
25
26
|
|
|
26
|
-
import { LdCredentialModule } from './ld-credential-module'
|
|
27
|
-
import { LdSuiteLoader } from './ld-suite-loader'
|
|
27
|
+
import { LdCredentialModule } from './ld-credential-module.js'
|
|
28
|
+
import { LdSuiteLoader } from './ld-suite-loader.js'
|
|
28
29
|
import {
|
|
29
30
|
ContextDoc,
|
|
30
31
|
ICreateVerifiableCredentialLDArgs,
|
|
@@ -33,7 +34,7 @@ import {
|
|
|
33
34
|
IRequiredContext,
|
|
34
35
|
IVerifyCredentialLDArgs,
|
|
35
36
|
IVerifyPresentationLDArgs,
|
|
36
|
-
} from './types'
|
|
37
|
+
} from './types.js'
|
|
37
38
|
|
|
38
39
|
const debug = Debug('veramo:w3c:action-handler')
|
|
39
40
|
|
|
@@ -44,7 +45,7 @@ const debug = Debug('veramo:w3c:action-handler')
|
|
|
44
45
|
*/
|
|
45
46
|
export class CredentialIssuerLD implements IAgentPlugin {
|
|
46
47
|
readonly methods: ICredentialIssuerLD
|
|
47
|
-
readonly schema = schema.
|
|
48
|
+
readonly schema = schema.ICredentialIssuerLD
|
|
48
49
|
|
|
49
50
|
private ldCredentialModule: LdCredentialModule
|
|
50
51
|
|
package/src/index.ts
CHANGED
|
@@ -10,18 +10,9 @@
|
|
|
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
|
-
|
|
20
|
-
/**
|
|
21
|
-
* The parameter and return types schemas for the {@link @veramo/credential-ld#CredentialIssuerLD | CredentialIssuerLD}
|
|
22
|
-
* plugin methods.
|
|
23
|
-
*
|
|
24
|
-
* @beta This API may change without a BREAKING CHANGE notice.
|
|
25
|
-
*/
|
|
26
|
-
const schema = require('../plugin.schema.json')
|
|
27
|
-
export { schema }
|
|
13
|
+
export { CredentialIssuerLD } from './action-handler.js'
|
|
14
|
+
export * from './types.js'
|
|
15
|
+
export { LdDefaultContexts } from './ld-default-contexts.js'
|
|
16
|
+
export { VeramoLdSignature } from './ld-suites.js'
|
|
17
|
+
export * from './suites/EcdsaSecp256k1RecoverySignature2020.js'
|
|
18
|
+
export * from './suites/Ed25519Signature2018.js'
|
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.js'
|
|
8
8
|
|
|
9
9
|
export class LdContextLoader {
|
|
10
10
|
private readonly contexts: Record<string, OrPromise<ContextDoc>>
|
|
@@ -9,11 +9,12 @@ import {
|
|
|
9
9
|
} from '@veramo/core'
|
|
10
10
|
import fetch from 'cross-fetch'
|
|
11
11
|
import Debug from 'debug'
|
|
12
|
-
import
|
|
12
|
+
import jsonldSignatures from '@digitalcredentials/jsonld-signatures'
|
|
13
|
+
const { extendContextLoader } = jsonldSignatures
|
|
13
14
|
import * as vc from '@digitalcredentials/vc'
|
|
14
|
-
import { LdContextLoader } from './ld-context-loader'
|
|
15
|
-
import { LdSuiteLoader } from './ld-suite-loader'
|
|
16
|
-
import { RequiredAgentMethods } from './ld-suites'
|
|
15
|
+
import { LdContextLoader } from './ld-context-loader.js'
|
|
16
|
+
import { LdSuiteLoader } from './ld-suite-loader.js'
|
|
17
|
+
import { RequiredAgentMethods } from './ld-suites.js'
|
|
17
18
|
|
|
18
19
|
const debug = Debug('veramo:w3c:ld-credential-module')
|
|
19
20
|
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import contextCredentialV1 from "./contexts/www.w3.org_2018_credentials_v1.json" assert { type: 'json' }
|
|
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' }
|
|
2
12
|
|
|
3
13
|
/**
|
|
4
14
|
* Provides a hardcoded map of common Linked Data `@context` definitions.
|
|
@@ -8,22 +18,23 @@ import { ContextDoc } from './types'
|
|
|
8
18
|
*
|
|
9
19
|
* @beta This API may change without a BREAKING CHANGE notice.
|
|
10
20
|
*/
|
|
21
|
+
// @ts-ignore
|
|
11
22
|
export const LdDefaultContexts = new Map([
|
|
12
|
-
['https://www.w3.org/2018/credentials/v1',
|
|
13
|
-
['https://www.w3.org/ns/did/v1',
|
|
14
|
-
['https://w3id.org/security/v1',
|
|
15
|
-
['https://w3id.org/security/v2',
|
|
16
|
-
['https://w3id.org/security/v3-unstable',
|
|
17
|
-
['https://w3id.org/security/suites/ed25519-2018/v1',
|
|
18
|
-
['https://w3id.org/security/suites/x25519-2019/v1',
|
|
23
|
+
['https://www.w3.org/2018/credentials/v1', contextCredentialV1],
|
|
24
|
+
['https://www.w3.org/ns/did/v1', contextDidV1],
|
|
25
|
+
['https://w3id.org/security/v1', contextSecurityV1],
|
|
26
|
+
['https://w3id.org/security/v2', contextSecurityV2],
|
|
27
|
+
['https://w3id.org/security/v3-unstable', contextSecurityV3],
|
|
28
|
+
['https://w3id.org/security/suites/ed25519-2018/v1', contextSuitesEd25519],
|
|
29
|
+
['https://w3id.org/security/suites/x25519-2019/v1', contextSuitesX25519],
|
|
19
30
|
// ['https://w3id.org/did/v0.11', require('./contexts/did_v0.11.json')],
|
|
20
31
|
// ['https://veramo.io/contexts/socialmedia/v1', require('./contexts/socialmedia-v1.json')],
|
|
21
32
|
// ['https://veramo.io/contexts/kyc/v1', require('./contexts/kyc-v1.json')],
|
|
22
|
-
['https://veramo.io/contexts/profile/v1',
|
|
33
|
+
['https://veramo.io/contexts/profile/v1', contextProfile],
|
|
23
34
|
// ['https://ns.did.ai/transmute/v1', require('./contexts/transmute_v1.json')],
|
|
24
|
-
['https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld',
|
|
25
|
-
['https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-2.0.jsonld',
|
|
26
|
-
['https://w3id.org/security/suites/secp256k1recovery-2020/v2',
|
|
35
|
+
['https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld', contextLdsEcdsaSecpRecovery2020_0],
|
|
36
|
+
['https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-2.0.jsonld', contextLdsEcdsaSecpRecovery2020_2],
|
|
37
|
+
['https://w3id.org/security/suites/secp256k1recovery-2020/v2', contextSuitesSecp]
|
|
27
38
|
// ['https://w3id.org/security/suites/ed25519-2018/v1', require('./contexts/ed25519-signature-2018-v1.json')],
|
|
28
39
|
// ['https://w3id.org/security/suites/x25519-2019/v1', require('./contexts/X25519KeyAgreementKey2019.json')],
|
|
29
40
|
])
|
package/src/ld-suite-loader.ts
CHANGED
|
File without changes
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites'
|
|
1
|
+
import { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites.js'
|
|
2
2
|
import { CredentialPayload, DIDDocument, IAgentContext, IKey, TKeyType } from '@veramo/core'
|
|
3
|
-
import
|
|
3
|
+
import ldsEcdsa from '@veramo-community/lds-ecdsa-secp256k1-recovery2020'
|
|
4
|
+
const {
|
|
4
5
|
EcdsaSecp256k1RecoveryMethod2020,
|
|
5
6
|
EcdsaSecp256k1RecoverySignature2020,
|
|
6
|
-
}
|
|
7
|
+
} = ldsEcdsa
|
|
7
8
|
|
|
8
9
|
import * as u8a from 'uint8arrays'
|
|
9
10
|
import { asArray, encodeJoseBlob } from '@veramo/utils'
|
|
@@ -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.js'
|
|
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'
|