@enbox/dids 0.0.1
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/LICENSE +201 -0
- package/README.md +1 -0
- package/dist/browser.js +77 -0
- package/dist/browser.js.map +7 -0
- package/dist/browser.mjs +77 -0
- package/dist/browser.mjs.map +7 -0
- package/dist/cjs/index.js +6303 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/utils.js +245 -0
- package/dist/cjs/utils.js.map +7 -0
- package/dist/esm/bearer-did.js +201 -0
- package/dist/esm/bearer-did.js.map +1 -0
- package/dist/esm/did-error.js +62 -0
- package/dist/esm/did-error.js.map +1 -0
- package/dist/esm/did.js +114 -0
- package/dist/esm/did.js.map +1 -0
- package/dist/esm/index.js +16 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/methods/did-dht.js +1241 -0
- package/dist/esm/methods/did-dht.js.map +1 -0
- package/dist/esm/methods/did-ion.js +570 -0
- package/dist/esm/methods/did-ion.js.map +1 -0
- package/dist/esm/methods/did-jwk.js +298 -0
- package/dist/esm/methods/did-jwk.js.map +1 -0
- package/dist/esm/methods/did-key.js +983 -0
- package/dist/esm/methods/did-key.js.map +1 -0
- package/dist/esm/methods/did-method.js +53 -0
- package/dist/esm/methods/did-method.js.map +1 -0
- package/dist/esm/methods/did-web.js +83 -0
- package/dist/esm/methods/did-web.js.map +1 -0
- package/dist/esm/resolver/resolver-cache-level.js +101 -0
- package/dist/esm/resolver/resolver-cache-level.js.map +1 -0
- package/dist/esm/resolver/resolver-cache-noop.js +24 -0
- package/dist/esm/resolver/resolver-cache-noop.js.map +1 -0
- package/dist/esm/resolver/universal-resolver.js +187 -0
- package/dist/esm/resolver/universal-resolver.js.map +1 -0
- package/dist/esm/types/did-core.js +51 -0
- package/dist/esm/types/did-core.js.map +1 -0
- package/dist/esm/types/did-resolution.js +12 -0
- package/dist/esm/types/did-resolution.js.map +1 -0
- package/dist/esm/types/multibase.js +2 -0
- package/dist/esm/types/multibase.js.map +1 -0
- package/dist/esm/types/portable-did.js +2 -0
- package/dist/esm/types/portable-did.js.map +1 -0
- package/dist/esm/utils.js +458 -0
- package/dist/esm/utils.js.map +1 -0
- package/dist/types/bearer-did.d.ts +143 -0
- package/dist/types/bearer-did.d.ts.map +1 -0
- package/dist/types/did-error.d.ts +50 -0
- package/dist/types/did-error.d.ts.map +1 -0
- package/dist/types/did.d.ts +125 -0
- package/dist/types/did.d.ts.map +1 -0
- package/dist/types/index.d.ts +18 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/methods/did-dht.d.ts +682 -0
- package/dist/types/methods/did-dht.d.ts.map +1 -0
- package/dist/types/methods/did-ion.d.ts +492 -0
- package/dist/types/methods/did-ion.d.ts.map +1 -0
- package/dist/types/methods/did-jwk.d.ts +236 -0
- package/dist/types/methods/did-jwk.d.ts.map +1 -0
- package/dist/types/methods/did-key.d.ts +499 -0
- package/dist/types/methods/did-key.d.ts.map +1 -0
- package/dist/types/methods/did-method.d.ts +238 -0
- package/dist/types/methods/did-method.d.ts.map +1 -0
- package/dist/types/methods/did-web.d.ts +37 -0
- package/dist/types/methods/did-web.d.ts.map +1 -0
- package/dist/types/resolver/resolver-cache-level.d.ts +86 -0
- package/dist/types/resolver/resolver-cache-level.d.ts.map +1 -0
- package/dist/types/resolver/resolver-cache-noop.d.ts +9 -0
- package/dist/types/resolver/resolver-cache-noop.d.ts.map +1 -0
- package/dist/types/resolver/universal-resolver.d.ts +109 -0
- package/dist/types/resolver/universal-resolver.d.ts.map +1 -0
- package/dist/types/types/did-core.d.ts +523 -0
- package/dist/types/types/did-core.d.ts.map +1 -0
- package/dist/types/types/did-resolution.d.ts +85 -0
- package/dist/types/types/did-resolution.d.ts.map +1 -0
- package/dist/types/types/multibase.d.ts +28 -0
- package/dist/types/types/multibase.d.ts.map +1 -0
- package/dist/types/types/portable-did.d.ts +59 -0
- package/dist/types/types/portable-did.d.ts.map +1 -0
- package/dist/types/utils.d.ts +378 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/dist/utils.js +28 -0
- package/dist/utils.js.map +7 -0
- package/package.json +116 -0
- package/src/bearer-did.ts +287 -0
- package/src/did-error.ts +75 -0
- package/src/did.ts +186 -0
- package/src/index.ts +21 -0
- package/src/methods/did-dht.ts +1637 -0
- package/src/methods/did-ion.ts +887 -0
- package/src/methods/did-jwk.ts +410 -0
- package/src/methods/did-key.ts +1248 -0
- package/src/methods/did-method.ts +276 -0
- package/src/methods/did-web.ts +96 -0
- package/src/resolver/resolver-cache-level.ts +163 -0
- package/src/resolver/resolver-cache-noop.ts +26 -0
- package/src/resolver/universal-resolver.ts +238 -0
- package/src/types/did-core.ts +580 -0
- package/src/types/did-resolution.ts +93 -0
- package/src/types/multibase.ts +29 -0
- package/src/types/portable-did.ts +64 -0
- package/src/utils.ts +532 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"did-dht.js","sourceRoot":"","sources":["../../../src/methods/did-dht.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAYA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC7G,OAAO,EAAE,oBAAoB,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAYlH,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,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,CAAC,CAAC,CAAC,CAAC,8DAA8D;QACrG,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -0,0 +1,570 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { IonDid, IonRequest } from '@decentralized-identity/ion-sdk';
|
|
11
|
+
import { LocalKeyManager, computeJwkThumbprint } from '@enbox/crypto';
|
|
12
|
+
import { Did } from '../did.js';
|
|
13
|
+
import { BearerDid } from '../bearer-did.js';
|
|
14
|
+
import { DidMethod } from '../methods/did-method.js';
|
|
15
|
+
import { DidError, DidErrorCode } from '../did-error.js';
|
|
16
|
+
import { getVerificationRelationshipsById } from '../utils.js';
|
|
17
|
+
import { EMPTY_DID_RESOLUTION_RESULT } from '../types/did-resolution.js';
|
|
18
|
+
/**
|
|
19
|
+
* Enumerates the types of keys that can be used in a DID ION document.
|
|
20
|
+
*
|
|
21
|
+
* The DID ION method supports various cryptographic key types. These key types are essential for
|
|
22
|
+
* the creation and management of DIDs and their associated cryptographic operations like signing
|
|
23
|
+
* and encryption.
|
|
24
|
+
*/
|
|
25
|
+
export var DidIonRegisteredKeyType;
|
|
26
|
+
(function (DidIonRegisteredKeyType) {
|
|
27
|
+
/**
|
|
28
|
+
* Ed25519: A public-key signature system using the EdDSA (Edwards-curve Digital Signature
|
|
29
|
+
* Algorithm) and Curve25519.
|
|
30
|
+
*/
|
|
31
|
+
DidIonRegisteredKeyType["Ed25519"] = "Ed25519";
|
|
32
|
+
/**
|
|
33
|
+
* secp256k1: A cryptographic curve used for digital signatures in a range of decentralized
|
|
34
|
+
* systems.
|
|
35
|
+
*/
|
|
36
|
+
DidIonRegisteredKeyType["secp256k1"] = "secp256k1";
|
|
37
|
+
/**
|
|
38
|
+
* secp256r1: Also known as P-256 or prime256v1, this curve is used for cryptographic operations
|
|
39
|
+
* and is widely supported in various cryptographic libraries and standards.
|
|
40
|
+
*/
|
|
41
|
+
DidIonRegisteredKeyType["secp256r1"] = "secp256r1";
|
|
42
|
+
/**
|
|
43
|
+
* X25519: A Diffie-Hellman key exchange algorithm using Curve25519.
|
|
44
|
+
*/
|
|
45
|
+
DidIonRegisteredKeyType["X25519"] = "X25519";
|
|
46
|
+
})(DidIonRegisteredKeyType || (DidIonRegisteredKeyType = {}));
|
|
47
|
+
/**
|
|
48
|
+
* Private helper that maps algorithm identifiers to their corresponding DID ION
|
|
49
|
+
* {@link DidIonRegisteredKeyType | registered key type}.
|
|
50
|
+
*/
|
|
51
|
+
const AlgorithmToKeyTypeMap = {
|
|
52
|
+
Ed25519: DidIonRegisteredKeyType.Ed25519,
|
|
53
|
+
ES256K: DidIonRegisteredKeyType.secp256k1,
|
|
54
|
+
ES256: DidIonRegisteredKeyType.secp256r1,
|
|
55
|
+
'P-256': DidIonRegisteredKeyType.secp256r1,
|
|
56
|
+
secp256k1: DidIonRegisteredKeyType.secp256k1,
|
|
57
|
+
secp256r1: DidIonRegisteredKeyType.secp256r1
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* The default node to use as a gateway to the Sidetree newtork when anchoring, updating, and
|
|
61
|
+
* resolving DID documents.
|
|
62
|
+
*/
|
|
63
|
+
const DEFAULT_GATEWAY_URI = 'https://ion.tbd.engineering';
|
|
64
|
+
/**
|
|
65
|
+
* The `DidIon` class provides an implementation of the `did:ion` DID method.
|
|
66
|
+
*
|
|
67
|
+
* Features:
|
|
68
|
+
* - DID Creation: Create new `did:ion` DIDs.
|
|
69
|
+
* - DID Key Management: Instantiate a DID object from an existing key in a Key Management System
|
|
70
|
+
* (KMS). If supported by the KMS, a DID's key can be exported to a portable
|
|
71
|
+
* DID format.
|
|
72
|
+
* - DID Resolution: Resolve a `did:ion` to its corresponding DID Document stored in the Sidetree
|
|
73
|
+
* network.
|
|
74
|
+
* - Signature Operations: Sign and verify messages using keys associated with a DID.
|
|
75
|
+
*
|
|
76
|
+
* @see {@link https://identity.foundation/sidetree/spec/ | Sidetree Protocol Specification}
|
|
77
|
+
* @see {@link https://github.com/decentralized-identity/ion/blob/master/docs/design.md | ION Design Document}
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* // DID Creation
|
|
82
|
+
* const did = await DidIon.create();
|
|
83
|
+
*
|
|
84
|
+
* // DID Creation with a KMS
|
|
85
|
+
* const keyManager = new LocalKeyManager();
|
|
86
|
+
* const did = await DidIon.create({ keyManager });
|
|
87
|
+
*
|
|
88
|
+
* // DID Resolution
|
|
89
|
+
* const resolutionResult = await DidIon.resolve({ did: did.uri });
|
|
90
|
+
*
|
|
91
|
+
* // Signature Operations
|
|
92
|
+
* const signer = await did.getSigner();
|
|
93
|
+
* const signature = await signer.sign({ data: new TextEncoder().encode('Message') });
|
|
94
|
+
* const isValid = await signer.verify({ data: new TextEncoder().encode('Message'), signature });
|
|
95
|
+
*
|
|
96
|
+
* // Key Management
|
|
97
|
+
*
|
|
98
|
+
* // Instantiate a DID object for a published DID with existing keys in a KMS
|
|
99
|
+
* const did = await DidIon.fromKeyManager({
|
|
100
|
+
* didUri: 'did:ion:EiAzB7K-xDIKc1csXo5HX2eNBoemK9feNhL3cKwfukYOug',
|
|
101
|
+
* keyManager
|
|
102
|
+
* });
|
|
103
|
+
*
|
|
104
|
+
* // Convert a DID object to a portable format
|
|
105
|
+
* const portableDid = await DidIon.toKeys({ did });
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
export class DidIon extends DidMethod {
|
|
109
|
+
/**
|
|
110
|
+
* Creates a new DID using the `did:ion` method formed from a newly generated key.
|
|
111
|
+
*
|
|
112
|
+
* Notes:
|
|
113
|
+
* - If no `options` are given, by default a new Ed25519 key will be generated.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```ts
|
|
117
|
+
* // DID Creation
|
|
118
|
+
* const did = await DidIon.create();
|
|
119
|
+
*
|
|
120
|
+
* // DID Creation with a KMS
|
|
121
|
+
* const keyManager = new LocalKeyManager();
|
|
122
|
+
* const did = await DidIon.create({ keyManager });
|
|
123
|
+
* ```
|
|
124
|
+
*
|
|
125
|
+
* @param params - The parameters for the create operation.
|
|
126
|
+
* @param params.keyManager - Optionally specify a Key Management System (KMS) used to generate
|
|
127
|
+
* keys and sign data.
|
|
128
|
+
* @param params.options - Optional parameters that can be specified when creating a new DID.
|
|
129
|
+
* @returns A Promise resolving to a {@link BearerDid} object representing the new DID.
|
|
130
|
+
*/
|
|
131
|
+
static create() {
|
|
132
|
+
return __awaiter(this, arguments, void 0, function* ({ keyManager = new LocalKeyManager(), options = {} } = {}) {
|
|
133
|
+
// Before processing the create operation, validate DID-method-specific requirements to prevent
|
|
134
|
+
// keys from being generated unnecessarily.
|
|
135
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
136
|
+
// Check 1: Validate that the algorithm for any given verification method is supported by the
|
|
137
|
+
// DID ION specification.
|
|
138
|
+
if ((_a = options.verificationMethods) === null || _a === void 0 ? void 0 : _a.some(vm => !(vm.algorithm in AlgorithmToKeyTypeMap))) {
|
|
139
|
+
throw new Error('One or more verification method algorithms are not supported');
|
|
140
|
+
}
|
|
141
|
+
// Check 2: Validate that the ID for any given verification method is unique.
|
|
142
|
+
const methodIds = (_b = options.verificationMethods) === null || _b === void 0 ? void 0 : _b.filter(vm => 'id' in vm).map(vm => vm.id);
|
|
143
|
+
if (methodIds && methodIds.length !== new Set(methodIds).size) {
|
|
144
|
+
throw new Error('One or more verification method IDs are not unique');
|
|
145
|
+
}
|
|
146
|
+
// Check 3: Validate that the required properties for any given services are present.
|
|
147
|
+
if ((_c = options.services) === null || _c === void 0 ? void 0 : _c.some(s => !s.id || !s.type || !s.serviceEndpoint)) {
|
|
148
|
+
throw new Error('One or more services are missing required properties');
|
|
149
|
+
}
|
|
150
|
+
// If no verification methods were specified, generate a default Ed25519 verification method.
|
|
151
|
+
const defaultVerificationMethod = {
|
|
152
|
+
algorithm: 'Ed25519',
|
|
153
|
+
purposes: ['authentication', 'assertionMethod', 'capabilityDelegation', 'capabilityInvocation']
|
|
154
|
+
};
|
|
155
|
+
const verificationMethodsToAdd = [];
|
|
156
|
+
// Generate random key material for additional verification methods, if any.
|
|
157
|
+
for (const vm of (_d = options.verificationMethods) !== null && _d !== void 0 ? _d : [defaultVerificationMethod]) {
|
|
158
|
+
// Generate a random key for the verification method.
|
|
159
|
+
const keyUri = yield keyManager.generateKey({ algorithm: vm.algorithm });
|
|
160
|
+
const publicKey = yield keyManager.getPublicKey({ keyUri });
|
|
161
|
+
// Add the verification method to the DID document.
|
|
162
|
+
verificationMethodsToAdd.push({
|
|
163
|
+
id: vm.id,
|
|
164
|
+
publicKeyJwk: publicKey,
|
|
165
|
+
purposes: (_e = vm.purposes) !== null && _e !== void 0 ? _e : ['authentication', 'assertionMethod', 'capabilityDelegation', 'capabilityInvocation']
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
// Generate a random key for the ION Recovery Key. Sidetree requires secp256k1 recovery keys.
|
|
169
|
+
const recoveryKeyUri = yield keyManager.generateKey({ algorithm: DidIonRegisteredKeyType.secp256k1 });
|
|
170
|
+
const recoveryKey = yield keyManager.getPublicKey({ keyUri: recoveryKeyUri });
|
|
171
|
+
// Generate a random key for the ION Update Key. Sidetree requires secp256k1 update keys.
|
|
172
|
+
const updateKeyUri = yield keyManager.generateKey({ algorithm: DidIonRegisteredKeyType.secp256k1 });
|
|
173
|
+
const updateKey = yield keyManager.getPublicKey({ keyUri: updateKeyUri });
|
|
174
|
+
// Compute the Long Form DID URI from the keys and services, if any.
|
|
175
|
+
const longFormDidUri = yield DidIonUtils.computeLongFormDidUri({
|
|
176
|
+
recoveryKey,
|
|
177
|
+
updateKey,
|
|
178
|
+
services: (_f = options.services) !== null && _f !== void 0 ? _f : [],
|
|
179
|
+
verificationMethods: verificationMethodsToAdd
|
|
180
|
+
});
|
|
181
|
+
// Expand the DID URI string to a DID document.
|
|
182
|
+
const { didDocument, didResolutionMetadata } = yield DidIon.resolve(longFormDidUri, { gatewayUri: options.gatewayUri });
|
|
183
|
+
if (didDocument === null) {
|
|
184
|
+
throw new Error(`Unable to resolve DID during creation: ${didResolutionMetadata === null || didResolutionMetadata === void 0 ? void 0 : didResolutionMetadata.error}`);
|
|
185
|
+
}
|
|
186
|
+
// Create the BearerDid object, including the "Short Form" of the DID URI, the ION update and
|
|
187
|
+
// recovery keys, and specifying that the DID has not yet been published.
|
|
188
|
+
const did = new BearerDid({
|
|
189
|
+
uri: longFormDidUri,
|
|
190
|
+
document: didDocument,
|
|
191
|
+
metadata: {
|
|
192
|
+
published: false,
|
|
193
|
+
canonicalId: longFormDidUri.split(':', 3).join(':'),
|
|
194
|
+
recoveryKey,
|
|
195
|
+
updateKey
|
|
196
|
+
},
|
|
197
|
+
keyManager
|
|
198
|
+
});
|
|
199
|
+
// By default, publish the DID document to a Sidetree node unless explicitly disabled.
|
|
200
|
+
if ((_g = options.publish) !== null && _g !== void 0 ? _g : true) {
|
|
201
|
+
const registrationResult = yield DidIon.publish({ did, gatewayUri: options.gatewayUri });
|
|
202
|
+
did.metadata = registrationResult.didDocumentMetadata;
|
|
203
|
+
}
|
|
204
|
+
return did;
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Given the W3C DID Document of a `did:ion` DID, return the verification method that will be used
|
|
209
|
+
* for signing messages and credentials. If given, the `methodId` parameter is used to select the
|
|
210
|
+
* verification method. If not given, the first verification method in the authentication property
|
|
211
|
+
* in the DID Document is used.
|
|
212
|
+
*
|
|
213
|
+
* @param params - The parameters for the `getSigningMethod` operation.
|
|
214
|
+
* @param params.didDocument - DID Document to get the verification method from.
|
|
215
|
+
* @param params.methodId - ID of the verification method to use for signing.
|
|
216
|
+
* @returns Verification method to use for signing.
|
|
217
|
+
*/
|
|
218
|
+
static getSigningMethod(_a) {
|
|
219
|
+
return __awaiter(this, arguments, void 0, function* ({ didDocument, methodId }) {
|
|
220
|
+
var _b;
|
|
221
|
+
// Verify the DID method is supported.
|
|
222
|
+
const parsedDid = Did.parse(didDocument.id);
|
|
223
|
+
if (parsedDid && parsedDid.method !== this.methodName) {
|
|
224
|
+
throw new DidError(DidErrorCode.MethodNotSupported, `Method not supported: ${parsedDid.method}`);
|
|
225
|
+
}
|
|
226
|
+
// Get the verification method with either the specified ID or the first assertion method.
|
|
227
|
+
const verificationMethod = (_b = didDocument.verificationMethod) === null || _b === void 0 ? void 0 : _b.find(vm => { var _a; return vm.id === (methodId !== null && methodId !== void 0 ? methodId : (_a = didDocument.assertionMethod) === null || _a === void 0 ? void 0 : _a[0]); });
|
|
228
|
+
if (!(verificationMethod && verificationMethod.publicKeyJwk)) {
|
|
229
|
+
throw new DidError(DidErrorCode.InternalError, 'A verification method intended for signing could not be determined from the DID Document');
|
|
230
|
+
}
|
|
231
|
+
return verificationMethod;
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Instantiates a {@link BearerDid} object for the DID ION method from a given {@link PortableDid}.
|
|
236
|
+
*
|
|
237
|
+
* This method allows for the creation of a `BearerDid` object using a previously created DID's
|
|
238
|
+
* key material, DID document, and metadata.
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```ts
|
|
242
|
+
* // Export an existing BearerDid to PortableDid format.
|
|
243
|
+
* const portableDid = await did.export();
|
|
244
|
+
* // Reconstruct a BearerDid object from the PortableDid.
|
|
245
|
+
* const did = await DidIon.import({ portableDid });
|
|
246
|
+
* ```
|
|
247
|
+
*
|
|
248
|
+
* @param params - The parameters for the import operation.
|
|
249
|
+
* @param params.portableDid - The PortableDid object to import.
|
|
250
|
+
* @param params.keyManager - Optionally specify an external Key Management System (KMS) used to
|
|
251
|
+
* generate keys and sign data. If not given, a new
|
|
252
|
+
* {@link LocalKeyManager} instance will be created and
|
|
253
|
+
* used.
|
|
254
|
+
* @returns A Promise resolving to a `BearerDid` object representing the DID formed from the
|
|
255
|
+
* provided PortableDid.
|
|
256
|
+
* @throws An error if the DID document does not contain any verification methods or the keys for
|
|
257
|
+
* any verification method are missing in the key manager.
|
|
258
|
+
*/
|
|
259
|
+
static import(_a) {
|
|
260
|
+
return __awaiter(this, arguments, void 0, function* ({ portableDid, keyManager = new LocalKeyManager() }) {
|
|
261
|
+
// Verify the DID method is supported.
|
|
262
|
+
const parsedDid = Did.parse(portableDid.uri);
|
|
263
|
+
if ((parsedDid === null || parsedDid === void 0 ? void 0 : parsedDid.method) !== DidIon.methodName) {
|
|
264
|
+
throw new DidError(DidErrorCode.MethodNotSupported, `Method not supported`);
|
|
265
|
+
}
|
|
266
|
+
const did = yield BearerDid.import({ portableDid, keyManager });
|
|
267
|
+
return did;
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Publishes a DID to a Sidetree node, making it publicly discoverable and resolvable.
|
|
272
|
+
*
|
|
273
|
+
* This method handles the publication of a DID Document associated with a `did:ion` DID to a
|
|
274
|
+
* Sidetree node.
|
|
275
|
+
*
|
|
276
|
+
* @remarks
|
|
277
|
+
* - This method is typically invoked automatically during the creation of a new DID unless the
|
|
278
|
+
* `publish` option is set to `false`.
|
|
279
|
+
* - For existing, unpublished DIDs, it can be used to publish the DID Document to a Sidetree node.
|
|
280
|
+
* - The method relies on the specified Sidetree node to interface with the network.
|
|
281
|
+
*
|
|
282
|
+
* @param params - The parameters for the `publish` operation.
|
|
283
|
+
* @param params.did - The `BearerDid` object representing the DID to be published.
|
|
284
|
+
* @param params.gatewayUri - Optional. The URI of a server involved in executing DID
|
|
285
|
+
* method operations. In the context of publishing, the
|
|
286
|
+
* endpoint is expected to be a Sidetree node. If not
|
|
287
|
+
* specified, a default node is used.
|
|
288
|
+
* @returns A Promise resolving to a boolean indicating whether the publication was successful.
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* ```ts
|
|
292
|
+
* // Generate a new DID and keys but explicitly disable publishing.
|
|
293
|
+
* const did = await DidIon.create({ options: { publish: false } });
|
|
294
|
+
* // Publish the DID to the Sidetree network.
|
|
295
|
+
* const isPublished = await DidIon.publish({ did });
|
|
296
|
+
* // `isPublished` is true if the DID was successfully published.
|
|
297
|
+
* ```
|
|
298
|
+
*/
|
|
299
|
+
static publish(_a) {
|
|
300
|
+
return __awaiter(this, arguments, void 0, function* ({ did, gatewayUri = DEFAULT_GATEWAY_URI }) {
|
|
301
|
+
var _b, _c, _d;
|
|
302
|
+
// Construct an ION verification method made up of the id, public key, and purposes from each
|
|
303
|
+
// verification method in the DID document.
|
|
304
|
+
const verificationMethods = (_c = (_b = did.document.verificationMethod) === null || _b === void 0 ? void 0 : _b.map(vm => ({
|
|
305
|
+
id: vm.id,
|
|
306
|
+
publicKeyJwk: vm.publicKeyJwk,
|
|
307
|
+
purposes: getVerificationRelationshipsById({ didDocument: did.document, methodId: vm.id })
|
|
308
|
+
}))) !== null && _c !== void 0 ? _c : [];
|
|
309
|
+
// Create the ION document.
|
|
310
|
+
const ionDocument = yield DidIonUtils.createIonDocument({
|
|
311
|
+
services: (_d = did.document.service) !== null && _d !== void 0 ? _d : [],
|
|
312
|
+
verificationMethods
|
|
313
|
+
});
|
|
314
|
+
// Construct the ION Create Operation request.
|
|
315
|
+
const createOperation = yield DidIonUtils.constructCreateRequest({
|
|
316
|
+
ionDocument,
|
|
317
|
+
recoveryKey: did.metadata.recoveryKey,
|
|
318
|
+
updateKey: did.metadata.updateKey
|
|
319
|
+
});
|
|
320
|
+
try {
|
|
321
|
+
// Construct the URL of the SideTree node's operations endpoint.
|
|
322
|
+
const operationsUrl = DidIonUtils.appendPathToUrl({
|
|
323
|
+
baseUrl: gatewayUri,
|
|
324
|
+
path: `/operations`
|
|
325
|
+
});
|
|
326
|
+
// Submit the Create Operation to the operations endpoint.
|
|
327
|
+
const response = yield fetch(operationsUrl, {
|
|
328
|
+
method: 'POST',
|
|
329
|
+
mode: 'cors',
|
|
330
|
+
headers: { 'Content-Type': 'application/json' },
|
|
331
|
+
body: JSON.stringify(createOperation)
|
|
332
|
+
});
|
|
333
|
+
// Return the result of processing the Create operation, including the updated DID metadata
|
|
334
|
+
// with the publishing result.
|
|
335
|
+
return {
|
|
336
|
+
didDocument: did.document,
|
|
337
|
+
didDocumentMetadata: Object.assign(Object.assign({}, did.metadata), { published: response.ok }),
|
|
338
|
+
didRegistrationMetadata: {}
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
catch (error) {
|
|
342
|
+
return {
|
|
343
|
+
didDocument: null,
|
|
344
|
+
didDocumentMetadata: {
|
|
345
|
+
published: false,
|
|
346
|
+
},
|
|
347
|
+
didRegistrationMetadata: {
|
|
348
|
+
error: DidErrorCode.InternalError,
|
|
349
|
+
errorMessage: `Failed to publish DID document for: ${did.uri}`
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Resolves a `did:ion` identifier to its corresponding DID document.
|
|
357
|
+
*
|
|
358
|
+
* This method performs the resolution of a `did:ion` DID, retrieving its DID Document from the
|
|
359
|
+
* Sidetree-based DID overlay network. The process involves querying a Sidetree node to retrieve
|
|
360
|
+
* the DID Document that corresponds to the given DID identifier.
|
|
361
|
+
*
|
|
362
|
+
* @remarks
|
|
363
|
+
* - If a `gatewayUri` option is not specified, a default node is used to access the Sidetree
|
|
364
|
+
* network.
|
|
365
|
+
* - It decodes the DID identifier and retrieves the associated DID Document and metadata.
|
|
366
|
+
* - In case of resolution failure, appropriate error information is returned.
|
|
367
|
+
*
|
|
368
|
+
* @example
|
|
369
|
+
* ```ts
|
|
370
|
+
* const resolutionResult = await DidIon.resolve('did:ion:example');
|
|
371
|
+
* ```
|
|
372
|
+
*
|
|
373
|
+
* @param didUri - The DID to be resolved.
|
|
374
|
+
* @param options - Optional parameters for resolving the DID. Unused by this DID method.
|
|
375
|
+
* @returns A Promise resolving to a {@link DidResolutionResult} object representing the result of the resolution.
|
|
376
|
+
*/
|
|
377
|
+
static resolve(didUri_1) {
|
|
378
|
+
return __awaiter(this, arguments, void 0, function* (didUri, options = {}) {
|
|
379
|
+
var _a, _b;
|
|
380
|
+
// Attempt to parse the DID URI.
|
|
381
|
+
const parsedDid = Did.parse(didUri);
|
|
382
|
+
// If parsing failed, the DID is invalid.
|
|
383
|
+
if (!parsedDid) {
|
|
384
|
+
return Object.assign(Object.assign({}, EMPTY_DID_RESOLUTION_RESULT), { didResolutionMetadata: { error: 'invalidDid' } });
|
|
385
|
+
}
|
|
386
|
+
// If the DID method is not "ion", return an error.
|
|
387
|
+
if (parsedDid.method !== DidIon.methodName) {
|
|
388
|
+
return Object.assign(Object.assign({}, EMPTY_DID_RESOLUTION_RESULT), { didResolutionMetadata: { error: 'methodNotSupported' } });
|
|
389
|
+
}
|
|
390
|
+
// To execute the read method operation, use the given gateway URI or a default Sidetree node.
|
|
391
|
+
const gatewayUri = (_a = options === null || options === void 0 ? void 0 : options.gatewayUri) !== null && _a !== void 0 ? _a : DEFAULT_GATEWAY_URI;
|
|
392
|
+
try {
|
|
393
|
+
// Construct the URL to be used in the resolution request.
|
|
394
|
+
const resolutionUrl = DidIonUtils.appendPathToUrl({
|
|
395
|
+
baseUrl: gatewayUri,
|
|
396
|
+
path: `/identifiers/${didUri}`
|
|
397
|
+
});
|
|
398
|
+
// Attempt to retrieve the DID document and metadata from the Sidetree node.
|
|
399
|
+
const response = yield fetch(resolutionUrl);
|
|
400
|
+
// If the DID document was not found, return an error.
|
|
401
|
+
if (!response.ok) {
|
|
402
|
+
throw new DidError(DidErrorCode.NotFound, `Unable to find DID document for: ${didUri}`);
|
|
403
|
+
}
|
|
404
|
+
// If the DID document was retrieved successfully, return it.
|
|
405
|
+
const { didDocument, didDocumentMetadata } = yield response.json();
|
|
406
|
+
return Object.assign(Object.assign(Object.assign({}, EMPTY_DID_RESOLUTION_RESULT), didDocument && { didDocument }), { didDocumentMetadata: Object.assign({ published: (_b = didDocumentMetadata === null || didDocumentMetadata === void 0 ? void 0 : didDocumentMetadata.method) === null || _b === void 0 ? void 0 : _b.published }, didDocumentMetadata) });
|
|
407
|
+
}
|
|
408
|
+
catch (error) {
|
|
409
|
+
// Rethrow any unexpected errors that are not a `DidError`.
|
|
410
|
+
if (!(error instanceof DidError))
|
|
411
|
+
throw new Error(error);
|
|
412
|
+
// Return a DID Resolution Result with the appropriate error code.
|
|
413
|
+
return Object.assign(Object.assign({}, EMPTY_DID_RESOLUTION_RESULT), { didResolutionMetadata: Object.assign({ error: error.code }, error.message && { errorMessage: error.message }) });
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Name of the DID method, as defined in the DID ION specification.
|
|
420
|
+
*/
|
|
421
|
+
DidIon.methodName = 'ion';
|
|
422
|
+
/**
|
|
423
|
+
* The `DidIonUtils` class provides utility functions to support operations in the DID ION method.
|
|
424
|
+
*/
|
|
425
|
+
export class DidIonUtils {
|
|
426
|
+
/**
|
|
427
|
+
* Appends a specified path to a base URL, ensuring proper formatting of the resulting URL.
|
|
428
|
+
*
|
|
429
|
+
* This method is useful for constructing URLs for accessing various endpoints, such as Sidetree
|
|
430
|
+
* nodes in the ION network. It handles the nuances of URL path concatenation, including the
|
|
431
|
+
* addition or removal of leading/trailing slashes, to create a well-formed URL.
|
|
432
|
+
*
|
|
433
|
+
* @param params - The parameters for URL construction.
|
|
434
|
+
* @param params.baseUrl - The base URL to which the path will be appended.
|
|
435
|
+
* @param params.path - The path to append to the base URL.
|
|
436
|
+
* @returns The fully constructed URL string with the path appended to the base URL.
|
|
437
|
+
*/
|
|
438
|
+
static appendPathToUrl({ baseUrl, path }) {
|
|
439
|
+
const url = new URL(baseUrl);
|
|
440
|
+
url.pathname = url.pathname.endsWith('/') ? url.pathname : url.pathname + '/';
|
|
441
|
+
url.pathname += path.startsWith('/') ? path.substring(1) : path;
|
|
442
|
+
return url.toString();
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Computes the Long Form DID URI given an ION DID's recovery key, update key, services, and
|
|
446
|
+
* verification methods.
|
|
447
|
+
*
|
|
448
|
+
* @param params - The parameters for computing the Long Form DID URI.
|
|
449
|
+
* @param params.recoveryKey - The ION Recovery Key.
|
|
450
|
+
* @param params.updateKey - The ION Update Key.
|
|
451
|
+
* @param params.services - An array of services associated with the DID.
|
|
452
|
+
* @param params.verificationMethods - An array of verification methods associated with the DID.
|
|
453
|
+
* @returns A Promise resolving to the Long Form DID URI.
|
|
454
|
+
*/
|
|
455
|
+
static computeLongFormDidUri(_a) {
|
|
456
|
+
return __awaiter(this, arguments, void 0, function* ({ recoveryKey, updateKey, services, verificationMethods }) {
|
|
457
|
+
// Create the ION document.
|
|
458
|
+
const ionDocument = yield DidIonUtils.createIonDocument({ services, verificationMethods });
|
|
459
|
+
// Normalize JWK to onnly include specific members and in lexicographic order.
|
|
460
|
+
const normalizedRecoveryKey = DidIonUtils.normalizeJwk(recoveryKey);
|
|
461
|
+
const normalizedUpdateKey = DidIonUtils.normalizeJwk(updateKey);
|
|
462
|
+
// Compute the Long Form DID URI.
|
|
463
|
+
const longFormDidUri = yield IonDid.createLongFormDid({
|
|
464
|
+
document: ionDocument,
|
|
465
|
+
recoveryKey: normalizedRecoveryKey,
|
|
466
|
+
updateKey: normalizedUpdateKey
|
|
467
|
+
});
|
|
468
|
+
return longFormDidUri;
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Constructs a Sidetree Create Operation request for a DID document within the ION network.
|
|
473
|
+
*
|
|
474
|
+
* This method prepares the necessary payload for submitting a Create Operation to a Sidetree
|
|
475
|
+
* node, encapsulating the details of the DID document, recovery key, and update key.
|
|
476
|
+
*
|
|
477
|
+
* @param params - Parameters required to construct the Create Operation request.
|
|
478
|
+
* @param params.ionDocument - The DID document model containing public keys and service endpoints.
|
|
479
|
+
* @param params.recoveryKey - The recovery public key in JWK format.
|
|
480
|
+
* @param params.updateKey - The update public key in JWK format.
|
|
481
|
+
* @returns A promise resolving to the ION Create Operation request model, ready for submission to a Sidetree node.
|
|
482
|
+
*/
|
|
483
|
+
static constructCreateRequest(_a) {
|
|
484
|
+
return __awaiter(this, arguments, void 0, function* ({ ionDocument, recoveryKey, updateKey }) {
|
|
485
|
+
// Create an ION DID create request operation.
|
|
486
|
+
const createRequest = yield IonRequest.createCreateRequest({
|
|
487
|
+
document: ionDocument,
|
|
488
|
+
recoveryKey: DidIonUtils.normalizeJwk(recoveryKey),
|
|
489
|
+
updateKey: DidIonUtils.normalizeJwk(updateKey)
|
|
490
|
+
});
|
|
491
|
+
return createRequest;
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Assembles an ION document model from provided services and verification methods
|
|
496
|
+
*
|
|
497
|
+
* This model serves as the foundation for a DID document in the ION network, facilitating the
|
|
498
|
+
* creation and management of decentralized identities. It translates service endpoints and
|
|
499
|
+
* public keys into a format compatible with the Sidetree protocol, ensuring the resulting DID
|
|
500
|
+
* document adheres to the required specifications for ION DIDs. This method is essential for
|
|
501
|
+
* constructing the payload needed to register or update DIDs within the ION network.
|
|
502
|
+
*
|
|
503
|
+
* @param params - The parameters containing the services and verification methods to include in the ION document.
|
|
504
|
+
* @param params.services - A list of service endpoints to be included in the DID document, specifying ways to interact with the DID subject.
|
|
505
|
+
* @param params.verificationMethods - A list of verification methods to be included, detailing the cryptographic keys and their intended uses within the DID document.
|
|
506
|
+
* @returns A Promise resolving to an `IonDocumentModel`, ready for use in Sidetree operations like DID creation and updates.
|
|
507
|
+
*/
|
|
508
|
+
static createIonDocument(_a) {
|
|
509
|
+
return __awaiter(this, arguments, void 0, function* ({ services, verificationMethods }) {
|
|
510
|
+
var _b, _c;
|
|
511
|
+
/**
|
|
512
|
+
* STEP 1: Convert verification methods to ION SDK format.
|
|
513
|
+
*/
|
|
514
|
+
const ionPublicKeys = [];
|
|
515
|
+
for (const vm of verificationMethods) {
|
|
516
|
+
// Use the given ID, the key's ID, or the key's thumbprint as the verification method ID.
|
|
517
|
+
let methodId = (_c = (_b = vm.id) !== null && _b !== void 0 ? _b : vm.publicKeyJwk.kid) !== null && _c !== void 0 ? _c : yield computeJwkThumbprint({ jwk: vm.publicKeyJwk });
|
|
518
|
+
methodId = `${methodId.split('#').pop()}`; // Remove fragment prefix, if any.
|
|
519
|
+
// Convert public key JWK to ION format.
|
|
520
|
+
const publicKey = {
|
|
521
|
+
id: methodId,
|
|
522
|
+
publicKeyJwk: DidIonUtils.normalizeJwk(vm.publicKeyJwk),
|
|
523
|
+
purposes: vm.purposes,
|
|
524
|
+
type: 'JsonWebKey2020'
|
|
525
|
+
};
|
|
526
|
+
ionPublicKeys.push(publicKey);
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* STEP 2: Convert service entries, if any, to ION SDK format.
|
|
530
|
+
*/
|
|
531
|
+
const ionServices = services.map(service => (Object.assign(Object.assign({}, service), { id: `${service.id.split('#').pop()}` // Remove fragment prefix, if any.
|
|
532
|
+
})));
|
|
533
|
+
/**
|
|
534
|
+
* STEP 3: Format as ION document.
|
|
535
|
+
*/
|
|
536
|
+
const ionDocumentModel = {
|
|
537
|
+
publicKeys: ionPublicKeys,
|
|
538
|
+
services: ionServices
|
|
539
|
+
};
|
|
540
|
+
return ionDocumentModel;
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Normalize the given JWK to include only specific members and in lexicographic order.
|
|
545
|
+
*
|
|
546
|
+
* @param jwk - The JWK to normalize.
|
|
547
|
+
* @returns The normalized JWK.
|
|
548
|
+
*/
|
|
549
|
+
static normalizeJwk(jwk) {
|
|
550
|
+
const keyType = jwk.kty;
|
|
551
|
+
let normalizedJwk;
|
|
552
|
+
if (keyType === 'EC') {
|
|
553
|
+
normalizedJwk = { crv: jwk.crv, kty: jwk.kty, x: jwk.x, y: jwk.y };
|
|
554
|
+
}
|
|
555
|
+
else if (keyType === 'oct') {
|
|
556
|
+
normalizedJwk = { k: jwk.k, kty: jwk.kty };
|
|
557
|
+
}
|
|
558
|
+
else if (keyType === 'OKP') {
|
|
559
|
+
normalizedJwk = { crv: jwk.crv, kty: jwk.kty, x: jwk.x };
|
|
560
|
+
}
|
|
561
|
+
else if (keyType === 'RSA') {
|
|
562
|
+
normalizedJwk = { e: jwk.e, kty: jwk.kty, n: jwk.n };
|
|
563
|
+
}
|
|
564
|
+
else {
|
|
565
|
+
throw new Error(`Unsupported key type: ${keyType}`);
|
|
566
|
+
}
|
|
567
|
+
return normalizedJwk;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
//# sourceMappingURL=did-ion.js.map
|