@sphereon/ssi-sdk-ext.did-provider-key 0.27.1-next.6 → 0.28.1-feature.esm.cjs.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,118 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/SphereonKeyDidProvider.ts
5
+ var _ssisdkextkeyutils = require('@sphereon/ssi-sdk-ext.key-utils');
6
+ var _didmanager = require('@veramo/did-manager');
7
+ var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
8
+ var _multibase = require('multibase'); var _multibase2 = _interopRequireDefault(_multibase);
9
+ var _multicodec = require('multicodec'); var _multicodec2 = _interopRequireDefault(_multicodec);
10
+ var _uint8arrays = require('uint8arrays'); var u8a = _interopRequireWildcard(_uint8arrays);
11
+ var { fromString, toString } = u8a;
12
+ var debug = _debug2.default.call(void 0, "did-provider-key");
13
+ var keyCodecs = {
14
+ RSA: "rsa-pub",
15
+ Ed25519: "ed25519-pub",
16
+ X25519: "x25519-pub",
17
+ Secp256k1: "secp256k1-pub",
18
+ Secp256r1: "p256-pub",
19
+ Bls12381G1: "bls12_381-g1-pub",
20
+ Bls12381G2: "bls12_381-g2-pub"
21
+ };
22
+ var SphereonKeyDidProvider = class extends _didmanager.AbstractIdentifierProvider {
23
+ static {
24
+ __name(this, "SphereonKeyDidProvider");
25
+ }
26
+
27
+ constructor(options) {
28
+ super();
29
+ this.kms = options.defaultKms;
30
+ }
31
+ async createIdentifier({ kms, alias, options }, context) {
32
+ let codecName = _optionalChain([options, 'optionalAccess', _ => _.codecName, 'optionalAccess', _2 => _2.toUpperCase, 'call', _3 => _3()]) === "EBSI" ? _ssisdkextkeyutils.JWK_JCS_PUB_NAME : _optionalChain([options, 'optionalAccess', _4 => _4.codecName]);
33
+ const keyType = _nullishCoalesce(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _5 => _5.type]), () => ( _optionalChain([options, 'optionalAccess', _6 => _6.key, 'optionalAccess', _7 => _7.type]))), () => ( (codecName === _ssisdkextkeyutils.JWK_JCS_PUB_NAME ? "Secp256r1" : "Secp256k1")));
34
+ const key = await _ssisdkextkeyutils.importProvidedOrGeneratedKey.call(void 0, {
35
+ // @ts-ignore
36
+ kms: _nullishCoalesce(kms, () => ( this.kms)),
37
+ alias,
38
+ options: {
39
+ ...options,
40
+ type: keyType
41
+ }
42
+ }, context);
43
+ let methodSpecificId;
44
+ const compressedPublicKeyHex = _ssisdkextkeyutils.toRawCompressedHexPublicKey.call(void 0, fromString(key.publicKeyHex, "hex"), key.type);
45
+ if (codecName === _ssisdkextkeyutils.JWK_JCS_PUB_NAME) {
46
+ const jwk = _ssisdkextkeyutils.toJwk.call(void 0, key.publicKeyHex, keyType, {
47
+ use: _ssisdkextkeyutils.JwkKeyUse.Signature,
48
+ key,
49
+ noKidThumbprint: true
50
+ });
51
+ methodSpecificId = toString(_multibase2.default.encode("base58btc", _multicodec2.default.addPrefix(fromString(_ssisdkextkeyutils.JWK_JCS_PUB_PREFIX.valueOf().toString(16), "hex"), _ssisdkextkeyutils.jwkJcsEncode.call(void 0, jwk))));
52
+ } else if (codecName) {
53
+ methodSpecificId = toString(_multibase2.default.encode("base58btc", _multicodec2.default.addPrefix(codecName, fromString(compressedPublicKeyHex, "hex"))));
54
+ } else {
55
+ codecName = keyCodecs[keyType];
56
+ if (codecName) {
57
+ methodSpecificId = toString(_multibase2.default.encode("base58btc", _multicodec2.default.addPrefix(codecName, fromString(compressedPublicKeyHex, "hex")))).toString();
58
+ }
59
+ }
60
+ if (!methodSpecificId) {
61
+ throw Error(`Key type ${keyType}, codec ${codecName} is not supported currently for did:key`);
62
+ }
63
+ const identifier = {
64
+ did: `did:key:${methodSpecificId}`,
65
+ controllerKeyId: key.kid,
66
+ keys: [
67
+ key
68
+ ],
69
+ services: []
70
+ };
71
+ debug("Created", identifier.did);
72
+ return identifier;
73
+ }
74
+ async updateIdentifier(args, context) {
75
+ throw new Error("KeyDIDProvider updateIdentifier not supported yet.");
76
+ }
77
+ async deleteIdentifier(identifier, context) {
78
+ for (const { kid } of identifier.keys) {
79
+ await context.agent.keyManagerDelete({
80
+ kid
81
+ });
82
+ }
83
+ return true;
84
+ }
85
+ async addKey({ identifier, key, options }, context) {
86
+ throw Error("KeyDIDProvider addKey not supported");
87
+ }
88
+ async addService({ identifier, service, options }, context) {
89
+ throw Error("KeyDIDProvider addService not supported");
90
+ }
91
+ async removeKey(args, context) {
92
+ throw Error("KeyDIDProvider removeKey not supported");
93
+ }
94
+ async removeService(args, context) {
95
+ throw Error("KeyDIDProvider removeService not supported");
96
+ }
97
+ };
98
+
99
+ // src/KeyDidResolver.ts
100
+ var _didresolver = require('did-resolver');
101
+ var _ssisdkextdidresolverkey = require('@sphereon/ssi-sdk-ext.did-resolver-key');
102
+ var resolveDidKey = /* @__PURE__ */ __name(async (didUrl, _parsed, _resolver, options) => {
103
+ const resolver = new (0, _didresolver.Resolver)({
104
+ ..._ssisdkextdidresolverkey.getResolver.call(void 0, )
105
+ });
106
+ return resolver.resolve(didUrl, options);
107
+ }, "resolveDidKey");
108
+ function getDidKeyResolver() {
109
+ return {
110
+ key: resolveDidKey
111
+ };
112
+ }
113
+ __name(getDidKeyResolver, "getDidKeyResolver");
114
+
115
+
116
+
117
+ exports.SphereonKeyDidProvider = SphereonKeyDidProvider; exports.getDidKeyResolver = getDidKeyResolver;
118
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/SSI-SDK-crypto-extensions/SSI-SDK-crypto-extensions/packages/did-provider-key/dist/index.cjs","../src/SphereonKeyDidProvider.ts","../src/KeyDidResolver.ts"],"names":["fromString","toString","u8a","debug","Debug","keyCodecs","RSA","Ed25519","X25519","Secp256k1","Secp256r1","Bls12381G1","Bls12381G2","SphereonKeyDidProvider","AbstractIdentifierProvider","kms","constructor","options","defaultKms","createIdentifier","alias","context","codecName","toUpperCase","JWK_JCS_PUB_NAME","keyType","type","key","importProvidedOrGeneratedKey","methodSpecificId","compressedPublicKeyHex","toRawCompressedHexPublicKey","publicKeyHex","jwk","toJwk","use","JwkKeyUse","Signature","noKidThumbprint","Multibase","encode","Multicodec","addPrefix","JWK_JCS_PUB_PREFIX","valueOf","jwkJcsEncode","Error","identifier","did","kid","keys","keyManagerDelete","service","getResolver","getDidKeyResolver","resolveDidKey"],"mappings":"AAAA,uiCAAI,UAAU,EAAE,MAAM,CAAC,cAAc;AACrC,IAAI,OAAO,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;AACxF;AACA;ACHA,oEASO;AAEP,iDAA2C;AAC3C,4EAAkB;AAClB,4FAAsB;AACtB,gGAAuB;AAEvB,2FAAqB;AACrB,IAAM,EAAEA,UAAAA,EAAYC,SAAQ,EAAA,EAAKC,GAAAA;AAEjC,IAAMC,MAAAA,EAAQC,6BAA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AAUC,MAAAA,CAAO,WAAA,EAAaC,oBAAAA,CAAWC,SAAAA,CAAUpB,SAAAA,EAAmCtB,UAAAA,CAAW8B,sBAAAA,EAAwB,KAAA,CAAA,CAAA,CAAA,CAAA,CACzH7B,QAAAA,CAAQ,CAAA;AD3ClB,MC4CM;AD3CN,IC4CI;AACA,IAAA,GAAA,CAAI,CAAC4B,gBAAAA,EAAkB;AACrB,MAAA,MAAMiB,KAAAA,CAAM,CAAA,SAAA,EAAYrB,OAAAA,CAAAA,QAAAA,EAAkBH,SAAAA,CAAAA,uCAAAA,CAAkD,CAAA;AD3ClG,IC4CI;AACA,IAAA,MAAMyB,WAAAA,EAA4C;AD3CtD,MC4CMC,GAAAA,EAAK,CAAA,QAAA,EAAWnB,gBAAAA,CAAAA,CAAAA;AACKoB,MAAAA;AACf,MAAA;AAACtB,QAAAA;AD1C0B,MAAA;AC2CvB,MAAA;AACZ,IAAA;AAC+B,IAAA;AACxBoB,IAAAA;AACT,EAAA;AAIE1B,EAAAA;AAEgB,IAAA;AAClB,EAAA;AAEgDA,EAAAA;AACb6B,IAAAA;AACXC,MAAAA;AAAmBF,QAAAA;AAAI,MAAA;AAC7C,IAAA;AACO,IAAA;AACT,EAAA;AAEgChC,EAAAA;AAClB,IAAA;AACd,EAAA;AAE+BmC,EAAAA;AACjB,IAAA;AACd,EAAA;AAEgH,EAAA;AAClG,IAAA;AACd,EAAA;AAEmH,EAAA;AACrG,IAAA;AACd,EAAA;AACF;ADhDuC;AACA;AElGiE;AAC5E;AAEO;AAMH,EAAA;AAAKC,IAAAA;AAAc,EAAA;AACjBpC,EAAAA;AAPC;AAUnBqC;AACP,EAAA;AAAOC,IAAAA;AAAc,EAAA;AAC9B;AAFgBD;AFoGuB;AACA;AACA;AACA","file":"/home/runner/work/SSI-SDK-crypto-extensions/SSI-SDK-crypto-extensions/packages/did-provider-key/dist/index.cjs","sourcesContent":[null,"import {\n importProvidedOrGeneratedKey,\n JWK_JCS_PUB_NAME,\n JWK_JCS_PUB_PREFIX,\n jwkJcsEncode,\n JwkKeyUse,\n TKeyType,\n toJwk,\n toRawCompressedHexPublicKey,\n} from '@sphereon/ssi-sdk-ext.key-utils'\nimport { IAgentContext, IIdentifier, IKey, IKeyManager, IService } from '@veramo/core'\nimport { AbstractIdentifierProvider } from '@veramo/did-manager'\nimport Debug from 'debug'\nimport Multibase from 'multibase'\nimport Multicodec from 'multicodec'\n// @ts-ignore\nimport * as u8a from 'uint8arrays'\nconst { fromString, toString } = u8a\n\nconst debug = Debug('did-provider-key')\n\ntype IContext = IAgentContext<IKeyManager>\n\nconst keyCodecs = {\n RSA: 'rsa-pub',\n Ed25519: 'ed25519-pub',\n X25519: 'x25519-pub',\n Secp256k1: 'secp256k1-pub',\n Secp256r1: 'p256-pub',\n Bls12381G1: 'bls12_381-g1-pub',\n Bls12381G2: 'bls12_381-g2-pub',\n} as const\n\nexport class SphereonKeyDidProvider extends AbstractIdentifierProvider {\n private readonly kms?: string\n\n constructor(options: { defaultKms?: string }) {\n super()\n this.kms = options.defaultKms\n }\n\n async createIdentifier(\n {\n kms,\n alias,\n options,\n }: {\n kms?: string\n alias?: string\n options?: {\n type?: TKeyType\n codecName?: 'EBSI' | 'jwk_jcs-pub' | Multicodec.CodecName\n key?: {\n type?: Exclude<TKeyType, 'Secp384r1' | 'Secp521r1'>\n privateKeyHex: string\n }\n }\n },\n context: IContext\n ): Promise<Omit<IIdentifier, 'provider'>> {\n let codecName = (options?.codecName?.toUpperCase() === 'EBSI' ? (JWK_JCS_PUB_NAME as Multicodec.CodecName) : options?.codecName) as\n | CodeNameType\n | undefined\n const keyType = (options?.type ?? options?.key?.type ?? (codecName === JWK_JCS_PUB_NAME ? 'Secp256r1' : 'Secp256k1')) as Exclude<\n TKeyType,\n 'Secp384r1' | 'Secp521r1'\n >\n // console.log(`keytype: ${keyType}, codecName: ${codecName}`)\n\n const key = await importProvidedOrGeneratedKey(\n {\n // @ts-ignore\n kms: kms ?? this.kms,\n alias: alias,\n options: { ...options, type: keyType },\n },\n context\n )\n\n let methodSpecificId: string | undefined\n\n // did:key uses compressed pub keys\n const compressedPublicKeyHex = toRawCompressedHexPublicKey(fromString(key.publicKeyHex, 'hex'), key.type)\n if (codecName === JWK_JCS_PUB_NAME) {\n const jwk = toJwk(key.publicKeyHex, keyType, { use: JwkKeyUse.Signature, key, noKidThumbprint: true })\n // console.log(`FIXME JWK: ${JSON.stringify(toJwk(privateKeyHex, keyType, { use: JwkKeyUse.Signature, key, isPrivateKey: true }), null, 2)}`)\n methodSpecificId = toString(\n Multibase.encode('base58btc', Multicodec.addPrefix(fromString(JWK_JCS_PUB_PREFIX.valueOf().toString(16), 'hex'), jwkJcsEncode(jwk)))\n )\n } else if (codecName) {\n methodSpecificId = toString(\n Multibase.encode('base58btc', Multicodec.addPrefix(codecName as Multicodec.CodecName, fromString(compressedPublicKeyHex, 'hex')))\n )\n } else {\n codecName = keyCodecs[keyType]\n\n if (codecName) {\n // methodSpecificId = bytesToMultibase({bytes: u8a.fromString(key.publicKeyHex, 'hex'), codecName})\n methodSpecificId = toString(\n Multibase.encode('base58btc', Multicodec.addPrefix(codecName as Multicodec.CodecName, fromString(compressedPublicKeyHex, 'hex')))\n ).toString()\n }\n }\n if (!methodSpecificId) {\n throw Error(`Key type ${keyType}, codec ${codecName} is not supported currently for did:key`)\n }\n const identifier: Omit<IIdentifier, 'provider'> = {\n did: `did:key:${methodSpecificId}`,\n controllerKeyId: key.kid,\n keys: [key],\n services: [],\n }\n debug('Created', identifier.did)\n return identifier\n }\n\n async updateIdentifier(\n args: { did: string; kms?: string | undefined; alias?: string | undefined; options?: any },\n context: IAgentContext<IKeyManager>\n ): Promise<IIdentifier> {\n throw new Error('KeyDIDProvider updateIdentifier not supported yet.')\n }\n\n async deleteIdentifier(identifier: IIdentifier, context: IContext): Promise<boolean> {\n for (const { kid } of identifier.keys) {\n await context.agent.keyManagerDelete({ kid })\n }\n return true\n }\n\n async addKey({ identifier, key, options }: { identifier: IIdentifier; key: IKey; options?: any }, context: IContext): Promise<any> {\n throw Error('KeyDIDProvider addKey not supported')\n }\n\n async addService({ identifier, service, options }: { identifier: IIdentifier; service: IService; options?: any }, context: IContext): Promise<any> {\n throw Error('KeyDIDProvider addService not supported')\n }\n\n async removeKey(args: { identifier: IIdentifier; kid: string; options?: any }, context: IContext): Promise<any> {\n throw Error('KeyDIDProvider removeKey not supported')\n }\n\n async removeService(args: { identifier: IIdentifier; id: string; options?: any }, context: IContext): Promise<any> {\n throw Error('KeyDIDProvider removeService not supported')\n }\n}\n\ntype CodeNameType = Multicodec.CodecName | 'rsa-pub' | 'jwk_jcs-pub'\n","import { DIDResolutionOptions, DIDResolutionResult, DIDResolver, ParsedDID, Resolvable, Resolver } from 'did-resolver'\nimport { getResolver } from '@sphereon/ssi-sdk-ext.did-resolver-key'\n\nconst resolveDidKey: DIDResolver = async (\n didUrl: string,\n _parsed: ParsedDID,\n _resolver: Resolvable,\n options: DIDResolutionOptions\n): Promise<DIDResolutionResult> => {\n const resolver = new Resolver({ ...getResolver() })\n return resolver.resolve(didUrl, options)\n}\n\nexport function getDidKeyResolver() {\n return { key: resolveDidKey }\n}\n"]}
@@ -1,9 +1,11 @@
1
1
  import { TKeyType } from '@sphereon/ssi-sdk-ext.key-utils';
