@veramo/credential-ld 4.3.0 → 4.3.1-next.10
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 +8 -16
- package/build/index.d.ts.map +1 -1
- package/build/index.js +8 -36
- 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 -85
- package/build/ld-credential-module.js.map +1 -1
- package/build/ld-default-contexts.d.ts +315 -1
- package/build/ld-default-contexts.d.ts.map +1 -1
- package/build/ld-default-contexts.js +28 -17
- 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 +4 -9
- 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/suites/Ed25519Signature2020.d.ts +1 -1
- package/build/suites/Ed25519Signature2020.d.ts.map +1 -1
- package/build/suites/Ed25519Signature2020.js +13 -52
- 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 +44 -82
- package/build/suites/JsonWebSignature2020.js.map +1 -1
- package/build/tsdoc-metadata.json +1 -1
- package/build/types.js +1 -2
- package/package.json +18 -9
- package/src/__tests__/context.loader.test.ts +3 -3
- package/src/__tests__/issue-verify-flow.test.ts +6 -5
- package/src/action-handler.ts +8 -7
- package/src/index.ts +8 -17
- package/src/ld-context-loader.ts +1 -1
- package/src/ld-credential-module.ts +5 -4
- package/src/ld-default-contexts.ts +27 -14
- package/src/ld-suite-loader.ts +1 -1
- package/{plugin.schema.json → src/plugin.schema.json} +0 -0
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EcdsaSecp256k1RecoverySignature2020.js","sourceRoot":"","sources":["../../src/suites/EcdsaSecp256k1RecoverySignature2020.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EcdsaSecp256k1RecoverySignature2020.js","sourceRoot":"","sources":["../../src/suites/EcdsaSecp256k1RecoverySignature2020.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAEzE,OAAO,QAAQ,MAAM,oDAAoD,CAAA;AACzE,MAAM,EACJ,gCAAgC,EAChC,mCAAmC,GACpC,GAAG,QAAQ,CAAA;AACZ,OAAO,KAAK,GAAG,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAEvD;;;;GAIG;AACH,MAAM,OAAO,yCAA0C,SAAQ,iBAAiB;IAC9E,4BAA4B;QAC1B,OAAO,kCAAkC,CAA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;IACD,UAAU;QACR,OAAO,4DAA4D,CAAA;IACrE,CAAC;CACF"}
|
|
@@ -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,M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AAC,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"}
|
|
@@ -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 Ed25519Signature2020 suite by digitalcredentials
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ed25519Signature2020.d.ts","sourceRoot":"","sources":["../../src/suites/Ed25519Signature2020.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Ed25519Signature2020.d.ts","sourceRoot":"","sources":["../../src/suites/Ed25519Signature2020.ts"],"names":[],"mappings":"AAAA,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;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"}
|
|
@@ -1,53 +1,15 @@
|
|
|
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.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");
|
|
1
|
+
import { VeramoLdSignature } from '../ld-suites.js';
|
|
2
|
+
import * as u8a from 'uint8arrays';
|
|
3
|
+
import { Ed25519Signature2020 } from '@digitalcredentials/ed25519-signature-2020';
|
|
4
|
+
import { Ed25519VerificationKey2020 } from '@digitalcredentials/ed25519-verification-key-2020';
|
|
40
5
|
/**
|
|
41
6
|
* Veramo wrapper for the Ed25519Signature2020 suite by digitalcredentials
|
|
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 VeramoEd25519Signature2020 extends
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
this.MULTIBASE_BASE58BTC_PREFIX = 'z';
|
|
49
|
-
this.MULTICODEC_PREFIX = [0xed, 0x01];
|
|
50
|
-
}
|
|
10
|
+
export class VeramoEd25519Signature2020 extends VeramoLdSignature {
|
|
11
|
+
MULTIBASE_BASE58BTC_PREFIX = 'z';
|
|
12
|
+
MULTICODEC_PREFIX = [0xed, 0x01];
|
|
51
13
|
getSupportedVerificationType() {
|
|
52
14
|
return 'Ed25519VerificationKey2020';
|
|
53
15
|
}
|
|
@@ -60,17 +22,17 @@ class VeramoEd25519Signature2020 extends ld_suites_1.VeramoLdSignature {
|
|
|
60
22
|
let id = verificationMethodId;
|
|
61
23
|
const signer = {
|
|
62
24
|
// returns signatureBytes
|
|
63
|
-
sign: (args) =>
|
|
25
|
+
sign: async (args) => {
|
|
64
26
|
const messageString = u8a.toString(args.data, 'base64');
|
|
65
|
-
const signature =
|
|
27
|
+
const signature = await context.agent.keyManagerSign({
|
|
66
28
|
keyRef: key.kid,
|
|
67
29
|
data: messageString,
|
|
68
30
|
encoding: 'base64',
|
|
69
31
|
});
|
|
70
32
|
return u8a.fromString(signature);
|
|
71
|
-
}
|
|
33
|
+
},
|
|
72
34
|
};
|
|
73
|
-
const verificationKey = new
|
|
35
|
+
const verificationKey = new Ed25519VerificationKey2020({
|
|
74
36
|
id,
|
|
75
37
|
controller,
|
|
76
38
|
publicKeyMultibase: this.preSigningKeyModification(u8a.fromString(key.publicKeyHex, 'hex')),
|
|
@@ -80,13 +42,13 @@ class VeramoEd25519Signature2020 extends ld_suites_1.VeramoLdSignature {
|
|
|
80
42
|
// overwrite the signer since we're not passing the private key
|
|
81
43
|
verificationKey.signer = () => signer;
|
|
82
44
|
verificationKey.type = this.getSupportedVerificationType();
|
|
83
|
-
return new
|
|
45
|
+
return new Ed25519Signature2020({
|
|
84
46
|
key: verificationKey,
|
|
85
47
|
signer: signer,
|
|
86
48
|
});
|
|
87
49
|
}
|
|
88
50
|
getSuiteForVerification() {
|
|
89
|
-
return new
|
|
51
|
+
return new Ed25519Signature2020();
|
|
90
52
|
}
|
|
91
53
|
preSigningCredModification(credential) {
|
|
92
54
|
// nothing to do here
|
|
@@ -99,5 +61,4 @@ class VeramoEd25519Signature2020 extends ld_suites_1.VeramoLdSignature {
|
|
|
99
61
|
return `${this.MULTIBASE_BASE58BTC_PREFIX}${u8a.toString(modifiedKey, 'base58btc')}`;
|
|
100
62
|
}
|
|
101
63
|
}
|
|
102
|
-
exports.VeramoEd25519Signature2020 = VeramoEd25519Signature2020;
|
|
103
64
|
//# sourceMappingURL=Ed25519Signature2020.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ed25519Signature2020.js","sourceRoot":"","sources":["../../src/suites/Ed25519Signature2020.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Ed25519Signature2020.js","sourceRoot":"","sources":["../../src/suites/Ed25519Signature2020.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAEzE,OAAO,KAAK,GAAG,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAA;AACjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,mDAAmD,CAAA;AAE9F;;;;GAIG;AACH,MAAM,OAAO,0BAA2B,SAAQ,iBAAiB;IAC9C,0BAA0B,GAAG,GAAG,CAAA;IAChC,iBAAiB,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IAEjD,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,EAAuB,EAAE;gBAC9D,MAAM,aAAa,G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AC;CACF"}
|
|
@@ -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.js";
|
|
3
3
|
/**
|
|
4
4
|
* Veramo wrapper for the JsonWebSignature2020 suite by Transmute Industries
|
|
5
5
|
*
|
|
@@ -1 +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,
|
|
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,iBAAiB,CAAC;AAM1E;;;;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"}
|
|
@@ -1,98 +1,61 @@
|
|
|
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.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");
|
|
1
|
+
import { VeramoLdSignature } from "../ld-suites.js";
|
|
2
|
+
import * as u8a from "uint8arrays";
|
|
3
|
+
import { JsonWebKey, JsonWebSignature } from "@transmute/json-web-signature";
|
|
4
|
+
import { encodeJoseBlob } from "@veramo/utils";
|
|
40
5
|
/**
|
|
41
6
|
* Veramo wrapper for the JsonWebSignature2020 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 VeramoJsonWebSignature2020 extends
|
|
10
|
+
export class VeramoJsonWebSignature2020 extends VeramoLdSignature {
|
|
46
11
|
getSupportedVerificationType() {
|
|
47
12
|
return 'JsonWebKey2020';
|
|
48
13
|
}
|
|
49
14
|
getSupportedVeramoKeyType() {
|
|
50
15
|
return 'Ed25519';
|
|
51
16
|
}
|
|
52
|
-
getSuiteForSigning(key, issuerDid, verificationMethodId, context) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
key: verificationKey,
|
|
90
|
-
});
|
|
91
|
-
return suite;
|
|
17
|
+
async getSuiteForSigning(key, issuerDid, verificationMethodId, context) {
|
|
18
|
+
const controller = issuerDid;
|
|
19
|
+
// DID Key ID
|
|
20
|
+
let id = verificationMethodId;
|
|
21
|
+
const signer = {
|
|
22
|
+
// returns a JWS detached
|
|
23
|
+
sign: async (args) => {
|
|
24
|
+
const header = {
|
|
25
|
+
alg: 'EdDSA',
|
|
26
|
+
b64: false,
|
|
27
|
+
crit: ['b64'],
|
|
28
|
+
};
|
|
29
|
+
const headerString = encodeJoseBlob(header);
|
|
30
|
+
const messageBuffer = u8a.concat([u8a.fromString(`${headerString}.`, 'utf-8'), args.data]);
|
|
31
|
+
const messageString = u8a.toString(messageBuffer, 'base64');
|
|
32
|
+
const signature = await context.agent.keyManagerSign({
|
|
33
|
+
keyRef: key.kid,
|
|
34
|
+
algorithm: 'EdDSA',
|
|
35
|
+
data: messageString,
|
|
36
|
+
encoding: 'base64',
|
|
37
|
+
});
|
|
38
|
+
return `${headerString}..${signature}`;
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
const verificationKey = await JsonWebKey.from({
|
|
42
|
+
id: id,
|
|
43
|
+
type: this.getSupportedVerificationType(),
|
|
44
|
+
controller: controller,
|
|
45
|
+
publicKeyJwk: {
|
|
46
|
+
kty: 'OKP',
|
|
47
|
+
crv: 'Ed25519',
|
|
48
|
+
x: u8a.toString(u8a.fromString(key.publicKeyHex, 'hex'), 'base64url'),
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
verificationKey.signer = () => signer;
|
|
52
|
+
const suite = new JsonWebSignature({
|
|
53
|
+
key: verificationKey,
|
|
92
54
|
});
|
|
55
|
+
return suite;
|
|
93
56
|
}
|
|
94
57
|
getSuiteForVerification() {
|
|
95
|
-
return new
|
|
58
|
+
return new JsonWebSignature();
|
|
96
59
|
}
|
|
97
60
|
preSigningCredModification(credential) {
|
|
98
61
|
credential['@context'] = [...credential['@context'] || [], 'https://w3id.org/security/suites/jws-2020/v1'];
|
|
@@ -101,5 +64,4 @@ class VeramoJsonWebSignature2020 extends ld_suites_1.VeramoLdSignature {
|
|
|
101
64
|
// do nothing
|
|
102
65
|
}
|
|
103
66
|
}
|
|
104
|
-
exports.VeramoJsonWebSignature2020 = VeramoJsonWebSignature2020;
|
|
105
67
|
//# sourceMappingURL=JsonWebSignature2020.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonWebSignature2020.js","sourceRoot":"","sources":["../../src/suites/JsonWebSignature2020.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"JsonWebSignature2020.js","sourceRoot":"","sources":["../../src/suites/JsonWebSignature2020.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C;;;;GAIG;AACH,MAAM,OAAO,0BAA2B,SAAQ,iBAAiB;IAC7D,4BAA4B;QACxB,OAAO,gBAAgB,CAAA;IAC3B,CAAC;IAED,yBAAyB;QACrB,OAAO,SAAS,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,kBAAkB,CACpB,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;YACX,yBAAyB;YACzB,IAAI,EAAE,KAAK,EAAE,IAA0B,EAAmB,EAAE;gBACxD,MAAM,MAAM,GAAG;oBACX,GAAG,EAAE,OAAO;oBACZ,GAAG,EAAE,KAAK;oBACV,IAAI,EAAE,CAAC,KAAK,CAAC;iBAChB,CAAA;gBACD,MAAM,YAAY,GAAG,c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CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,8CAA8C,CAAC,CAAA;IAC9G,CAAC;IAED,4BAA4B,CAAC,MAAc,EAAE,MAAmB;QAC5D,aAAa;IACjB,CAAC;CACJ"}
|
package/build/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
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.
|
|
4
|
+
"version": "4.3.1-next.10+7dc201d1",
|
|
5
5
|
"main": "build/index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./build/index.js",
|
|
8
|
+
"./build/plugin.schema.json": "./build/plugin.schema.json"
|
|
9
|
+
},
|
|
6
10
|
"types": "build/index.d.ts",
|
|
7
11
|
"scripts": {
|
|
8
12
|
"build": "tsc",
|
|
9
|
-
"generate-plugin-schema": "
|
|
13
|
+
"generate-plugin-schema": "node ../cli/bin/veramo.js dev generate-plugin-schema"
|
|
10
14
|
},
|
|
11
15
|
"veramo": {
|
|
12
16
|
"pluginInterfaces": {
|
|
@@ -19,13 +23,13 @@
|
|
|
19
23
|
"@digitalcredentials/jsonld": "^5.2.1",
|
|
20
24
|
"@digitalcredentials/jsonld-signatures": "^9.3.1",
|
|
21
25
|
"@digitalcredentials/vc": "^5.0.0",
|
|
22
|
-
"@transmute/credentials-context": "^0.7.0-unstable.
|
|
23
|
-
"@transmute/ed25519-signature-2018": "^0.7.0-unstable.
|
|
24
|
-
"@transmute/json-web-signature": "^0.7.0-unstable.
|
|
26
|
+
"@transmute/credentials-context": "^0.7.0-unstable.79",
|
|
27
|
+
"@transmute/ed25519-signature-2018": "^0.7.0-unstable.79",
|
|
28
|
+
"@transmute/json-web-signature": "^0.7.0-unstable.79",
|
|
25
29
|
"@veramo-community/lds-ecdsa-secp256k1-recovery2020": "uport-project/EcdsaSecp256k1RecoverySignature2020",
|
|
26
|
-
"@veramo/core": "^4.3.
|
|
27
|
-
"@veramo/did-resolver": "^4.3.
|
|
28
|
-
"@veramo/utils": "^4.3.
|
|
30
|
+
"@veramo/core": "^4.3.1-next.10+7dc201d1",
|
|
31
|
+
"@veramo/did-resolver": "^4.3.1-next.10+7dc201d1",
|
|
32
|
+
"@veramo/utils": "^4.3.1-next.10+7dc201d1",
|
|
29
33
|
"cross-fetch": "^3.1.5",
|
|
30
34
|
"debug": "^4.3.3",
|
|
31
35
|
"did-resolver": "^4.0.1",
|
|
@@ -55,5 +59,10 @@
|
|
|
55
59
|
"author": "Mircea Nistor <mircea.nistor@mesh.xyz>",
|
|
56
60
|
"license": "Apache-2.0",
|
|
57
61
|
"keywords": [],
|
|
58
|
-
"
|
|
62
|
+
"type": "module",
|
|
63
|
+
"moduleDirectories": [
|
|
64
|
+
"node_modules",
|
|
65
|
+
"src"
|
|
66
|
+
],
|
|
67
|
+
"gitHead": "7dc201d17bfbdcd5dd51b1e64a67ce203e844604"
|
|
59
68
|
}
|
|
@@ -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,13 +15,14 @@ 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
23
|
import { getResolver as ethrDidResolver } from 'ethr-did-resolver'
|
|
24
|
-
import { VeramoEcdsaSecp256k1RecoverySignature2020 } from '../suites/EcdsaSecp256k1RecoverySignature2020'
|
|
24
|
+
import { VeramoEcdsaSecp256k1RecoverySignature2020 } from '../suites/EcdsaSecp256k1RecoverySignature2020.js'
|
|
25
|
+
import { jest } from '@jest/globals'
|
|
25
26
|
|
|
26
27
|
import 'cross-fetch/polyfill'
|
|
27
28
|
jest.setTimeout(300000)
|
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
|
|
|
@@ -228,7 +229,7 @@ export class CredentialIssuerLD implements IAgentPlugin {
|
|
|
228
229
|
context: IAgentContext<IResolver>,
|
|
229
230
|
identifier: IIdentifier,
|
|
230
231
|
keyRef?: string,
|
|
231
|
-
): Promise<{ signingKey:
|
|
232
|
+
): Promise<{ signingKey: _ExtendedIKey; verificationMethodId: string }> {
|
|
232
233
|
const extendedKeys: _ExtendedIKey[] = await mapIdentifierKeysToDoc(identifier, 'assertionMethod', context)
|
|
233
234
|
let supportedTypes = this.ldCredentialModule.ldSuiteLoader.getAllSignatureSuiteTypes()
|
|
234
235
|
let signingKey: _ExtendedIKey | undefined
|