@sphereon/ssi-sdk-ext.did-resolver-key 0.13.0 → 0.13.1-unstable.3
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/drivers/bls12381g2.js +3 -30
- package/dist/drivers/bls12381g2.js.map +1 -1
- package/dist/drivers/ed25519.js +44 -53
- package/dist/drivers/ed25519.js.map +1 -1
- package/dist/drivers/jwk.jcs.js +17 -13
- package/dist/drivers/jwk.jcs.js.map +1 -1
- package/dist/drivers/secp256k1.js +3 -30
- package/dist/drivers/secp256k1.js.map +1 -1
- package/dist/drivers/secp256r1.js +5 -33
- package/dist/drivers/secp256r1.js.map +1 -1
- package/dist/drivers/secp384r1.js +5 -33
- package/dist/drivers/secp384r1.js.map +1 -1
- package/dist/drivers/secp521r1.js +5 -33
- package/dist/drivers/secp521r1.js.map +1 -1
- package/dist/index.js +29 -59
- package/dist/index.js.map +1 -1
- package/dist/types.js +2 -5
- package/dist/types.js.map +1 -1
- package/package.json +4 -3
|
@@ -1,31 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.keyToDidDoc = void 0;
|
|
27
|
-
const u8a = __importStar(require("uint8arrays"));
|
|
28
|
-
const keyToDidDoc = ({ pubKeyBytes, fingerprint }) => {
|
|
1
|
+
import * as u8a from 'uint8arrays';
|
|
2
|
+
export const keyToDidDoc = ({ pubKeyBytes, fingerprint }) => {
|
|
29
3
|
const did = `did:key:${fingerprint}`;
|
|
30
4
|
const keyId = `${did}#${fingerprint}`;
|
|
31
5
|
return {
|
|
@@ -44,6 +18,5 @@ const keyToDidDoc = ({ pubKeyBytes, fingerprint }) => {
|
|
|
44
18
|
capabilityInvocation: [keyId],
|
|
45
19
|
};
|
|
46
20
|
};
|
|
47
|
-
|
|
48
|
-
exports.default = { keyToDidDoc: exports.keyToDidDoc };
|
|
21
|
+
export default { keyToDidDoc };
|
|
49
22
|
//# sourceMappingURL=bls12381g2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bls12381g2.js","sourceRoot":"","sources":["../../src/drivers/bls12381g2.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bls12381g2.js","sourceRoot":"","sources":["../../src/drivers/bls12381g2.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,aAAa,CAAA;AAGlC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAE,WAAW,EAAE,WAAW,EAAmB,EAAe,EAAE;IACxF,MAAM,GAAG,GAAG,WAAW,WAAW,EAAE,CAAA;IACpC,MAAM,KAAK,GAAG,GAAG,GAAG,IAAI,WAAW,EAAE,CAAA;IACrC,OAAO;QACL,EAAE,EAAE,GAAG;QACP,kBAAkB,EAAE;YAClB;gBACE,EAAE,EAAE,KAAK;gBACT,IAAI,EAAE,mBAAmB;gBACzB,UAAU,EAAE,GAAG;gBACf,eAAe,EAAE,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;aACxD;SACF;QACD,cAAc,EAAE,CAAC,KAAK,CAAC;QACvB,eAAe,EAAE,CAAC,KAAK,CAAC;QACxB,oBAAoB,EAAE,CAAC,KAAK,CAAC;QAC7B,oBAAoB,EAAE,CAAC,KAAK,CAAC;KAC9B,CAAA;AACH,CAAC,CAAA;AACD,eAAe,EAAE,WAAW,EAAE,CAAA"}
|
package/dist/drivers/ed25519.js
CHANGED
|
@@ -1,45 +1,19 @@
|
|
|
1
|
-
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.keyToDidDoc = void 0;
|
|
27
|
-
const u8a = __importStar(require("uint8arrays"));
|
|
1
|
+
import * as u8a from 'uint8arrays';
|
|
28
2
|
// import { edwardsToMontgomery } from '@noble/curves/ed25519'
|
|
29
|
-
|
|
30
|
-
|
|
3
|
+
import { convertPublicKeyToX25519 } from '@stablelib/ed25519';
|
|
4
|
+
import { DID_LD_JSON } from '../types';
|
|
31
5
|
function encodeKey(key, encodeKey) {
|
|
32
6
|
const bytes = new Uint8Array(key.length + 2);
|
|
33
|
-
bytes[0] = encodeKey
|
|
7
|
+
bytes[0] = encodeKey ?? 0xec;
|
|
34
8
|
// The multicodec is encoded as a varint so we need to add this.
|
|
35
9
|
// See js-multicodec for a general implementation
|
|
36
10
|
bytes[1] = 0x01;
|
|
37
11
|
bytes.set(key, 2);
|
|
38
12
|
return `z${u8a.toString(bytes, 'base58btc')}`;
|
|
39
13
|
}
|
|
40
|
-
const keyToDidDoc = (args) => {
|
|
14
|
+
export const keyToDidDoc = (args) => {
|
|
41
15
|
const { options } = args;
|
|
42
|
-
if (!
|
|
16
|
+
if (!options?.publicKeyFormat) {
|
|
43
17
|
return keyToDidDoc2020(args);
|
|
44
18
|
}
|
|
45
19
|
switch (options.publicKeyFormat) {
|
|
@@ -54,22 +28,24 @@ const keyToDidDoc = (args) => {
|
|
|
54
28
|
throw Error(`${options.publicKeyFormat} not supported yet for the ed25519 driver`);
|
|
55
29
|
}
|
|
56
30
|
};
|
|
57
|
-
exports.keyToDidDoc = keyToDidDoc;
|
|
58
31
|
const keyToDidDoc2018_2019 = ({ pubKeyBytes, fingerprint, contentType }) => {
|
|
59
32
|
const did = `did:key:${fingerprint}`;
|
|
60
33
|
const keyId = `${did}#${fingerprint}`;
|
|
61
34
|
//todo: Move to noble lib. x25519 values differ between below methods. Current implementation is correct according to DID:key spec
|
|
62
35
|
// const pubKeyHex = u8a.toString(pubKeyBytes, 'base16')
|
|
63
36
|
// const x25519PubBytes = edwardsToMontgomery(pubKeyHex)
|
|
64
|
-
const x25519PubBytes =
|
|
37
|
+
const x25519PubBytes = convertPublicKeyToX25519(pubKeyBytes);
|
|
65
38
|
const x25519KeyId = `${did}#${encodeKey(x25519PubBytes)}`;
|
|
66
|
-
return
|
|
67
|
-
|
|
68
|
-
'
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
39
|
+
return {
|
|
40
|
+
...(contentType === DID_LD_JSON && {
|
|
41
|
+
'@context': [
|
|
42
|
+
'https://www.w3.org/ns/did/v1',
|
|
43
|
+
'https://w3id.org/security/suites/ed25519-2018/v1',
|
|
44
|
+
'https://w3id.org/security/suites/x25519-2019/v1',
|
|
45
|
+
],
|
|
46
|
+
}),
|
|
47
|
+
id: did,
|
|
48
|
+
verificationMethod: [
|
|
73
49
|
{
|
|
74
50
|
id: keyId,
|
|
75
51
|
type: 'Ed25519VerificationKey2018',
|
|
@@ -82,7 +58,13 @@ const keyToDidDoc2018_2019 = ({ pubKeyBytes, fingerprint, contentType }) => {
|
|
|
82
58
|
controller: did,
|
|
83
59
|
publicKeyBase58: u8a.toString(x25519PubBytes, 'base58btc'),
|
|
84
60
|
},
|
|
85
|
-
],
|
|
61
|
+
],
|
|
62
|
+
authentication: [keyId],
|
|
63
|
+
assertionMethod: [keyId],
|
|
64
|
+
capabilityDelegation: [keyId],
|
|
65
|
+
capabilityInvocation: [keyId],
|
|
66
|
+
keyAgreement: [x25519KeyId],
|
|
67
|
+
};
|
|
86
68
|
};
|
|
87
69
|
const keyToDidDoc2020 = ({ pubKeyBytes, fingerprint, contentType }) => {
|
|
88
70
|
const did = `did:key:${fingerprint}`;
|
|
@@ -90,29 +72,38 @@ const keyToDidDoc2020 = ({ pubKeyBytes, fingerprint, contentType }) => {
|
|
|
90
72
|
//todo: Move to noble lib. x25519 values differ between below methods. Current implementation is correct according to DID:key spec
|
|
91
73
|
// const pubKeyHex = u8a.toString(pubKeyBytes, 'base16')
|
|
92
74
|
// const x25519PubBytes = edwardsToMontgomery(pubKeyBytes)
|
|
93
|
-
const x25519PubBytes =
|
|
75
|
+
const x25519PubBytes = convertPublicKeyToX25519(pubKeyBytes);
|
|
94
76
|
const x25519KeyId = `${did}#${encodeKey(x25519PubBytes)}`;
|
|
95
|
-
return
|
|
96
|
-
|
|
97
|
-
'
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
77
|
+
return {
|
|
78
|
+
...(contentType === DID_LD_JSON && {
|
|
79
|
+
'@context': [
|
|
80
|
+
'https://www.w3.org/ns/did/v1',
|
|
81
|
+
'https://w3id.org/security/suites/ed25519-2020/v1',
|
|
82
|
+
'https://w3id.org/security/suites/x25519-2020/v1',
|
|
83
|
+
],
|
|
84
|
+
}),
|
|
85
|
+
id: did,
|
|
86
|
+
verificationMethod: [
|
|
102
87
|
{
|
|
103
88
|
id: keyId,
|
|
104
89
|
type: 'Ed25519VerificationKey2020',
|
|
105
90
|
controller: did,
|
|
106
91
|
publicKeyMultibase: encodeKey(pubKeyBytes, 0xed),
|
|
107
92
|
},
|
|
108
|
-
],
|
|
93
|
+
],
|
|
94
|
+
authentication: [keyId],
|
|
95
|
+
assertionMethod: [keyId],
|
|
96
|
+
capabilityDelegation: [keyId],
|
|
97
|
+
capabilityInvocation: [keyId],
|
|
98
|
+
keyAgreement: [
|
|
109
99
|
{
|
|
110
100
|
id: x25519KeyId,
|
|
111
101
|
type: 'X25519KeyAgreementKey2020',
|
|
112
102
|
controller: did,
|
|
113
103
|
publicKeyMultibase: encodeKey(x25519PubBytes, 0xec),
|
|
114
104
|
},
|
|
115
|
-
]
|
|
105
|
+
],
|
|
106
|
+
};
|
|
116
107
|
};
|
|
117
|
-
|
|
108
|
+
export default { keyToDidDoc };
|
|
118
109
|
//# sourceMappingURL=ed25519.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ed25519.js","sourceRoot":"","sources":["../../src/drivers/ed25519.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ed25519.js","sourceRoot":"","sources":["../../src/drivers/ed25519.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,aAAa,CAAA;AAElC,8DAA8D;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAmB,MAAM,UAAU,CAAA;AAEvD,SAAS,SAAS,CAAC,GAAe,EAAE,SAAkB;IACpD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IAC5C,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,IAAI,IAAI,CAAA;IAC5B,gEAAgE;IAChE,iDAAiD;IACjD,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;IACf,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;IACjB,OAAO,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,EAAE,CAAA;AAC/C,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAqB,EAAE,EAAE;IACnD,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;IACxB,IAAI,CAAC,OAAO,EAAE,eAAe,EAAE;QAC7B,OAAO,eAAe,CAAC,IAAI,CAAC,CAAA;KAC7B;IACD,QAAQ,OAAO,CAAC,eAAe,EAAE;QAC/B,KAAK,4BAA4B,CAAC;QAClC,KAAK,2BAA2B;YAC9B,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAA;QACnC,KAAK,4BAA4B,CAAC;QAClC,KAAK,2BAA2B,CAAC;QACjC,KAAK,UAAU;YACb,OAAO,eAAe,CAAC,IAAI,CAAC,CAAA;QAC9B;YACE,MAAM,KAAK,CAAC,GAAG,OAAO,CAAC,eAAe,2CAA2C,CAA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W,EAAE,CAAA;IACpC,MAAM,KAAK,GAAG,GAAG,GAAG,IAAI,WAAW,EAAE,CAAA;IACrC,kIAAkI;IAClI,wDAAwD;IACxD,0DAA0D;IAC1D,MAAM,cAAc,GAAG,wBAAwB,CAAC,WAAW,CAAC,CAAA;IAE5D,MAAM,WAAW,GAAG,GAAG,GAAG,IAAI,SAAS,CAAC,cAAc,CAAC,EAAE,CAAA;IACzD,OAAO;QACL,GAAG,CAAC,WAAW,KAAK,WAAW,IAAI;YACjC,UAAU,EAAE;gBACV,8BAA8B;gBAC9B,kDAAkD;gBAClD,iDAAiD;aAClD;SACF,CAAC;QACF,EAAE,EAAE,GAAG;QACP,kBAAkB,EAAE;YAClB;gBACE,EAAE,EAAE,KAAK;gBACT,IAAI,EAAE,4BAA4B;gBAClC,UAAU,EAAE,GAAG;gBACf,kBAAkB,EAAE,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC;aACjD;SACF;QACD,cAAc,EAAE,CAAC,KAAK,CAAC;QACvB,eAAe,EAAE,CAAC,KAAK,CAAC;QACxB,oBAAoB,EAAE,CAAC,KAAK,CAAC;QAC7B,oBAAoB,EAAE,CAAC,KAAK,CAAC;QAC7B,YAAY,EAAE;YACZ;gBACE,EAAE,EAAE,WAAW;gBACf,IAAI,EAAE,2BAA2B;gBACjC,UAAU,EAAE,GAAG;gBACf,kBAAkB,EAAE,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC;aACpD;SACF;KACF,CAAA;AACH,CAAC,CAAA;AACD,eAAe,EAAE,WAAW,EAAE,CAAA"}
|
package/dist/drivers/jwk.jcs.js
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const index_1 = require("../index");
|
|
5
|
-
const ssi_sdk_ext_key_utils_1 = require("@sphereon/ssi-sdk-ext.key-utils");
|
|
6
|
-
const keyToDidDoc = ({ pubKeyBytes, fingerprint, contentType }) => {
|
|
1
|
+
import { DID_LD_JSON } from '../index';
|
|
2
|
+
import { jwkJcsDecode } from '@sphereon/ssi-sdk-ext.key-utils';
|
|
3
|
+
export const keyToDidDoc = ({ pubKeyBytes, fingerprint, contentType }) => {
|
|
7
4
|
const did = `did:key:${fingerprint}`;
|
|
8
5
|
const keyId = `${did}#${fingerprint}`;
|
|
9
|
-
const publicKeyJwk =
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
const publicKeyJwk = jwkJcsDecode(pubKeyBytes);
|
|
7
|
+
return {
|
|
8
|
+
...(contentType === DID_LD_JSON && {
|
|
9
|
+
'@context': ['https://www.w3.org/ns/did/v1', 'https://w3id.org/security/suites/jws-2020/v1'],
|
|
10
|
+
}),
|
|
11
|
+
id: did,
|
|
12
|
+
verificationMethod: [
|
|
13
13
|
{
|
|
14
14
|
id: keyId,
|
|
15
15
|
type: 'JsonWebKey2020',
|
|
16
16
|
controller: did,
|
|
17
17
|
publicKeyJwk,
|
|
18
18
|
},
|
|
19
|
-
],
|
|
19
|
+
],
|
|
20
|
+
authentication: [keyId],
|
|
21
|
+
assertionMethod: [keyId],
|
|
22
|
+
capabilityDelegation: [keyId],
|
|
23
|
+
capabilityInvocation: [keyId],
|
|
24
|
+
};
|
|
20
25
|
};
|
|
21
|
-
|
|
22
|
-
exports.default = { keyToDidDoc: exports.keyToDidDoc };
|
|
26
|
+
export default { keyToDidDoc };
|
|
23
27
|
//# sourceMappingURL=jwk.jcs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jwk.jcs.js","sourceRoot":"","sources":["../../src/drivers/jwk.jcs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"jwk.jcs.js","sourceRoot":"","sources":["../../src/drivers/jwk.jcs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAmB,MAAM,UAAU,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAE9D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAmB,EAAe,EAAE;IACrG,MAAM,GAAG,GAAG,WAAW,WAAW,EAAE,CAAA;IACpC,MAAM,KAAK,GAAG,GAAG,GAAG,IAAI,WAAW,EAAE,CAAA;IACrC,MAAM,YAAY,GAAG,YAAY,CAAC,WAAW,CAAC,CAAA;IAC9C,OAAO;QACL,GAAG,CAAC,WAAW,KAAK,WAAW,IAAI;YACjC,UAAU,EAAE,CAAC,8BAA8B,EAAE,8CAA8C,CAAC;SAC7F,CAAC;QACF,EAAE,EAAE,GAAG;QACP,kBAAkB,EAAE;YAClB;gBACE,EAAE,EAAE,KAAK;gBACT,IAAI,EAAE,gBAAgB;gBACtB,UAAU,EAAE,GAAG;gBACf,YAAY;aACb;SACF;QACD,cAAc,EAAE,CAAC,KAAK,CAAC;QACvB,eAAe,EAAE,CAAC,KAAK,CAAC;QACxB,oBAAoB,EAAE,CAAC,KAAK,CAAC;QAC7B,oBAAoB,EAAE,CAAC,KAAK,CAAC;KAC9B,CAAA;AACH,CAAC,CAAA;AACD,eAAe,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -1,31 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.keyToDidDoc = void 0;
|
|
27
|
-
const u8a = __importStar(require("uint8arrays"));
|
|
28
|
-
const keyToDidDoc = ({ pubKeyBytes, fingerprint }) => {
|
|
1
|
+
import * as u8a from 'uint8arrays';
|
|
2
|
+
export const keyToDidDoc = ({ pubKeyBytes, fingerprint }) => {
|
|
29
3
|
const did = `did:key:${fingerprint}`;
|
|
30
4
|
const keyId = `${did}#${fingerprint}`;
|
|
31
5
|
return {
|
|
@@ -44,6 +18,5 @@ const keyToDidDoc = ({ pubKeyBytes, fingerprint }) => {
|
|
|
44
18
|
capabilityInvocation: [keyId],
|
|
45
19
|
};
|
|
46
20
|
};
|
|
47
|
-
|
|
48
|
-
exports.default = { keyToDidDoc: exports.keyToDidDoc };
|
|
21
|
+
export default { keyToDidDoc };
|
|
49
22
|
//# sourceMappingURL=secp256k1.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secp256k1.js","sourceRoot":"","sources":["../../src/drivers/secp256k1.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"secp256k1.js","sourceRoot":"","sources":["../../src/drivers/secp256k1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,aAAa,CAAA;AAIlC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAE,WAAW,EAAE,WAAW,EAAmB,EAAe,EAAE;IACxF,MAAM,GAAG,GAAG,WAAW,WAAW,EAAE,CAAA;IACpC,MAAM,KAAK,GAAG,GAAG,GAAG,IAAI,WAAW,EAAE,CAAA;IACrC,OAAO;QACL,EAAE,EAAE,GAAG;QACP,kBAAkB,EAAE;YAClB;gBACE,EAAE,EAAE,KAAK;gBACT,IAAI,EAAE,8BAA8B;gBACpC,UAAU,EAAE,GAAG;gBACf,eAAe,EAAE,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;aACxD;SACF;QACD,cAAc,EAAE,CAAC,KAAK,CAAC;QACvB,eAAe,EAAE,CAAC,KAAK,CAAC;QACxB,oBAAoB,EAAE,CAAC,KAAK,CAAC;QAC7B,oBAAoB,EAAE,CAAC,KAAK,CAAC;KAC9B,CAAA;AACH,CAAC,CAAA;AAED,eAAe,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -1,36 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Brent Shambaugh <brent.shambaugh@gmail.com>. 2021.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.pubKeyBytesToXY = exports.keyToDidDoc = void 0;
|
|
28
|
-
const u8a = __importStar(require("uint8arrays"));
|
|
29
|
-
const nist_weierstrauss = __importStar(require("nist-weierstrauss"));
|
|
2
|
+
import * as u8a from 'uint8arrays';
|
|
3
|
+
import * as nist_weierstrauss from 'nist-weierstrauss';
|
|
30
4
|
/**
|
|
31
5
|
* Constructs the document based on the method key
|
|
32
6
|
*/
|
|
33
|
-
function keyToDidDoc({ pubKeyBytes, fingerprint }) {
|
|
7
|
+
export function keyToDidDoc({ pubKeyBytes, fingerprint }) {
|
|
34
8
|
const did = `did:key:${fingerprint}`;
|
|
35
9
|
const keyId = `${did}#${fingerprint}`;
|
|
36
10
|
const key = pubKeyBytesToXY(pubKeyBytes);
|
|
@@ -55,7 +29,6 @@ function keyToDidDoc({ pubKeyBytes, fingerprint }) {
|
|
|
55
29
|
capabilityInvocation: [keyId],
|
|
56
30
|
};
|
|
57
31
|
}
|
|
58
|
-
exports.keyToDidDoc = keyToDidDoc;
|
|
59
32
|
/**
|
|
60
33
|
*
|
|
61
34
|
* @param pubKeyBytes - public key as uncompressed byte array with no prefix (raw key),
|
|
@@ -68,7 +41,7 @@ exports.keyToDidDoc = keyToDidDoc;
|
|
|
68
41
|
* @throws Error: Unexpected pubKeyBytes
|
|
69
42
|
* @internal
|
|
70
43
|
*/
|
|
71
|
-
function pubKeyBytesToXY(pubKeyBytes) {
|
|
44
|
+
export function pubKeyBytesToXY(pubKeyBytes) {
|
|
72
45
|
if (!nist_weierstrauss.nist_weierstrauss_common.testUint8Array(pubKeyBytes)) {
|
|
73
46
|
throw new TypeError('input must be a Uint8Array');
|
|
74
47
|
}
|
|
@@ -95,6 +68,5 @@ function pubKeyBytesToXY(pubKeyBytes) {
|
|
|
95
68
|
}
|
|
96
69
|
throw new Error('Unexpected pubKeyBytes');
|
|
97
70
|
}
|
|
98
|
-
|
|
99
|
-
exports.default = { keyToDidDoc };
|
|
71
|
+
export default { keyToDidDoc };
|
|
100
72
|
//# sourceMappingURL=secp256r1.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secp256r1.js","sourceRoot":"","sources":["../../src/drivers/secp256r1.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"secp256r1.js","sourceRoot":"","sources":["../../src/drivers/secp256r1.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAErD,OAAO,KAAK,GAAG,MAAM,aAAa,CAAA;AAElC,OAAO,KAAK,iBAAiB,MAAM,mBAAmB,CAAA;AAItD;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,WAAW,EAAE,WAAW,EAAmB;IACvE,MAAM,GAAG,GAAG,WAAW,WAAW,EAAE,CAAA;IACpC,MAAM,KAAK,GAAG,GAAG,GAAG,IAAI,WAAW,EAAE,CAAA;IACrC,MAAM,GAAG,GAAG,eAAe,CAAC,WAAW,CAAC,CAAA;IACxC,OAAO;QACL,EAAE,EAAE,GAAG;QACP,kBAAkB,EAAE;YAClB;gBACE,EAAE,EAAE,KAAK;gBACT,IAAI,EAAE,gBAAgB;gBACtB,UAAU,EAAE,GAAG;gBACf,YAAY,EAAE;oBACZ,GAAG,EAAE,IAAI;oBACT,GAAG,EAAE,OAAO;oBACZ,CAAC,EAAE,GAAG,CAAC,EAAE;oBACT,CAAC,EAAE,GAAG,CAAC,EAAE;iBACV;aACF;SACF;QACD,cAAc,EAAE,CAAC,KAAK,CAAC;QACvB,eAAe,EAAE,CAAC,KAAK,CAAC;QACxB,oBAAoB,EAAE,CAAC,KAAK,CAAC;QAC7B,oBAAoB,EAAE,CAAC,KAAK,CAAC;KAC9B,CAAA;AACH,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,eAAe,CAAC,WAAuB;IACrD,IAAI,CAAC,iBAAiB,CA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
|
-
"use strict";
|
|
2
1
|
// Brent Shambaugh <brent.shambaugh@gmail.com>. 2021.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.pubKeyBytesToXY = exports.keyToDidDoc = void 0;
|
|
28
|
-
const u8a = __importStar(require("uint8arrays"));
|
|
29
|
-
const nist_weierstrauss = __importStar(require("nist-weierstrauss"));
|
|
2
|
+
import * as u8a from 'uint8arrays';
|
|
3
|
+
import * as nist_weierstrauss from 'nist-weierstrauss';
|
|
30
4
|
/**
|
|
31
5
|
* Constructs the document based on the method key
|
|
32
6
|
*/
|
|
33
|
-
function keyToDidDoc({ pubKeyBytes, fingerprint }) {
|
|
7
|
+
export function keyToDidDoc({ pubKeyBytes, fingerprint }) {
|
|
34
8
|
const did = `did:key:${fingerprint}`;
|
|
35
9
|
const keyId = `${did}#${fingerprint}`;
|
|
36
10
|
const key = pubKeyBytesToXY(pubKeyBytes);
|
|
@@ -55,7 +29,6 @@ function keyToDidDoc({ pubKeyBytes, fingerprint }) {
|
|
|
55
29
|
capabilityInvocation: [keyId],
|
|
56
30
|
};
|
|
57
31
|
}
|
|
58
|
-
exports.keyToDidDoc = keyToDidDoc;
|
|
59
32
|
/**
|
|
60
33
|
*
|
|
61
34
|
* @param pubKeyBytes - public key as uncompressed byte array with no prefix (raw key),
|
|
@@ -68,7 +41,7 @@ exports.keyToDidDoc = keyToDidDoc;
|
|
|
68
41
|
* @throws Error: Unexpected pubKeyBytes
|
|
69
42
|
* @internal
|
|
70
43
|
*/
|
|
71
|
-
function pubKeyBytesToXY(pubKeyBytes) {
|
|
44
|
+
export function pubKeyBytesToXY(pubKeyBytes) {
|
|
72
45
|
if (!nist_weierstrauss.nist_weierstrauss_common.testUint8Array(pubKeyBytes)) {
|
|
73
46
|
throw new TypeError('input must be a Uint8Array');
|
|
74
47
|
}
|
|
@@ -95,6 +68,5 @@ function pubKeyBytesToXY(pubKeyBytes) {
|
|
|
95
68
|
}
|
|
96
69
|
throw new Error('Unexpected pubKeyBytes');
|
|
97
70
|
}
|
|
98
|
-
|
|
99
|
-
exports.default = { keyToDidDoc };
|
|
71
|
+
export default { keyToDidDoc };
|
|
100
72
|
//# sourceMappingURL=secp384r1.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secp384r1.js","sourceRoot":"","sources":["../../src/drivers/secp384r1.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"secp384r1.js","sourceRoot":"","sources":["../../src/drivers/secp384r1.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAErD,OAAO,KAAK,GAAG,MAAM,aAAa,CAAA;AAElC,OAAO,KAAK,iBAAiB,MAAM,mBAAmB,CAAA;AAItD;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,WAAW,EAAE,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EAAE;YACpC,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;YACvC,OAAO,iBAAiB,CAAC,wBAAwB,CAAC,aAAa,CAAC,SAAS,CAAC,CAAA;SAC3E;KACF;IAED,mCAAmC;IACnC,IAAI,UAAU,IAAI,EAAE,EAAE;QACpB,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE;YACxE,MAAM,SAAS,GAAG,GAAG,CAAC,UAAU,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAA;YACxD,MAAM,KAAK,GAAG,iBAAiB,CAAC,SAAS,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAA;YACtE,OAAO,iBAAiB,CAAC,wBAAwB,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAA;SAC1E;KACF;IAED,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;AAC3C,CAAC;AAED,eAAe,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -1,36 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Brent Shambaugh <brent.shambaugh@gmail.com>. 2021.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.pubKeyBytesToXY = exports.keyToDidDoc = void 0;
|
|
28
|
-
const u8a = __importStar(require("uint8arrays"));
|
|
29
|
-
const nist_weierstrauss = __importStar(require("nist-weierstrauss"));
|
|
2
|
+
import * as u8a from 'uint8arrays';
|
|
3
|
+
import * as nist_weierstrauss from 'nist-weierstrauss';
|
|
30
4
|
/**
|
|
31
5
|
* Constructs the document based on the method key
|
|
32
6
|
*/
|
|
33
|
-
function keyToDidDoc({ pubKeyBytes, fingerprint }) {
|
|
7
|
+
export function keyToDidDoc({ pubKeyBytes, fingerprint }) {
|
|
34
8
|
const did = `did:key:${fingerprint}`;
|
|
35
9
|
const keyId = `${did}#${fingerprint}`;
|
|
36
10
|
const key = pubKeyBytesToXY(pubKeyBytes);
|
|
@@ -55,7 +29,6 @@ function keyToDidDoc({ pubKeyBytes, fingerprint }) {
|
|
|
55
29
|
capabilityInvocation: [keyId],
|
|
56
30
|
};
|
|
57
31
|
}
|
|
58
|
-
exports.keyToDidDoc = keyToDidDoc;
|
|
59
32
|
/**
|
|
60
33
|
*
|
|
61
34
|
* @param pubKeyBytes - public key as compressed with 0x02 prefix if even and 0x03 prefix if odd.
|
|
@@ -67,7 +40,7 @@ exports.keyToDidDoc = keyToDidDoc;
|
|
|
67
40
|
* @throws Error: Unexpected pubKeyBytes
|
|
68
41
|
* @internal
|
|
69
42
|
*/
|
|
70
|
-
function pubKeyBytesToXY(pubKeyBytes) {
|
|
43
|
+
export function pubKeyBytesToXY(pubKeyBytes) {
|
|
71
44
|
if (!nist_weierstrauss.nist_weierstrauss_common.testUint8Array(pubKeyBytes)) {
|
|
72
45
|
throw new TypeError('input must be a Uint8Array');
|
|
73
46
|
}
|
|
@@ -83,6 +56,5 @@ function pubKeyBytesToXY(pubKeyBytes) {
|
|
|
83
56
|
}
|
|
84
57
|
throw new Error('Unexpected pubKeyBytes');
|
|
85
58
|
}
|
|
86
|
-
|
|
87
|
-
exports.default = { keyToDidDoc };
|
|
59
|
+
export default { keyToDidDoc };
|
|
88
60
|
//# sourceMappingURL=secp521r1.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secp521r1.js","sourceRoot":"","sources":["../../src/drivers/secp521r1.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"secp521r1.js","sourceRoot":"","sources":["../../src/drivers/secp521r1.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAErD,OAAO,KAAK,GAAG,MAAM,aAAa,CAAA;AAElC,OAAO,KAAK,iBAAiB,MAAM,mBAAmB,CAAA;AAItD;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,WAAW,EAAE,WAAW,EAAmB;IACvE,MAAM,GAAG,GAAG,WAAW,WAAW,EAAE,CAAA;IACpC,MAAM,KAAK,GAAG,GAAG,GAAG,IAAI,WAAW,EAAE,CAAA;IACrC,MAAM,GAAG,GAAG,eAAe,CAAC,WAAW,CAAC,CAAA;IACxC,OAAO;QACL,EAAE,EAAE,GAAG;QACP,kBAAkB,EAAE;YAClB;gBACE,EAAE,EAAE,KAAK;gBACT,IAAI,EAAE,gBAAgB;gBACtB,UAAU,EAAE,GAAG;gBACf,YAAY,EAAE;oBACZ,GAAG,EAAE,IAAI;oBACT,GAAG,EAAE,OAAO;oBACZ,CAAC,EAAE,GAAG,CAAC,EAAE;oBACT,CAAC,EAAE,GAAG,CAAC,EAAE;iBACV;aACF;SACF;QACD,cAAc,EAAE,CAAC,K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
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.getResolver = void 0;
|
|
30
|
-
const varint_1 = __importDefault(require("varint"));
|
|
31
|
-
const base58_1 = require("multiformats/bases/base58");
|
|
32
|
-
const ed25519_1 = __importDefault(require("./drivers/ed25519"));
|
|
33
|
-
const bls12381g2_1 = __importDefault(require("./drivers/bls12381g2"));
|
|
34
|
-
const secp256k1_1 = __importDefault(require("./drivers/secp256k1"));
|
|
35
|
-
const secp256r1_1 = __importDefault(require("./drivers/secp256r1"));
|
|
36
|
-
const secp384r1_1 = __importDefault(require("./drivers/secp384r1"));
|
|
37
|
-
const secp521r1_1 = __importDefault(require("./drivers/secp521r1"));
|
|
38
|
-
const jwk_jcs_1 = __importDefault(require("./drivers/jwk.jcs"));
|
|
39
|
-
const types_1 = require("./types");
|
|
40
|
-
__exportStar(require("./types"), exports);
|
|
1
|
+
import varint from 'varint';
|
|
2
|
+
import { base58btc } from 'multiformats/bases/base58';
|
|
3
|
+
import ed25519 from './drivers/ed25519';
|
|
4
|
+
import bls12381g2 from './drivers/bls12381g2';
|
|
5
|
+
import secp256k1 from './drivers/secp256k1';
|
|
6
|
+
import secp256r1 from './drivers/secp256r1';
|
|
7
|
+
import secp384r1 from './drivers/secp384r1';
|
|
8
|
+
import secp521r1 from './drivers/secp521r1';
|
|
9
|
+
import jwkJcs from './drivers/jwk.jcs';
|
|
10
|
+
import { DID_JSON, DID_LD_JSON } from './types';
|
|
11
|
+
export * from './types';
|
|
41
12
|
const prefixToDriverMap = {
|
|
42
|
-
0xe7:
|
|
43
|
-
0xed:
|
|
44
|
-
0x1200:
|
|
45
|
-
0x1201:
|
|
46
|
-
0x1202:
|
|
47
|
-
0xeb:
|
|
48
|
-
0xeb51:
|
|
13
|
+
0xe7: secp256k1,
|
|
14
|
+
0xed: ed25519,
|
|
15
|
+
0x1200: secp256r1,
|
|
16
|
+
0x1201: secp384r1,
|
|
17
|
+
0x1202: secp521r1,
|
|
18
|
+
0xeb: bls12381g2,
|
|
19
|
+
0xeb51: jwkJcs,
|
|
49
20
|
};
|
|
50
|
-
const getResolver = () => {
|
|
21
|
+
export const getResolver = () => {
|
|
51
22
|
return {
|
|
52
|
-
key: (did, parsed, r, options) =>
|
|
53
|
-
const contentType = options.accept ||
|
|
23
|
+
key: async (did, parsed, r, options) => {
|
|
24
|
+
const contentType = options.accept || DID_LD_JSON;
|
|
54
25
|
const response = {
|
|
55
26
|
didResolutionMetadata: { contentType },
|
|
56
27
|
didDocument: null,
|
|
57
28
|
didDocumentMetadata: {},
|
|
58
29
|
};
|
|
59
30
|
try {
|
|
60
|
-
const multicodecPubKey =
|
|
61
|
-
const keyType =
|
|
62
|
-
const pubKeyBytes = multicodecPubKey.slice(
|
|
31
|
+
const multicodecPubKey = base58btc.decode(parsed.id);
|
|
32
|
+
const keyType = varint.decode(multicodecPubKey);
|
|
33
|
+
const pubKeyBytes = multicodecPubKey.slice(varint.decode.bytes);
|
|
63
34
|
const args = { pubKeyBytes, fingerprint: parsed.id, contentType, options };
|
|
64
|
-
const doc =
|
|
65
|
-
if (contentType ===
|
|
35
|
+
const doc = await prefixToDriverMap[keyType].keyToDidDoc(args);
|
|
36
|
+
if (contentType === DID_LD_JSON) {
|
|
66
37
|
if (!doc['@context']) {
|
|
67
38
|
doc['@context'] = 'https://w3id.org/did/v1';
|
|
68
39
|
}
|
|
@@ -73,7 +44,7 @@ const getResolver = () => {
|
|
|
73
44
|
}
|
|
74
45
|
response.didDocument = doc;
|
|
75
46
|
}
|
|
76
|
-
else if (contentType ===
|
|
47
|
+
else if (contentType === DID_JSON) {
|
|
77
48
|
response.didDocument = doc;
|
|
78
49
|
}
|
|
79
50
|
else {
|
|
@@ -86,9 +57,8 @@ const getResolver = () => {
|
|
|
86
57
|
response.didResolutionMetadata.message = e.toString();
|
|
87
58
|
}
|
|
88
59
|
return response;
|
|
89
|
-
}
|
|
60
|
+
},
|
|
90
61
|
};
|
|
91
62
|
};
|
|
92
|
-
|
|
93
|
-
exports.default = { getResolver: exports.getResolver };
|
|
63
|
+
export default { getResolver };
|
|
94
64
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,OAAO,MAAM,mBAAmB,CAAA;AACvC,OAAO,UAAU,MAAM,sBAAsB,CAAA;AAC7C,OAAO,SAAS,MAAM,qBAAqB,CAAA;AAC3C,OAAO,SAAS,MAAM,qBAAqB,CAAA;AAC3C,OAAO,SAAS,MAAM,qBAAqB,CAAA;AAC3C,OAAO,SAAS,MAAM,qBAAqB,CAA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B,GAAG,CAAC,UAAU,CAAC,GAAG,yBAAyB,CAAA;qBAC5C;yBAAM,IACL,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;wBAC9B,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,yBAAyB,CAAC;wBACpD,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,8BAA8B,CAAC,EACzD;wBACA,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAA;qBAChD;oBACD,QAAQ,CAAC,WAAW,GAAG,GAAG,CAAA;iBAC3B;qBAAM,IAAI,WAAW,KAAK,QAAQ,EAAE;oBACnC,QAAQ,CAAC,WAAW,GAAG,GAAG,CAAA;iBAC3B;qBAAM;oBACL,OAAO,QAAQ,CAAC,qBAAqB,CAAC,WAAW,CAAA;oBACjD,QAAQ,CAAC,qBAAqB,CAAC,KAAK,GAAG,4BAA4B,CAAA;iBACpE;aACF;YAAC,OAAO,CAAM,EAAE;gBACf,QAAQ,CAAC,qBAAqB,CAAC,KAAK,GAAG,YAAY,CAAA;gBACnD,QAAQ,CAAC,qBAAqB,CAAC,OAAO,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAA;aACtD;YACD,OAAO,QAAQ,CAAA;QACjB,CAAC;KACF,CAAA;AACH,CAAC,CAAA;AACD,eAAe,EAAE,WAAW,EAAE,CAAA"}
|
package/dist/types.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.DID_JSON = exports.DID_LD_JSON = void 0;
|
|
4
|
-
exports.DID_LD_JSON = 'application/did+ld+json';
|
|
5
|
-
exports.DID_JSON = 'application/did+json';
|
|
1
|
+
export const DID_LD_JSON = 'application/did+ld+json';
|
|
2
|
+
export const DID_JSON = 'application/did+json';
|
|
6
3
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAG,yBAAyB,CAAA;AACpD,MAAM,CAAC,MAAM,QAAQ,GAAG,sBAAsB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk-ext.did-resolver-key",
|
|
3
3
|
"description": "Sphereon did:key resolver with BBS+/BLS and EBSI support.",
|
|
4
|
-
"version": "0.13.
|
|
4
|
+
"version": "0.13.1-unstable.3+bf7e638",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
8
9
|
"scripts": {
|
|
9
10
|
"build": "tsc"
|
|
10
11
|
},
|
|
11
12
|
"dependencies": {
|
|
12
|
-
"@sphereon/ssi-sdk-ext.key-utils": "0.13.
|
|
13
|
+
"@sphereon/ssi-sdk-ext.key-utils": "0.13.1-unstable.3+bf7e638",
|
|
13
14
|
"@stablelib/ed25519": "^1.0.3",
|
|
14
15
|
"bigint-mod-arith": "^3.2.1",
|
|
15
16
|
"did-resolver": "^4.1.0",
|
|
@@ -51,5 +52,5 @@
|
|
|
51
52
|
"secp256r1",
|
|
52
53
|
"RSA"
|
|
53
54
|
],
|
|
54
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "bf7e63885eb9621004cd87a5804015cc5348a044"
|
|
55
56
|
}
|