2
- import { IAgentContext, IIdentifier, IKey, IKeyManager, IService } from '@veramo/core';
2
+ import { IAgentContext, IKeyManager, IIdentifier, IKey, IService } from '@veramo/core';
3
3
  import { AbstractIdentifierProvider } from '@veramo/did-manager';
4
4
  import Multicodec from 'multicodec';
5
+ import { DIDResolver } from 'did-resolver';
6
+
5
7
  type IContext = IAgentContext<IKeyManager>;
6
- export declare class SphereonKeyDidProvider extends AbstractIdentifierProvider {
8
+ declare class SphereonKeyDidProvider extends AbstractIdentifierProvider {
7
9
  private readonly kms?;
8
10
  constructor(options: {
9
11
  defaultKms?: string;
@@ -48,5 +50,9 @@ export declare class SphereonKeyDidProvider extends AbstractIdentifierProvider {
48
50
  options?: any;
49
51
  }, context: IContext): Promise<any>;
50
52
  }
51
- export {};
52
- //# sourceMappingURL=SphereonKeyDidProvider.d.ts.map
53
+
54
+ declare function getDidKeyResolver(): {
55
+ key: DIDResolver;
56
+ };
57
+
58
+ export { SphereonKeyDidProvider, getDidKeyResolver };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,58 @@
1
- export { SphereonKeyDidProvider } from './SphereonKeyDidProvider';
2
- export { getDidKeyResolver } from './KeyDidResolver';
3
- //# sourceMappingURL=index.d.ts.map
1
+ import { TKeyType } from '@sphereon/ssi-sdk-ext.key-utils';
2
+ import { IAgentContext, IKeyManager, IIdentifier, IKey, IService } from '@veramo/core';
3
+ import { AbstractIdentifierProvider } from '@veramo/did-manager';
4
+ import Multicodec from 'multicodec';
5
+ import { DIDResolver } from 'did-resolver';
6
+
7
+ type IContext = IAgentContext<IKeyManager>;
8
+ declare class SphereonKeyDidProvider extends AbstractIdentifierProvider {
9
+ private readonly kms?;
10
+ constructor(options: {
11
+ defaultKms?: string;
12
+ });
13
+ createIdentifier({ kms, alias, options, }: {
14
+ kms?: string;
15
+ alias?: string;
16
+ options?: {
17
+ type?: TKeyType;
18
+ codecName?: 'EBSI' | 'jwk_jcs-pub' | Multicodec.CodecName;
19
+ key?: {
20
+ type?: Exclude<TKeyType, 'Secp384r1' | 'Secp521r1'>;
21
+ privateKeyHex: string;
22
+ };
23
+ };
24
+ }, context: IContext): Promise<Omit<IIdentifier, 'provider'>>;
25
+ updateIdentifier(args: {
26
+ did: string;
27
+ kms?: string | undefined;
28
+ alias?: string | undefined;
29
+ options?: any;
30
+ }, context: IAgentContext<IKeyManager>): Promise<IIdentifier>;
31
+ deleteIdentifier(identifier: IIdentifier, context: IContext): Promise<boolean>;
32
+ addKey({ identifier, key, options }: {
33
+ identifier: IIdentifier;
34
+ key: IKey;
35
+ options?: any;
36
+ }, context: IContext): Promise<any>;
37
+ addService({ identifier, service, options }: {
38
+ identifier: IIdentifier;
39
+ service: IService;
40
+ options?: any;
41
+ }, context: IContext): Promise<any>;
42
+ removeKey(args: {
43
+ identifier: IIdentifier;
44
+ kid: string;
45
+ options?: any;
46
+ }, context: IContext): Promise<any>;
47
+ removeService(args: {
48
+ identifier: IIdentifier;
49
+ id: string;
50
+ options?: any;
51
+ }, context: IContext): Promise<any>;
52
+ }
53
+
54
+ declare function getDidKeyResolver(): {
55
+ key: DIDResolver;
56
+ };
57
+
58
+ export { SphereonKeyDidProvider, getDidKeyResolver };
package/dist/index.js CHANGED
@@ -1,8 +1,118 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDidKeyResolver = exports.SphereonKeyDidProvider = void 0;
4
- var SphereonKeyDidProvider_1 = require("./SphereonKeyDidProvider");
5
- Object.defineProperty(exports, "SphereonKeyDidProvider", { enumerable: true, get: function () { return SphereonKeyDidProvider_1.SphereonKeyDidProvider; } });
6
- var KeyDidResolver_1 = require("./KeyDidResolver");
7
- Object.defineProperty(exports, "getDidKeyResolver", { enumerable: true, get: function () { return KeyDidResolver_1.getDidKeyResolver; } });
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/SphereonKeyDidProvider.ts
5
+ import { importProvidedOrGeneratedKey, JWK_JCS_PUB_NAME, JWK_JCS_PUB_PREFIX, jwkJcsEncode, JwkKeyUse, toJwk, toRawCompressedHexPublicKey } from "@sphereon/ssi-sdk-ext.key-utils";
6
+ import { AbstractIdentifierProvider } from "@veramo/did-manager";
7
+ import Debug from "debug";
8
+ import Multibase from "multibase";
9
+ import Multicodec from "multicodec";
10
+ import * as u8a from "uint8arrays";
11
+ var { fromString, toString } = u8a;
12
+ var debug = Debug("did-provider-key");
13
+ var keyCodecs = {
14
+ RSA: "rsa-pub",
15
+ Ed25519: "ed25519-pub",
16
+ X25519: "x25519-pub",
17
+ Secp256k1: "secp256k1-pub",
18
+ Secp256r1: "p256-pub",
19
+ Bls12381G1: "bls12_381-g1-pub",
20
+ Bls12381G2: "bls12_381-g2-pub"
21
+ };
22
+ var SphereonKeyDidProvider = class extends AbstractIdentifierProvider {
23
+ static {
24
+ __name(this, "SphereonKeyDidProvider");
25
+ }
26
+ kms;
27
+ constructor(options) {
28
+ super();
29
+ this.kms = options.defaultKms;
30
+ }
31
+ async createIdentifier({ kms, alias, options }, context) {
32
+ let codecName = options?.codecName?.toUpperCase() === "EBSI" ? JWK_JCS_PUB_NAME : options?.codecName;
33
+ const keyType = options?.type ?? options?.key?.type ?? (codecName === JWK_JCS_PUB_NAME ? "Secp256r1" : "Secp256k1");
34
+ const key = await importProvidedOrGeneratedKey({
35
+ // @ts-ignore
36
+ kms: kms ?? this.kms,
37
+ alias,
38
+ options: {
39
+ ...options,
40
+ type: keyType
41
+ }
42
+ }, context);
43
+ let methodSpecificId;
44
+ const compressedPublicKeyHex = toRawCompressedHexPublicKey(fromString(key.publicKeyHex, "hex"), key.type);
45
+ if (codecName === JWK_JCS_PUB_NAME) {
46
+ const jwk = toJwk(key.publicKeyHex, keyType, {
47
+ use: JwkKeyUse.Signature,
48
+ key,
49
+ noKidThumbprint: true
50
+ });
51
+ methodSpecificId = toString(Multibase.encode("base58btc", Multicodec.addPrefix(fromString(JWK_JCS_PUB_PREFIX.valueOf().toString(16), "hex"), jwkJcsEncode(jwk))));
52
+ } else if (codecName) {
53
+ methodSpecificId = toString(Multibase.encode("base58btc", Multicodec.addPrefix(codecName, fromString(compressedPublicKeyHex, "hex"))));
54
+ } else {
55
+ codecName = keyCodecs[keyType];
56
+ if (codecName) {
57
+ methodSpecificId = toString(Multibase.encode("base58btc", Multicodec.addPrefix(codecName, fromString(compressedPublicKeyHex, "hex")))).toString();
58
+ }
59
+ }
60
+ if (!methodSpecificId) {
61
+ throw Error(`Key type ${keyType}, codec ${codecName} is not supported currently for did:key`);
62
+ }
63
+ const identifier = {
64
+ did: `did:key:${methodSpecificId}`,
65
+ controllerKeyId: key.kid,
66
+ keys: [
67
+ key
68
+ ],
69
+ services: []
70
+ };
71
+ debug("Created", identifier.did);
72
+ return identifier;
73
+ }
74
+ async updateIdentifier(args, context) {
75
+ throw new Error("KeyDIDProvider updateIdentifier not supported yet.");
76
+ }
77
+ async deleteIdentifier(identifier, context) {
78
+ for (const { kid } of identifier.keys) {
79
+ await context.agent.keyManagerDelete({
80
+ kid
81
+ });
82
+ }
83
+ return true;
84
+ }
85
+ async addKey({ identifier, key, options }, context) {
86
+ throw Error("KeyDIDProvider addKey not supported");
87
+ }
88
+ async addService({ identifier, service, options }, context) {
89
+ throw Error("KeyDIDProvider addService not supported");
90
+ }
91
+ async removeKey(args, context) {
92
+ throw Error("KeyDIDProvider removeKey not supported");
93
+ }
94
+ async removeService(args, context) {
95
+ throw Error("KeyDIDProvider removeService not supported");
96
+ }
97
+ };
98
+
99
+ // src/KeyDidResolver.ts
100
+ import { Resolver } from "did-resolver";
101
+ import { getResolver } from "@sphereon/ssi-sdk-ext.did-resolver-key";
102
+ var resolveDidKey = /* @__PURE__ */ __name(async (didUrl, _parsed, _resolver, options) => {
103
+ const resolver = new Resolver({
104
+ ...getResolver()
105
+ });
106
+ return resolver.resolve(didUrl, options);
107
+ }, "resolveDidKey");
108
+ function getDidKeyResolver() {
109
+ return {
110
+ key: resolveDidKey
111
+ };
112
+ }
113
+ __name(getDidKeyResolver, "getDidKeyResolver");
114
+ export {
115
+ SphereonKeyDidProvider,
116
+ getDidKeyResolver
117
+ };
8
118
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mEAAiE;AAAxD,gIAAA,sBAAsB,OAAA;AAC/B,mDAAoD;AAA3C,mHAAA,iBAAiB,OAAA"}
1
+ {"version":3,"sources":["../src/SphereonKeyDidProvider.ts","../src/KeyDidResolver.ts"],"sourcesContent":["import {\n importProvidedOrGeneratedKey,\n JWK_JCS_PUB_NAME,\n JWK_JCS_PUB_PREFIX,\n jwkJcsEncode,\n JwkKeyUse,\n TKeyType,\n toJwk,\n toRawCompressedHexPublicKey,\n} from '@sphereon/ssi-sdk-ext.key-utils'\nimport { IAgentContext, IIdentifier, IKey, IKeyManager, IService } from '@veramo/core'\nimport { AbstractIdentifierProvider } from '@veramo/did-manager'\nimport Debug from 'debug'\nimport Multibase from 'multibase'\nimport Multicodec from 'multicodec'\n// @ts-ignore\nimport * as u8a from 'uint8arrays'\nconst { fromString, toString } = u8a\n\nconst debug = Debug('did-provider-key')\n\ntype IContext = IAgentContext<IKeyManager>\n\nconst keyCodecs = {\n RSA: 'rsa-pub',\n Ed25519: 'ed25519-pub',\n X25519: 'x25519-pub',\n Secp256k1: 'secp256k1-pub',\n Secp256r1: 'p256-pub',\n Bls12381G1: 'bls12_381-g1-pub',\n Bls12381G2: 'bls12_381-g2-pub',\n} as const\n\nexport class SphereonKeyDidProvider extends AbstractIdentifierProvider {\n private readonly kms?: string\n\n constructor(options: { defaultKms?: string }) {\n super()\n this.kms = options.defaultKms\n }\n\n async createIdentifier(\n {\n kms,\n alias,\n options,\n }: {\n kms?: string\n alias?: string\n options?: {\n type?: TKeyType\n codecName?: 'EBSI' | 'jwk_jcs-pub' | Multicodec.CodecName\n key?: {\n type?: Exclude<TKeyType, 'Secp384r1' | 'Secp521r1'>\n privateKeyHex: string\n }\n }\n },\n context: IContext\n ): Promise<Omit<IIdentifier, 'provider'>> {\n let codecName = (options?.codecName?.toUpperCase() === 'EBSI' ? (JWK_JCS_PUB_NAME as Multicodec.CodecName) : options?.codecName) as\n | CodeNameType\n | undefined\n const keyType = (options?.type ?? options?.key?.type ?? (codecName === JWK_JCS_PUB_NAME ? 'Secp256r1' : 'Secp256k1')) as Exclude<\n TKeyType,\n 'Secp384r1' | 'Secp521r1'\n >\n // console.log(`keytype: ${keyType}, codecName: ${codecName}`)\n\n const key = await importProvidedOrGeneratedKey(\n {\n // @ts-ignore\n kms: kms ?? this.kms,\n alias: alias,\n options: { ...options, type: keyType },\n },\n context\n )\n\n let methodSpecificId: string | undefined\n\n // did:key uses compressed pub keys\n const compressedPublicKeyHex = toRawCompressedHexPublicKey(fromString(key.publicKeyHex, 'hex'), key.type)\n if (codecName === JWK_JCS_PUB_NAME) {\n const jwk = toJwk(key.publicKeyHex, keyType, { use: JwkKeyUse.Signature, key, noKidThumbprint: true })\n // console.log(`FIXME JWK: ${JSON.stringify(toJwk(privateKeyHex, keyType, { use: JwkKeyUse.Signature, key, isPrivateKey: true }), null, 2)}`)\n methodSpecificId = toString(\n Multibase.encode('base58btc', Multicodec.addPrefix(fromString(JWK_JCS_PUB_PREFIX.valueOf().toString(16), 'hex'), jwkJcsEncode(jwk)))\n )\n } else if (codecName) {\n methodSpecificId = toString(\n Multibase.encode('base58btc', Multicodec.addPrefix(codecName as Multicodec.CodecName, fromString(compressedPublicKeyHex, 'hex')))\n )\n } else {\n codecName = keyCodecs[keyType]\n\n if (codecName) {\n // methodSpecificId = bytesToMultibase({bytes: u8a.fromString(key.publicKeyHex, 'hex'), codecName})\n methodSpecificId = toString(\n Multibase.encode('base58btc', Multicodec.addPrefix(codecName as Multicodec.CodecName, fromString(compressedPublicKeyHex, 'hex')))\n ).toString()\n }\n }\n if (!methodSpecificId) {\n throw Error(`Key type ${keyType}, codec ${codecName} is not supported currently for did:key`)\n }\n const identifier: Omit<IIdentifier, 'provider'> = {\n did: `did:key:${methodSpecificId}`,\n controllerKeyId: key.kid,\n keys: [key],\n services: [],\n }\n debug('Created', identifier.did)\n return identifier\n }\n\n async updateIdentifier(\n args: { did: string; kms?: string | undefined; alias?: string | undefined; options?: any },\n context: IAgentContext<IKeyManager>\n ): Promise<IIdentifier> {\n throw new Error('KeyDIDProvider updateIdentifier not supported yet.')\n }\n\n async deleteIdentifier(identifier: IIdentifier, context: IContext): Promise<boolean> {\n for (const { kid } of identifier.keys) {\n await context.agent.keyManagerDelete({ kid })\n }\n return true\n }\n\n async addKey({ identifier, key, options }: { identifier: IIdentifier; key: IKey; options?: any }, context: IContext): Promise<any> {\n throw Error('KeyDIDProvider addKey not supported')\n }\n\n async addService({ identifier, service, options }: { identifier: IIdentifier; service: IService; options?: any }, context: IContext): Promise<any> {\n throw Error('KeyDIDProvider addService not supported')\n }\n\n async removeKey(args: { identifier: IIdentifier; kid: string; options?: any }, context: IContext): Promise<any> {\n throw Error('KeyDIDProvider removeKey not supported')\n }\n\n async removeService(args: { identifier: IIdentifier; id: string; options?: any }, context: IContext): Promise<any> {\n throw Error('KeyDIDProvider removeService not supported')\n }\n}\n\ntype CodeNameType = Multicodec.CodecName | 'rsa-pub' | 'jwk_jcs-pub'\n","import { DIDResolutionOptions, DIDResolutionResult, DIDResolver, ParsedDID, Resolvable, Resolver } from 'did-resolver'\nimport { getResolver } from '@sphereon/ssi-sdk-ext.did-resolver-key'\n\nconst resolveDidKey: DIDResolver = async (\n didUrl: string,\n _parsed: ParsedDID,\n _resolver: Resolvable,\n options: DIDResolutionOptions\n): Promise<DIDResolutionResult> => {\n const resolver = new Resolver({ ...getResolver() })\n return resolver.resolve(didUrl, options)\n}\n\nexport function getDidKeyResolver() {\n return { key: resolveDidKey }\n}\n"],"mappings":";;;;AAAA,SACEA,8BACAC,kBACAC,oBACAC,cACAC,WAEAC,OACAC,mCACK;AAEP,SAASC,kCAAkC;AAC3C,OAAOC,WAAW;AAClB,OAAOC,eAAe;AACtB,OAAOC,gBAAgB;AAEvB,YAAYC,SAAS;AACrB,IAAM,EAAEC,YAAYC,SAAQ,IAAKC;AAEjC,IAAMC,QAAQC,MAAM,kBAAA;AAIpB,IAAMC,YAAY;EAChBC,KAAK;EACLC,SAAS;EACTC,QAAQ;EACRC,WAAW;EACXC,WAAW;EACXC,YAAY;EACZC,YAAY;AACd;AAEO,IAAMC,yBAAN,cAAqCC,2BAAAA;EAjC5C,OAiC4CA;;;EACzBC;EAEjBC,YAAYC,SAAkC;AAC5C,UAAK;AACL,SAAKF,MAAME,QAAQC;EACrB;EAEA,MAAMC,iBACJ,EACEJ,KACAK,OACAH,QAAO,G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B,UAAU,CAAA;IACZ;AACAjD,UAAM,WAAW4C,WAAWC,GAAG;AAC/B,WAAOD;EACT;EAEA,MAAMM,iBACJC,MACAjC,SACsB;AACtB,UAAM,IAAIyB,MAAM,oDAAA;EAClB;EAEA,MAAMS,iBAAiBR,YAAyB1B,SAAqC;AACnF,eAAW,EAAE6B,IAAG,KAAMH,WAAWI,MAAM;AACrC,YAAM9B,QAAQmC,MAAMC,iBAAiB;QAAEP;MAAI,CAAA;IAC7C;AACA,WAAO;EACT;EAEA,MAAMQ,OAAO,EAAEX,YAAYpB,KAAKV,QAAO,GAA2DI,SAAiC;AACjI,UAAMyB,MAAM,qCAAA;EACd;EAEA,MAAMa,WAAW,EAAEZ,YAAYa,SAAS3C,QAAO,GAAmEI,SAAiC;AACjJ,UAAMyB,MAAM,yCAAA;EACd;EAEA,MAAMe,UAAUP,MAA+DjC,SAAiC;AAC9G,UAAMyB,MAAM,wCAAA;EACd;EAEA,MAAMgB,cAAcR,MAA8DjC,SAAiC;AACjH,UAAMyB,MAAM,4CAAA;EACd;AACF;;;ACjJA,SAAwFiB,gBAAgB;AACxG,SAASC,mBAAmB;AAE5B,IAAMC,gBAA6B,8BACjCC,QACAC,SACAC,WACAC,YAAAA;AAEA,QAAMC,WAAW,IAAIC,SAAS;IAAE,GAAGC,YAAAA;EAAc,CAAA;AACjD,SAAOF,SAASG,QAAQP,QAAQG,OAAAA;AAClC,GARmC;AAU5B,SAASK,oBAAAA;AACd,SAAO;IAAEC,KAAKV;EAAc;AAC9B;AAFgBS;","names":["importProvidedOrGeneratedKey","JWK_JCS_PUB_NAME","JWK_JCS_PUB_PREFIX","jwkJcsEncode","JwkKeyUse","toJwk","toRawCompressedHexPublicKey","AbstractIdentifierProvider","Debug","Multibase","Multicodec","u8a","fromString","toString","u8a","debug","Debug","keyCodecs","RSA","Ed25519","X25519","Secp256k1","Secp256r1","Bls12381G1","Bls12381G2","SphereonKeyDidProvider","AbstractIdentifierProvider","kms","constructor","options","defaultKms","createIdentifier","alias","context","codecName","toUpperCase","JWK_JCS_PUB_NAME","keyType","type","key","importProvidedOrGeneratedKey","methodSpecificId","compressedPublicKeyHex","toRawCompressedHexPublicKey","publicKeyHex","jwk","toJwk","use","JwkKeyUse","Signature","noKidThumbprint","Multibase","encode","Multicodec","addPrefix","JWK_JCS_PUB_PREFIX","valueOf","jwkJcsEncode","Error","identifier","did","controllerKeyId","kid","keys","services","updateIdentifier","args","deleteIdentifier","agent","keyManagerDelete","addKey","addService","service","removeKey","removeService","Resolver","getResolver","resolveDidKey","didUrl","_parsed","_resolver","options","resolver","Resolver","getResolver","resolve","getDidKeyResolver","key"]}
package/package.json CHANGED
@@ -1,17 +1,29 @@
1
1
  {
2
2
  "name": "@sphereon/ssi-sdk-ext.did-provider-key",
3
3
  "description": "Sphereon SSI-SDK plugin for management of did:key identifiers.",
4
- "version": "0.27.1-next.6+7161cdc",
5
- "source": "src/index.ts",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
4
+ "version": "0.28.1-feature.esm.cjs.11+5582cc4",
5
+ "source": "./src/index.ts",
6
+ "type": "module",
7
+ "main": "./dist/index.cjs",
8
+ "module": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "require": "./dist/index.cjs"
18
+ }
19
+ },
8
20
  "scripts": {
9
- "build": "tsc",
21
+ "build": "tsup --config ../../tsup.config.ts --tsconfig ../../tsconfig.tsup.json",
10
22
  "extract-api": "sphereon dev extract-api"
11
23
  },
12
24
  "dependencies": {
13
- "@sphereon/ssi-sdk-ext.did-resolver-key": "0.27.1-next.6+7161cdc",
14
- "@sphereon/ssi-sdk-ext.key-utils": "0.27.1-next.6+7161cdc",
25
+ "@sphereon/ssi-sdk-ext.did-resolver-key": "^0.28.1-feature.esm.cjs.11+5582cc4",
26
+ "@sphereon/ssi-sdk-ext.key-utils": "^0.28.1-feature.esm.cjs.11+5582cc4",
15
27
  "@transmute/did-key-bls12381": "0.3.0-unstable.10",
16
28
  "@veramo/core": "4.2.0",
17
29
  "@veramo/did-manager": "4.2.0",
@@ -20,12 +32,12 @@
20
32
  "did-resolver": "^4.1.0",
21
33
  "multibase": "^4.0.6",
22
34
  "multicodec": "^3.2.1",
23
- "uint8arrays": "^3.1.1"
35
+ "uint8arrays": " 3.1.1"
24
36
  },
25
37
  "devDependencies": {
26
- "@sphereon/ssi-sdk-ext.key-manager": "0.27.1-next.6+7161cdc",
27
- "@sphereon/ssi-sdk-ext.kms-local": "0.27.1-next.6+7161cdc",
28
- "@sphereon/ssi-sdk.dev": "0.30.2-feature.SDK.41.oidf.support.286",
38
+ "@sphereon/ssi-sdk-ext.key-manager": "^0.28.1-feature.esm.cjs.11+5582cc4",
39
+ "@sphereon/ssi-sdk-ext.kms-local": "^0.28.1-feature.esm.cjs.11+5582cc4",
40
+ "@sphereon/ssi-sdk.dev": " ^0.33",
29
41
  "@veramo/did-resolver": "4.2.0",
30
42
  "@veramo/key-manager": "4.2.0"
31
43
  },
@@ -34,8 +46,8 @@
34
46
  "jsonld-signatures": "npm:@digitalcredentials/jsonld-signatures@^9.3.1"
35
47
  },
36
48
  "files": [
37
- "dist/**/*",
38
- "src/**/*",
49
+ "dist",
50
+ "src",
39
51
  "README.md",
40
52
  "LICENSE"
41
53
  ],
@@ -59,5 +71,5 @@
59
71
  "secp256r1",
60
72
  "RSA"
61
73
  ],
62
- "gitHead": "7161cdca6d24315f01b785ed437edb27ef49f0f3"
74
+ "gitHead": "5582cc49ffc25ef9cef9d3b42ff7aad59ca3a480"
63
75
  }
@@ -13,7 +13,9 @@ import { AbstractIdentifierProvider } from '@veramo/did-manager'
13
13
  import Debug from 'debug'
14
14
  import Multibase from 'multibase'
15
15
  import Multicodec from 'multicodec'
16
+ // @ts-ignore
16
17
  import * as u8a from 'uint8arrays'
18
+ const { fromString, toString } = u8a
17
19
 
18
20
  const debug = Debug('did-provider-key')
19
21
 
@@ -78,27 +80,25 @@ export class SphereonKeyDidProvider extends AbstractIdentifierProvider {
78
80
  let methodSpecificId: string | undefined
79
81
 
80
82
  // did:key uses compressed pub keys
81
- const compressedPublicKeyHex = toRawCompressedHexPublicKey(u8a.fromString(key.publicKeyHex, 'hex'), key.type)
83
+ const compressedPublicKeyHex = toRawCompressedHexPublicKey(fromString(key.publicKeyHex, 'hex'), key.type)
82
84
  if (codecName === JWK_JCS_PUB_NAME) {
83
85
  const jwk = toJwk(key.publicKeyHex, keyType, { use: JwkKeyUse.Signature, key, noKidThumbprint: true })
84
86
  // console.log(`FIXME JWK: ${JSON.stringify(toJwk(privateKeyHex, keyType, { use: JwkKeyUse.Signature, key, isPrivateKey: true }), null, 2)}`)
85
- methodSpecificId = u8a.toString(
86
- Multibase.encode('base58btc', Multicodec.addPrefix(u8a.fromString(JWK_JCS_PUB_PREFIX.valueOf().toString(16), 'hex'), jwkJcsEncode(jwk)))
87
+ methodSpecificId = toString(
88
+ Multibase.encode('base58btc', Multicodec.addPrefix(fromString(JWK_JCS_PUB_PREFIX.valueOf().toString(16), 'hex'), jwkJcsEncode(jwk)))
87
89
  )
88
90
  } else if (codecName) {
89
- methodSpecificId = u8a.toString(
90
- Multibase.encode('base58btc', Multicodec.addPrefix(codecName as Multicodec.CodecName, u8a.fromString(compressedPublicKeyHex, 'hex')))
91
+ methodSpecificId = toString(
92
+ Multibase.encode('base58btc', Multicodec.addPrefix(codecName as Multicodec.CodecName, fromString(compressedPublicKeyHex, 'hex')))
91
93
  )
92
94
  } else {
93
95
  codecName = keyCodecs[keyType]
94
96
 
95
97
  if (codecName) {
96
98
  // methodSpecificId = bytesToMultibase({bytes: u8a.fromString(key.publicKeyHex, 'hex'), codecName})
97
- methodSpecificId = u8a
98
- .toString(
99
- Multibase.encode('base58btc', Multicodec.addPrefix(codecName as Multicodec.CodecName, u8a.fromString(compressedPublicKeyHex, 'hex')))
100
- )
101
- .toString()
99
+ methodSpecificId = toString(
100
+ Multibase.encode('base58btc', Multicodec.addPrefix(codecName as Multicodec.CodecName, fromString(compressedPublicKeyHex, 'hex')))
101
+ ).toString()
102
102
  }
103
103
  }
104
104
  if (!methodSpecificId) {
@@ -1,5 +0,0 @@
1
- import { DIDResolver } from 'did-resolver';
2
- export declare function getDidKeyResolver(): {
3
- key: DIDResolver;
4
- };
5
- //# sourceMappingURL=KeyDidResolver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"KeyDidResolver.d.ts","sourceRoot":"","sources":["../src/KeyDidResolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6C,WAAW,EAAmC,MAAM,cAAc,CAAA;AAatH,wBAAgB,iBAAiB;;EAEhC"}
@@ -1,22 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getDidKeyResolver = getDidKeyResolver;
13
- const did_resolver_1 = require("did-resolver");
14
- const ssi_sdk_ext_did_resolver_key_1 = require("@sphereon/ssi-sdk-ext.did-resolver-key");
15
- const resolveDidKey = (didUrl, _parsed, _resolver, options) => __awaiter(void 0, void 0, void 0, function* () {
16
- const resolver = new did_resolver_1.Resolver(Object.assign({}, (0, ssi_sdk_ext_did_resolver_key_1.getResolver)()));
17
- return resolver.resolve(didUrl, options);
18
- });
19
- function getDidKeyResolver() {
20
- return { key: resolveDidKey };
21
- }
22
- //# sourceMappingURL=KeyDidResolver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"KeyDidResolver.js","sourceRoot":"","sources":["../src/KeyDidResolver.ts"],"names":[],"mappings":";;;;;;;;;;;AAaA,8CAEC;AAfD,+CAAsH;AACtH,yFAAoE;AAEpE,MAAM,aAAa,GAAgB,CACjC,MAAc,EACd,OAAkB,EAClB,SAAqB,EACrB,OAA6B,EACC,EAAE;IAChC,MAAM,QAAQ,GAAG,IAAI,uBAAQ,mBAAM,IAAA,0CAAW,GAAE,EAAG,CAAA;IACnD,OAAO,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAC1C,CAAC,CAAA,CAAA;AAED,SAAgB,iBAAiB;IAC/B,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,CAAA;AAC/B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SphereonKeyDidProvider.d.ts","sourceRoot":"","sources":["../src/SphereonKeyDidProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,QAAQ,EAGT,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACtF,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAA;AAGhE,OAAO,UAAU,MAAM,YAAY,CAAA;AAKnC,KAAK,QAAQ,GAAG,aAAa,CAAC,WAAW,CAAC,CAAA;AAY1C,qBAAa,sBAAuB,SAAQ,0BAA0B;IACpE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAQ;gBAEjB,OAAO,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE;IAKtC,gBAAgB,CACpB,EACE,GAAG,EACH,KAAK,EACL,OAAO,GACR,EAAE;QACD,GAAG,CAAC,EAAE,MAAM,CAAA;QACZ,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,OAAO,CAAC,EAAE;YACR,IAAI,CAAC,EAAE,QAAQ,CA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AAC;QAAC,OAAO,CAAC,EAAE,GAAG,CAAA;KAAE,EAAE,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;IAIzG,aAAa,CAAC,IAAI,EAAE;QAAE,UAAU,EAAE,WAAW,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,GAAG,CAAA;KAAE,EAAE,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;CAGnH"}
@@ -1,140 +0,0 @@
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
- var __importDefault = (this && this.__importDefault) || function (mod) {
35
- return (mod && mod.__esModule) ? mod : { "default": mod };
36
- };
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.SphereonKeyDidProvider = void 0;
39
- const ssi_sdk_ext_key_utils_1 = require("@sphereon/ssi-sdk-ext.key-utils");
40
- const did_manager_1 = require("@veramo/did-manager");
41
- const debug_1 = __importDefault(require("debug"));
42
- const multibase_1 = __importDefault(require("multibase"));
43
- const multicodec_1 = __importDefault(require("multicodec"));
44
- const u8a = __importStar(require("uint8arrays"));
45
- const debug = (0, debug_1.default)('did-provider-key');
46
- const keyCodecs = {
47
- RSA: 'rsa-pub',
48
- Ed25519: 'ed25519-pub',
49
- X25519: 'x25519-pub',
50
- Secp256k1: 'secp256k1-pub',
51
- Secp256r1: 'p256-pub',
52
- Bls12381G1: 'bls12_381-g1-pub',
53
- Bls12381G2: 'bls12_381-g2-pub',
54
- };
55
- class SphereonKeyDidProvider extends did_manager_1.AbstractIdentifierProvider {
56
- constructor(options) {
57
- super();
58
- this.kms = options.defaultKms;
59
- }
60
- createIdentifier(_a, context_1) {
61
- return __awaiter(this, arguments, void 0, function* ({ kms, alias, options, }, context) {
62
- var _b, _c, _d, _e;
63
- let codecName = (((_b = options === null || options === void 0 ? void 0 : options.codecName) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === 'EBSI' ? ssi_sdk_ext_key_utils_1.JWK_JCS_PUB_NAME : options === null || options === void 0 ? void 0 : options.codecName);
64
- const keyType = ((_e = (_c = options === null || options === void 0 ? void 0 : options.type) !== null && _c !== void 0 ? _c : (_d = options === null || options === void 0 ? void 0 : options.key) === null || _d === void 0 ? void 0 : _d.type) !== null && _e !== void 0 ? _e : (codecName === ssi_sdk_ext_key_utils_1.JWK_JCS_PUB_NAME ? 'Secp256r1' : 'Secp256k1'));
65
- // console.log(`keytype: ${keyType}, codecName: ${codecName}`)
66
- const key = yield (0, ssi_sdk_ext_key_utils_1.importProvidedOrGeneratedKey)({
67
- // @ts-ignore
68
- kms: kms !== null && kms !== void 0 ? kms : this.kms,
69
- alias: alias,
70
- options: Object.assign(Object.assign({}, options), { type: keyType }),
71
- }, context);
72
- let methodSpecificId;
73
- // did:key uses compressed pub keys
74
- const compressedPublicKeyHex = (0, ssi_sdk_ext_key_utils_1.toRawCompressedHexPublicKey)(u8a.fromString(key.publicKeyHex, 'hex'), key.type);
75
- if (codecName === ssi_sdk_ext_key_utils_1.JWK_JCS_PUB_NAME) {
76
- const jwk = (0, ssi_sdk_ext_key_utils_1.toJwk)(key.publicKeyHex, keyType, { use: ssi_sdk_ext_key_utils_1.JwkKeyUse.Signature, key, noKidThumbprint: true });
77
- // console.log(`FIXME JWK: ${JSON.stringify(toJwk(privateKeyHex, keyType, { use: JwkKeyUse.Signature, key, isPrivateKey: true }), null, 2)}`)
78
- methodSpecificId = u8a.toString(multibase_1.default.encode('base58btc', multicodec_1.default.addPrefix(u8a.fromString(ssi_sdk_ext_key_utils_1.JWK_JCS_PUB_PREFIX.valueOf().toString(16), 'hex'), (0, ssi_sdk_ext_key_utils_1.jwkJcsEncode)(jwk))));
79
- }
80
- else if (codecName) {
81
- methodSpecificId = u8a.toString(multibase_1.default.encode('base58btc', multicodec_1.default.addPrefix(codecName, u8a.fromString(compressedPublicKeyHex, 'hex'))));
82
- }
83
- else {
84
- codecName = keyCodecs[keyType];
85
- if (codecName) {
86
- // methodSpecificId = bytesToMultibase({bytes: u8a.fromString(key.publicKeyHex, 'hex'), codecName})
87
- methodSpecificId = u8a
88
- .toString(multibase_1.default.encode('base58btc', multicodec_1.default.addPrefix(codecName, u8a.fromString(compressedPublicKeyHex, 'hex'))))
89
- .toString();
90
- }
91
- }
92
- if (!methodSpecificId) {
93
- throw Error(`Key type ${keyType}, codec ${codecName} is not supported currently for did:key`);
94
- }
95
- const identifier = {
96
- did: `did:key:${methodSpecificId}`,
97
- controllerKeyId: key.kid,
98
- keys: [key],
99
- services: [],
100
- };
101
- debug('Created', identifier.did);
102
- return identifier;
103
- });
104
- }
105
- updateIdentifier(args, context) {
106
- return __awaiter(this, void 0, void 0, function* () {
107
- throw new Error('KeyDIDProvider updateIdentifier not supported yet.');
108
- });
109
- }
110
- deleteIdentifier(identifier, context) {
111
- return __awaiter(this, void 0, void 0, function* () {
112
- for (const { kid } of identifier.keys) {
113
- yield context.agent.keyManagerDelete({ kid });
114
- }
115
- return true;
116
- });
117
- }
118
- addKey(_a, context_1) {
119
- return __awaiter(this, arguments, void 0, function* ({ identifier, key, options }, context) {
120
- throw Error('KeyDIDProvider addKey not supported');
121
- });
122
- }
123
- addService(_a, context_1) {
124
- return __awaiter(this, arguments, void 0, function* ({ identifier, service, options }, context) {
125
- throw Error('KeyDIDProvider addService not supported');
126
- });
127
- }
128
- removeKey(args, context) {
129
- return __awaiter(this, void 0, void 0, function* () {
130
- throw Error('KeyDIDProvider removeKey not supported');
131
- });
132
- }
133
- removeService(args, context) {
134
- return __awaiter(this, void 0, void 0, function* () {
135
- throw Error('KeyDIDProvider removeService not supported');
136
- });
137
- }
138
- }
139
- exports.SphereonKeyDidProvider = SphereonKeyDidProvider;
140
- //# sourceMappingURL=SphereonKeyDidProvider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SphereonKeyDidProvider.js","sourceRoot":"","sources":["../src/SphereonKeyDidProvider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2EASwC;AAExC,qDAAgE;AAChE,kDAAyB;AACzB,0DAAiC;AACjC,4DAAmC;AACnC,iDAAkC;AAElC,MAAM,KAAK,GAAG,IAAA,eAAK,EAAC,kBAAkB,CAAC,CAAA;AAIvC,MAAM,SAAS,GAAG;IAChB,GAAG,EAAE,SAAS;IACd,OAAO,EAAE,aAAa;IACtB,MAAM,EAAE,YAAY;IACpB,SAAS,EAAE,eAAe;IAC1B,SAAS,EAAE,UAAU;IACrB,UAAU,EAAE,kBAAkB;IAC9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BAAiB,EAAE,MAAM,kBAAkB,CAAA"}
@@ -1,63 +0,0 @@
1
- import { AbstractIdentifierProvider } from '@veramo/did-manager';
2
- import { DIDResolver } from 'did-resolver';
3
- import { IAgentContext } from '@veramo/core';
4
- import { IIdentifier } from '@veramo/core';
5
- import { IKey } from '@veramo/core';
6
- import { IKeyManager } from '@veramo/core';
7
- import { IService } from '@veramo/core';
8
- import Multicodec from 'multicodec';
9
- import { TKeyType } from '@sphereon/ssi-sdk-ext.key-utils';
10
-
11
- export declare function getDidKeyResolver(): {
12
- key: DIDResolver;
13
- };
14
-
15
- declare type IContext = IAgentContext<IKeyManager>;
16
-
17
- export declare class SphereonKeyDidProvider extends AbstractIdentifierProvider {
18
- private readonly kms?;
19
- constructor(options: {
20
- defaultKms?: string;
21
- });
22
- createIdentifier({ kms, alias, options, }: {
23
- kms?: string;
24
- alias?: string;
25
- options?: {
26
- type?: TKeyType;
27
- codecName?: 'EBSI' | 'jwk_jcs-pub' | Multicodec.CodecName;
28
- key?: {
29
- type?: Exclude<TKeyType, 'Secp384r1' | 'Secp521r1'>;
30
- privateKeyHex: string;
31
- };
32
- };
33
- }, context: IContext): Promise<Omit<IIdentifier, 'provider'>>;
34
- updateIdentifier(args: {
35
- did: string;
36
- kms?: string | undefined;
37
- alias?: string | undefined;
38
- options?: any;
39
- }, context: IAgentContext<IKeyManager>): Promise<IIdentifier>;
40
- deleteIdentifier(identifier: IIdentifier, context: IContext): Promise<boolean>;
41
- addKey({ identifier, key, options }: {
42
- identifier: IIdentifier;
43
- key: IKey;
44
- options?: any;
45
- }, context: IContext): Promise<any>;
46
- addService({ identifier, service, options }: {
47
- identifier: IIdentifier;
48
- service: IService;
49
- options?: any;
50
- }, context: IContext): Promise<any>;
51
- removeKey(args: {
52
- identifier: IIdentifier;
53
- kid: string;
54
- options?: any;
55
- }, context: IContext): Promise<any>;
56
- removeService(args: {
57
- identifier: IIdentifier;
58
- id: string;
59
- options?: any;
60
- }, context: IContext): Promise<any>;
61
- }
62
-
63
- export { }
@@ -1,11 +0,0 @@
1
- // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
- // It should be published with your NPM package. It should not be tracked by Git.
3
- {
4
- "tsdocVersion": "0.12",
5
- "toolPackages": [
6
- {
7
- "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.47.11"
9
- }
10
- ]
11
- }