@interop/edv-client 17.0.0
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 +27 -0
- package/README.md +276 -0
- package/dist/EdvClient.d.ts +412 -0
- package/dist/EdvClient.d.ts.map +1 -0
- package/dist/EdvClient.js +663 -0
- package/dist/EdvClient.js.map +1 -0
- package/dist/EdvClientCore.d.ts +264 -0
- package/dist/EdvClientCore.d.ts.map +1 -0
- package/dist/EdvClientCore.js +698 -0
- package/dist/EdvClientCore.js.map +1 -0
- package/dist/EdvDocument.d.ts +92 -0
- package/dist/EdvDocument.d.ts.map +1 -0
- package/dist/EdvDocument.js +149 -0
- package/dist/EdvDocument.js.map +1 -0
- package/dist/HttpsTransport.d.ts +87 -0
- package/dist/HttpsTransport.d.ts.map +1 -0
- package/dist/HttpsTransport.js +415 -0
- package/dist/HttpsTransport.js.map +1 -0
- package/dist/IndexHelper.d.ts +163 -0
- package/dist/IndexHelper.d.ts.map +1 -0
- package/dist/IndexHelper.js +539 -0
- package/dist/IndexHelper.js.map +1 -0
- package/dist/LegacyIndexHelperVersion1.d.ts +150 -0
- package/dist/LegacyIndexHelperVersion1.d.ts.map +1 -0
- package/dist/LegacyIndexHelperVersion1.js +475 -0
- package/dist/LegacyIndexHelperVersion1.js.map +1 -0
- package/dist/Transport.d.ts +142 -0
- package/dist/Transport.d.ts.map +1 -0
- package/dist/Transport.js +181 -0
- package/dist/Transport.js.map +1 -0
- package/dist/assert.d.ts +6 -0
- package/dist/assert.d.ts.map +1 -0
- package/dist/assert.js +61 -0
- package/dist/assert.js.map +1 -0
- package/dist/baseX.d.ts +7 -0
- package/dist/baseX.d.ts.map +1 -0
- package/dist/baseX.js +8 -0
- package/dist/baseX.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/util.d.ts +3 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +13 -0
- package/dist/util.js.map +1 -0
- package/package.json +112 -0
|
@@ -0,0 +1,663 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2018-2025 Digital Bazaar, Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { assert, assertInvocationSigner } from './assert.js';
|
|
5
|
+
import { DEFAULT_HEADERS } from '@interop/http-client';
|
|
6
|
+
import { EdvClientCore } from './EdvClientCore.js';
|
|
7
|
+
import { HttpsTransport } from './HttpsTransport.js';
|
|
8
|
+
/**
|
|
9
|
+
* Note: An Encrypted Data Vault (EDV) server MUST expose an HTTPS API with a
|
|
10
|
+
* URL structure that is partitioned like so:
|
|
11
|
+
*
|
|
12
|
+
* <edvID>/documents/<documentID> .
|
|
13
|
+
*
|
|
14
|
+
* The <edvID> must take the form:
|
|
15
|
+
*
|
|
16
|
+
* <authority>/edvs/<multibase base58 multihash encoded random ID> .
|
|
17
|
+
*/
|
|
18
|
+
export class EdvClient extends EdvClientCore {
|
|
19
|
+
capability;
|
|
20
|
+
invocationSigner;
|
|
21
|
+
httpsAgent;
|
|
22
|
+
defaultHeaders;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new EdvClient for connecting to an Encrypted Data Vault (EDV).
|
|
25
|
+
*
|
|
26
|
+
* @param {object} options - The options to use.
|
|
27
|
+
* @param {object} [options.capability] - An authorization capability
|
|
28
|
+
* (zcap) to use that will work with every method called on the client
|
|
29
|
+
* with the exception of `revokeCapability`, where a capability must be
|
|
30
|
+
* passed to that function if the root zcap is not to be invoked.
|
|
31
|
+
* @param {object} [options.defaultHeaders] - Default HTTP headers to use
|
|
32
|
+
* with HTTPS requests.
|
|
33
|
+
* @param {HttpsAgent} [options.httpsAgent] - A HttpsAgent to use to handle
|
|
34
|
+
* HTTPS requests.
|
|
35
|
+
* @param {object} [options.hmac] - A default HMAC API for blinding
|
|
36
|
+
* indexable attributes.
|
|
37
|
+
* @param {object} [options.invocationSigner] - An object with an
|
|
38
|
+
* `id` property and a `sign` function for signing capability invocations.
|
|
39
|
+
* @param {string} [options.id] - The ID of the EDV that must be a
|
|
40
|
+
* URL that refers to the EDV's root storage location; if not given, then
|
|
41
|
+
* a separate capability must be given here that can be used for each
|
|
42
|
+
* method to be called -- or a separate capability must be given to each
|
|
43
|
+
* called method directly.
|
|
44
|
+
* @param {object} [options.keyAgreementKey] - A default KeyAgreementKey
|
|
45
|
+
* API for deriving shared KEKs for wrapping content encryption keys.
|
|
46
|
+
* @param {Function} [options.keyResolver] - A default function that returns
|
|
47
|
+
* a Promise that resolves a key ID to a DH public key.
|
|
48
|
+
* @param {string} [options.cipherVersion='recommended'] - Sets the cipher
|
|
49
|
+
* version to either "recommended" or "fips".
|
|
50
|
+
* @param {string} [options._attributeVersion] - Sets the blinded attribute
|
|
51
|
+
* version to use; for internal use only.
|
|
52
|
+
*
|
|
53
|
+
* @returns {EdvClient} An EdvClient instance.
|
|
54
|
+
*/
|
|
55
|
+
constructor({ capability, defaultHeaders, hmac, id, invocationSigner, httpsAgent, keyAgreementKey, keyResolver, cipherVersion = 'recommended', _attributeVersion } = {}) {
|
|
56
|
+
if (capability !== undefined) {
|
|
57
|
+
assert(capability, 'capability', 'object');
|
|
58
|
+
if (!id) {
|
|
59
|
+
// parse EDV ID from `capability`
|
|
60
|
+
id = EdvClient._parseEdvId({ capability });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (invocationSigner !== undefined) {
|
|
64
|
+
assertInvocationSigner(invocationSigner);
|
|
65
|
+
}
|
|
66
|
+
super({
|
|
67
|
+
hmac,
|
|
68
|
+
id,
|
|
69
|
+
keyAgreementKey,
|
|
70
|
+
keyResolver,
|
|
71
|
+
cipherVersion,
|
|
72
|
+
_attributeVersion
|
|
73
|
+
});
|
|
74
|
+
// a future version could set a default transport here to wrap this, but
|
|
75
|
+
// it would be a breaking change
|
|
76
|
+
this.capability = capability;
|
|
77
|
+
this.invocationSigner = invocationSigner;
|
|
78
|
+
this.httpsAgent = httpsAgent;
|
|
79
|
+
this.defaultHeaders = { ...DEFAULT_HEADERS, ...defaultHeaders };
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* @inheritdoc
|
|
83
|
+
*
|
|
84
|
+
* @param {object} options - The options to use.
|
|
85
|
+
* @param {object} options.doc - The document to insert.
|
|
86
|
+
* @param {ReadableStream} [options.stream] - A WHATWG Readable stream to read
|
|
87
|
+
* from to associate chunked data with this document.
|
|
88
|
+
* @param {number} [options.chunkSize=1048576] - The size, in bytes, of the
|
|
89
|
+
* chunks to break the incoming stream data into.
|
|
90
|
+
* @param {object[]} [options.recipients=[]] - A set of JWE recipients
|
|
91
|
+
* to encrypt the document for; if not present, a default recipient will
|
|
92
|
+
* be added using `this.keyAgreementKey` and if no `keyAgreementKey` is
|
|
93
|
+
* set, an error will be thrown.
|
|
94
|
+
* @param {Function} [options.keyResolver=this.keyResolver] - A function that
|
|
95
|
+
* returns a Promise that resolves a key ID to a DH public key.
|
|
96
|
+
* @param {object} [options.keyAgreementKey=this.keyAgreementKey] - A
|
|
97
|
+
* KeyAgreementKey API for deriving shared KEKs for wrapping content
|
|
98
|
+
* encryption keys.
|
|
99
|
+
* @param {object} [options.hmac=this.hmac] - An HMAC API for blinding
|
|
100
|
+
* indexable attributes.
|
|
101
|
+
* @param {object|string} [options.capability=this.capability] - The
|
|
102
|
+
* authorization capability (zcap) to use to authorize the operation.
|
|
103
|
+
* @param {object} [options.invocationSigner=this.invocationSigner] - An API
|
|
104
|
+
* with an `id` property and a `sign` function for signing a capability
|
|
105
|
+
* invocation.
|
|
106
|
+
*
|
|
107
|
+
* @returns {Promise<object>} - Resolves to the inserted document.
|
|
108
|
+
*/
|
|
109
|
+
async insert({ doc, stream, chunkSize, recipients = [], keyResolver = this.keyResolver, keyAgreementKey = this.keyAgreementKey, hmac = this.hmac, capability = this.capability, invocationSigner = this.invocationSigner } = {}) {
|
|
110
|
+
assertInvocationSigner(invocationSigner);
|
|
111
|
+
const { defaultHeaders, httpsAgent, id: edvId } = this;
|
|
112
|
+
const transport = new HttpsTransport({
|
|
113
|
+
capability,
|
|
114
|
+
defaultHeaders,
|
|
115
|
+
edvId,
|
|
116
|
+
httpsAgent,
|
|
117
|
+
invocationSigner
|
|
118
|
+
});
|
|
119
|
+
return super.insert({
|
|
120
|
+
doc,
|
|
121
|
+
stream,
|
|
122
|
+
chunkSize,
|
|
123
|
+
recipients,
|
|
124
|
+
keyResolver,
|
|
125
|
+
keyAgreementKey,
|
|
126
|
+
hmac,
|
|
127
|
+
transport
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* @inheritdoc
|
|
132
|
+
*
|
|
133
|
+
* @param {object} options - The options to use.
|
|
134
|
+
* @param {object} options.doc - The document to insert.
|
|
135
|
+
* @param {ReadableStream} [options.stream] - A WHATWG Readable stream to read
|
|
136
|
+
* from to associate chunked data with this document.
|
|
137
|
+
* @param {number} [options.chunkSize=1048576] - The size, in bytes, of the
|
|
138
|
+
* chunks to break the incoming stream data into.
|
|
139
|
+
* @param {object} [options.recipients=[]] - A set of JWE recipients to
|
|
140
|
+
* encrypt the document for; if present, recipients will be added to any
|
|
141
|
+
* existing recipients; to remove existing recipients, modify the
|
|
142
|
+
* `encryptedDoc.jwe.recipients` field.
|
|
143
|
+
* @param {Function} [options.keyResolver=this.keyResolver] - A function that
|
|
144
|
+
* returns a Promise that resolves a key ID to a DH public key.
|
|
145
|
+
* @param {object} [options.keyAgreementKey=this.keyAgreementKey] - A
|
|
146
|
+
* KeyAgreementKey API for deriving shared KEKs for wrapping content
|
|
147
|
+
* encryption keys.
|
|
148
|
+
* @param {object} [options.hmac=this.hmac] - An HMAC API for blinding
|
|
149
|
+
* indexable attributes.
|
|
150
|
+
* @param {object|string} [options.capability=this.capability] - The
|
|
151
|
+
* authorization capability (zcap) to use to authorize the operation.
|
|
152
|
+
* @param {object} [options.invocationSigner=this.invocationSigner] - An API
|
|
153
|
+
* with an `id` property and a `sign` function for signing a capability
|
|
154
|
+
* invocation.
|
|
155
|
+
*
|
|
156
|
+
* @returns {Promise<object>} - Resolves to the updated document.
|
|
157
|
+
*/
|
|
158
|
+
async update({ doc, stream, chunkSize, recipients = [], keyResolver = this.keyResolver, keyAgreementKey = this.keyAgreementKey, hmac = this.hmac, capability = this.capability, invocationSigner = this.invocationSigner } = {}) {
|
|
159
|
+
assertInvocationSigner(invocationSigner);
|
|
160
|
+
const { defaultHeaders, httpsAgent, id: edvId } = this;
|
|
161
|
+
const transport = new HttpsTransport({
|
|
162
|
+
capability,
|
|
163
|
+
defaultHeaders,
|
|
164
|
+
edvId,
|
|
165
|
+
httpsAgent,
|
|
166
|
+
invocationSigner
|
|
167
|
+
});
|
|
168
|
+
return super.update({
|
|
169
|
+
doc,
|
|
170
|
+
stream,
|
|
171
|
+
chunkSize,
|
|
172
|
+
recipients,
|
|
173
|
+
keyResolver,
|
|
174
|
+
keyAgreementKey,
|
|
175
|
+
hmac,
|
|
176
|
+
transport
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* @inheritdoc
|
|
181
|
+
*
|
|
182
|
+
* @param {object} options - The options to use.
|
|
183
|
+
* @param {object} options.doc - The document to create or update an index
|
|
184
|
+
* for.
|
|
185
|
+
* @param {object} [options.hmac=this.hmac] - An HMAC API for blinding
|
|
186
|
+
* indexable attributes.
|
|
187
|
+
* @param {object|string} [options.capability=this.capability] - The
|
|
188
|
+
* authorization capability (zcap) to use to authorize the operation.
|
|
189
|
+
* @param {object} [options.invocationSigner=this.invocationSigner] - An API
|
|
190
|
+
* with an `id` property and a `sign` function for signing a capability
|
|
191
|
+
* invocation.
|
|
192
|
+
*
|
|
193
|
+
* @returns {Promise} - Resolves once the operation completes.
|
|
194
|
+
*/
|
|
195
|
+
async updateIndex({ doc, hmac = this.hmac, capability = this.capability, invocationSigner = this.invocationSigner } = {}) {
|
|
196
|
+
assertInvocationSigner(invocationSigner);
|
|
197
|
+
const { defaultHeaders, httpsAgent, id: edvId } = this;
|
|
198
|
+
const transport = new HttpsTransport({
|
|
199
|
+
capability,
|
|
200
|
+
defaultHeaders,
|
|
201
|
+
edvId,
|
|
202
|
+
httpsAgent,
|
|
203
|
+
invocationSigner
|
|
204
|
+
});
|
|
205
|
+
return super.updateIndex({ doc, hmac, transport });
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* @inheritdoc
|
|
209
|
+
*
|
|
210
|
+
* @param {object} options - The options to use.
|
|
211
|
+
* @param {object} options.doc - The document to delete.
|
|
212
|
+
* @param {object} [options.recipients=[]] - A set of JWE recipients to
|
|
213
|
+
* encrypt the document for; if present, recipients will be added to
|
|
214
|
+
* any existing recipients; to remove existing recipients, modify
|
|
215
|
+
* the `encryptedDoc.jwe.recipients` field.
|
|
216
|
+
* @param {object|string} [options.capability=this.capability] - The
|
|
217
|
+
* authorization capability (zcap) to use to authorize the operation.
|
|
218
|
+
* @param {object} [options.invocationSigner=this.invocationSigner] - An API
|
|
219
|
+
* with an `id` property and a `sign` function for signing a capability
|
|
220
|
+
* invocation.
|
|
221
|
+
* @param {Function} [options.keyResolver=this.keyResolver] - A function that
|
|
222
|
+
* returns a Promise that resolves a key ID to a DH public key.
|
|
223
|
+
* @param {object} [options.keyAgreementKey=this.keyAgreementKey] - A
|
|
224
|
+
* KeyAgreementKey API for deriving shared KEKs for wrapping content
|
|
225
|
+
* encryption keys.
|
|
226
|
+
*
|
|
227
|
+
* @returns {Promise<boolean>} - Resolves to `true` if the document was
|
|
228
|
+
* deleted.
|
|
229
|
+
*/
|
|
230
|
+
async delete({ doc, recipients = [], capability = this.capability, invocationSigner = this.invocationSigner, keyResolver = this.keyResolver, keyAgreementKey = this.keyAgreementKey } = {}) {
|
|
231
|
+
assertInvocationSigner(invocationSigner);
|
|
232
|
+
const { defaultHeaders, httpsAgent, id: edvId } = this;
|
|
233
|
+
const transport = new HttpsTransport({
|
|
234
|
+
capability,
|
|
235
|
+
defaultHeaders,
|
|
236
|
+
edvId,
|
|
237
|
+
httpsAgent,
|
|
238
|
+
invocationSigner
|
|
239
|
+
});
|
|
240
|
+
return super.delete({
|
|
241
|
+
doc,
|
|
242
|
+
recipients,
|
|
243
|
+
keyResolver,
|
|
244
|
+
keyAgreementKey,
|
|
245
|
+
transport
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* @inheritdoc
|
|
250
|
+
*
|
|
251
|
+
* @param {object} options - The options to use.
|
|
252
|
+
* @param {string} options.id - The ID of the document to get.
|
|
253
|
+
* @param {object} [options.keyAgreementKey=this.keyAgreementKey] - A
|
|
254
|
+
* KeyAgreementKey API for deriving a shared KEK to unwrap the content
|
|
255
|
+
* encryption key.
|
|
256
|
+
* @param {object|string} [options.capability=this.capability] - The
|
|
257
|
+
* authorization capability (zcap) to use to authorize the operation.
|
|
258
|
+
* @param {object} [options.invocationSigner=this.invocationSigner] - An API
|
|
259
|
+
* with an `id` property and a `sign` function for signing a capability
|
|
260
|
+
* invocation.
|
|
261
|
+
*
|
|
262
|
+
* @returns {Promise<object>} - Resolves to the document.
|
|
263
|
+
*/
|
|
264
|
+
async get({ id, keyAgreementKey = this.keyAgreementKey, capability = this.capability, invocationSigner = this.invocationSigner } = {}) {
|
|
265
|
+
assertInvocationSigner(invocationSigner);
|
|
266
|
+
const { defaultHeaders, httpsAgent, id: edvId } = this;
|
|
267
|
+
const transport = new HttpsTransport({
|
|
268
|
+
capability,
|
|
269
|
+
defaultHeaders,
|
|
270
|
+
edvId,
|
|
271
|
+
httpsAgent,
|
|
272
|
+
invocationSigner
|
|
273
|
+
});
|
|
274
|
+
return super.get({ id, keyAgreementKey, transport });
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* @inheritdoc
|
|
278
|
+
*
|
|
279
|
+
* @param {object} options - The options to use.
|
|
280
|
+
* @param {object} options.doc - The document to get a stream for.
|
|
281
|
+
* @param {object} [options.keyAgreementKey=this.keyAgreementKey] - A
|
|
282
|
+
* KeyAgreementKey API for deriving a shared KEK to unwrap the content
|
|
283
|
+
* encryption key.
|
|
284
|
+
* @param {object|string} [options.capability=this.capability] - The
|
|
285
|
+
* authorization capability (zcap) to use to authorize the operation.
|
|
286
|
+
* @param {object} [options.invocationSigner=this.invocationSigner] - An API
|
|
287
|
+
* with an `id` property and a `sign` function for signing a capability
|
|
288
|
+
* invocation.
|
|
289
|
+
*
|
|
290
|
+
* @returns {Promise<ReadableStream>} - Resolves to a `ReadableStream` to read
|
|
291
|
+
* the chunked data from.
|
|
292
|
+
*/
|
|
293
|
+
async getStream({ doc, keyAgreementKey = this.keyAgreementKey, capability = this.capability, invocationSigner = this.invocationSigner } = {}) {
|
|
294
|
+
assertInvocationSigner(invocationSigner);
|
|
295
|
+
const { defaultHeaders, httpsAgent, id: edvId } = this;
|
|
296
|
+
const transport = new HttpsTransport({
|
|
297
|
+
capability,
|
|
298
|
+
defaultHeaders,
|
|
299
|
+
edvId,
|
|
300
|
+
httpsAgent,
|
|
301
|
+
invocationSigner
|
|
302
|
+
});
|
|
303
|
+
return super.getStream({ doc, keyAgreementKey, transport });
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* @inheritdoc
|
|
307
|
+
*
|
|
308
|
+
* @see find - For more detailed documentation on the search options.
|
|
309
|
+
*
|
|
310
|
+
* @param {object} options - The options to use.
|
|
311
|
+
* @param {object} [options.keyAgreementKey=this.keyAgreementKey] - A
|
|
312
|
+
* KeyAgreementKey API for deriving a shared KEK to unwrap the content
|
|
313
|
+
* encryption key.
|
|
314
|
+
* @param {object} [options.hmac=this.hmac] - An HMAC API for blinding
|
|
315
|
+
* indexable attributes.
|
|
316
|
+
* @param {object|Array} [options.equals] - An object with key-value
|
|
317
|
+
* attribute pairs to match or an array of such objects.
|
|
318
|
+
* @param {string|Array} [options.has] - A string with an attribute name to
|
|
319
|
+
* match or an array of such strings.
|
|
320
|
+
* @param {object|string} [options.capability=this.capability] - The
|
|
321
|
+
* authorization capability (zcap) to use to authorize the operation.
|
|
322
|
+
* @param {object} [options.invocationSigner=this.invocationSigner] - An API
|
|
323
|
+
* with an `id` property and a `sign` function for signing a capability
|
|
324
|
+
* invocation.
|
|
325
|
+
*
|
|
326
|
+
* @returns {Promise<number>} - Resolves to the number of matching documents.
|
|
327
|
+
*/
|
|
328
|
+
async count({ keyAgreementKey = this.keyAgreementKey, hmac = this.hmac, equals, has, capability = this.capability, invocationSigner = this.invocationSigner } = {}) {
|
|
329
|
+
assertInvocationSigner(invocationSigner);
|
|
330
|
+
const { defaultHeaders, httpsAgent, id: edvId } = this;
|
|
331
|
+
const transport = new HttpsTransport({
|
|
332
|
+
capability,
|
|
333
|
+
defaultHeaders,
|
|
334
|
+
edvId,
|
|
335
|
+
httpsAgent,
|
|
336
|
+
invocationSigner
|
|
337
|
+
});
|
|
338
|
+
return super.count({ keyAgreementKey, hmac, equals, has, transport });
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* @inheritdoc
|
|
342
|
+
*
|
|
343
|
+
* @param {object} options - The options to use.
|
|
344
|
+
* @param {object} [options.keyAgreementKey=this.keyAgreementKey] - A
|
|
345
|
+
* KeyAgreementKey API for deriving a shared KEK to unwrap the content
|
|
346
|
+
* encryption key.
|
|
347
|
+
* @param {object} [options.hmac=this.hmac] - An HMAC API for blinding
|
|
348
|
+
* indexable attributes.
|
|
349
|
+
* @param {object|Array} [options.equals] - An object with key-value
|
|
350
|
+
* attribute pairs to match or an array of such objects.
|
|
351
|
+
* @param {string|Array} [options.has] - A string with an attribute name to
|
|
352
|
+
* match or an array of such strings.
|
|
353
|
+
* @param {object|string} [options.capability=this.capability] - The
|
|
354
|
+
* authorization capability (zcap) to use to authorize the operation.
|
|
355
|
+
* @param {object} [options.invocationSigner=this.invocationSigner] - An API
|
|
356
|
+
* with an `id` property and a `sign` function for signing a capability
|
|
357
|
+
* invocation.
|
|
358
|
+
* @param {boolean} [options.returnDocuments] - Set to `false` to
|
|
359
|
+
* request only document IDs from the server (not full documents); note
|
|
360
|
+
* that a server that does not accept this option will return full
|
|
361
|
+
* documents, so either return value is possible.
|
|
362
|
+
* @param {boolean} [options.count] - Set to `false` to find all documents
|
|
363
|
+
* that match a query or to `true` to give a count of documents.
|
|
364
|
+
* @param {number} [options.limit] - Set to limit the number of documents
|
|
365
|
+
* to be returned from a query (min=1, max=1000).
|
|
366
|
+
*
|
|
367
|
+
* @returns {Promise<object>} - Resolves to the matching documents:
|
|
368
|
+
* {documents: [...]} OR to the matching document IDs, if requested
|
|
369
|
+
* and supported by the server: {documentIds: [...]}.
|
|
370
|
+
*/
|
|
371
|
+
async find({ keyAgreementKey = this.keyAgreementKey, hmac = this.hmac, equals, has, capability = this.capability, invocationSigner = this.invocationSigner, returnDocuments, count = false, limit } = {}) {
|
|
372
|
+
assertInvocationSigner(invocationSigner);
|
|
373
|
+
const { defaultHeaders, httpsAgent, id: edvId } = this;
|
|
374
|
+
const transport = new HttpsTransport({
|
|
375
|
+
capability,
|
|
376
|
+
defaultHeaders,
|
|
377
|
+
edvId,
|
|
378
|
+
httpsAgent,
|
|
379
|
+
invocationSigner
|
|
380
|
+
});
|
|
381
|
+
return super.find({
|
|
382
|
+
keyAgreementKey,
|
|
383
|
+
hmac,
|
|
384
|
+
equals,
|
|
385
|
+
has,
|
|
386
|
+
returnDocuments,
|
|
387
|
+
count,
|
|
388
|
+
limit,
|
|
389
|
+
transport
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* @inheritdoc
|
|
394
|
+
*
|
|
395
|
+
* @param {object} options - The options to use.
|
|
396
|
+
* @param {object|string} [options.capability=this.capability] - The
|
|
397
|
+
* authorization capability (zcap) to use to authorize the operation.
|
|
398
|
+
* @param {object} [options.headers] - An optional
|
|
399
|
+
* headers object to use when making requests.
|
|
400
|
+
* @param {object} [options.invocationSigner=this.invocationSigner] - An API
|
|
401
|
+
* with an `id` property and a `sign` function for signing a capability
|
|
402
|
+
* invocation.
|
|
403
|
+
*
|
|
404
|
+
* @returns {Promise<object>} - Resolves to the configuration for the EDV.
|
|
405
|
+
*/
|
|
406
|
+
async getConfig({ capability = this.capability, headers, invocationSigner = this.invocationSigner } = {}) {
|
|
407
|
+
const { defaultHeaders, httpsAgent, id: edvId } = this;
|
|
408
|
+
const transport = new HttpsTransport({
|
|
409
|
+
capability,
|
|
410
|
+
defaultHeaders: { ...defaultHeaders, ...headers },
|
|
411
|
+
edvId,
|
|
412
|
+
httpsAgent,
|
|
413
|
+
invocationSigner
|
|
414
|
+
});
|
|
415
|
+
return super.getConfig({ transport });
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* @inheritdoc
|
|
419
|
+
*
|
|
420
|
+
* @param {object} options - The options to use.
|
|
421
|
+
* @param {object} options.config - The new EDV config.
|
|
422
|
+
* @param {object|string} [options.capability=this.capability] - The
|
|
423
|
+
* authorization capability (zcap) to use to authorize the operation.
|
|
424
|
+
* @param {object} [options.headers] - An optional headers object to use when
|
|
425
|
+
* making requests.
|
|
426
|
+
* @param {object} [options.invocationSigner=this.invocationSigner] - An API
|
|
427
|
+
* with an `id` property and a `sign` function for signing a capability
|
|
428
|
+
* invocation.
|
|
429
|
+
*
|
|
430
|
+
* @returns {Promise<void>} - Resolves once the operation completes.
|
|
431
|
+
*/
|
|
432
|
+
async updateConfig({ config, capability = this.capability, headers, invocationSigner = this.invocationSigner } = {}) {
|
|
433
|
+
assertInvocationSigner(invocationSigner);
|
|
434
|
+
const { defaultHeaders, httpsAgent, id: edvId } = this;
|
|
435
|
+
const transport = new HttpsTransport({
|
|
436
|
+
capability,
|
|
437
|
+
defaultHeaders: { ...defaultHeaders, ...headers },
|
|
438
|
+
edvId,
|
|
439
|
+
httpsAgent,
|
|
440
|
+
invocationSigner
|
|
441
|
+
});
|
|
442
|
+
return super.updateConfig({ config, transport });
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Revoke an authorization capability (zcap). If no `capability` is passed,
|
|
446
|
+
* then the root zcap for the revocation endpoint will be invoked.
|
|
447
|
+
*
|
|
448
|
+
* @param {object} options - The options to use.
|
|
449
|
+
* @param {object} options.capabilityToRevoke - The capability to revoke.
|
|
450
|
+
* @param {object|string} [options.capability] - The authorization capability
|
|
451
|
+
* (zcap) to use to authorize the operation.
|
|
452
|
+
* @param {object} options.invocationSigner - An API with an
|
|
453
|
+
* `id` property and a `sign` function for signing a capability invocation.
|
|
454
|
+
*
|
|
455
|
+
* @returns {Promise<object>} Resolves once the operation completes.
|
|
456
|
+
*/
|
|
457
|
+
async revokeCapability({ capabilityToRevoke, capability, invocationSigner } = {}) {
|
|
458
|
+
assertInvocationSigner(invocationSigner);
|
|
459
|
+
const { defaultHeaders, httpsAgent, id: edvId } = this;
|
|
460
|
+
const transport = new HttpsTransport({
|
|
461
|
+
capability,
|
|
462
|
+
defaultHeaders,
|
|
463
|
+
edvId,
|
|
464
|
+
httpsAgent,
|
|
465
|
+
invocationSigner
|
|
466
|
+
});
|
|
467
|
+
// no `super` method for revoking a zcap, call on `transport`
|
|
468
|
+
return transport.revokeCapability({ capabilityToRevoke });
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Parses an EDV ID from a capability's invocation target.
|
|
472
|
+
*
|
|
473
|
+
* @param {object} options - The options to use.
|
|
474
|
+
* @param {object|string} options.capability - The authorization capability
|
|
475
|
+
* (zcap) to parse the EDV ID from.
|
|
476
|
+
*
|
|
477
|
+
* @returns {string} - The ID of the EDV.
|
|
478
|
+
*/
|
|
479
|
+
parseEdvId({ capability } = {}) {
|
|
480
|
+
return EdvClient._parseEdvId({ capability });
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Creates a new EDV using the given configuration.
|
|
484
|
+
*
|
|
485
|
+
* @param {object} options - The options to use.
|
|
486
|
+
* @param {string} options.url - The url to post the configuration to.
|
|
487
|
+
* @param {string} options.config - The EDV's configuration.
|
|
488
|
+
* @param {object|string} [options.capability] - The authorization capability
|
|
489
|
+
* (zcap) to use to authorize the operation.
|
|
490
|
+
* @param {object} [options.headers=undefined] - An optional
|
|
491
|
+
* headers object to use when making requests.
|
|
492
|
+
* @param {HttpsAgent} [options.httpsAgent=undefined] - An optional
|
|
493
|
+
* node.js `https.Agent` instance to use when making requests.
|
|
494
|
+
* @param {object} [options.invocationSigner] - An object with an
|
|
495
|
+
* `id` property and a `sign` function for signing a capability invocation.
|
|
496
|
+
*
|
|
497
|
+
* @returns {Promise<object>} - Resolves to the configuration for the newly
|
|
498
|
+
* created EDV.
|
|
499
|
+
*/
|
|
500
|
+
static async createEdv({ url, config, capability, httpsAgent, headers, invocationSigner } = {}) {
|
|
501
|
+
const transport = new HttpsTransport({
|
|
502
|
+
url,
|
|
503
|
+
capability,
|
|
504
|
+
defaultHeaders: headers,
|
|
505
|
+
httpsAgent,
|
|
506
|
+
invocationSigner
|
|
507
|
+
});
|
|
508
|
+
return transport.createEdv({ config });
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Gets the EDV config for the given controller and reference ID.
|
|
512
|
+
*
|
|
513
|
+
* @param {object} options - The options to use.
|
|
514
|
+
* @param {string} options.url - The url to query.
|
|
515
|
+
* @param {string} options.controller - The ID of the controller.
|
|
516
|
+
* @param {string} options.referenceId - A controller-unique reference ID.
|
|
517
|
+
* @param {HttpsAgent} [options.httpsAgent] - An optional
|
|
518
|
+
* node.js `https.Agent` instance to use when making requests.
|
|
519
|
+
* @param {object} [options.headers] - An optional
|
|
520
|
+
* headers object to use when making requests.
|
|
521
|
+
* @param {object} [options.invocationSigner] - An object with an
|
|
522
|
+
* `id` property and a `sign` function for signing a capability invocation.
|
|
523
|
+
* @param {object|string} [options.capability] - The authorization capability
|
|
524
|
+
* (zcap) to use to authorize the operation.
|
|
525
|
+
*
|
|
526
|
+
* @returns {Promise<object>} - Resolves to the EDV configuration
|
|
527
|
+
* containing the given controller and reference ID.
|
|
528
|
+
*/
|
|
529
|
+
static async findConfig({ url, controller, referenceId, httpsAgent, invocationSigner, headers, capability } = {}) {
|
|
530
|
+
const results = await this.findConfigs({
|
|
531
|
+
url,
|
|
532
|
+
controller,
|
|
533
|
+
referenceId,
|
|
534
|
+
httpsAgent,
|
|
535
|
+
headers,
|
|
536
|
+
invocationSigner,
|
|
537
|
+
capability
|
|
538
|
+
});
|
|
539
|
+
return results[0] || null;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Get all EDV configurations matching a query.
|
|
543
|
+
*
|
|
544
|
+
* @param {object} options - The options to use.
|
|
545
|
+
* @param {string} options.url - The url to query.
|
|
546
|
+
* @param {string} options.controller - The EDV's controller.
|
|
547
|
+
* @param {string} [options.referenceId] - A controller-unique reference ID.
|
|
548
|
+
* @param {string} [options.after] - An EDV's ID.
|
|
549
|
+
* @param {number} [options.limit] - How many EDV configs to return.
|
|
550
|
+
* @param {HttpsAgent} [options.httpsAgent=undefined] - An optional
|
|
551
|
+
* node.js `https.Agent` instance to use when making requests.
|
|
552
|
+
* @param {object} [options.headers=undefined] - An optional
|
|
553
|
+
* headers object to use when making requests.
|
|
554
|
+
* @param {object} [options.invocationSigner] - An object with an
|
|
555
|
+
* `id` property and a `sign` function for signing a capability invocation.
|
|
556
|
+
* @param {object|string} [options.capability] - The authorization capability
|
|
557
|
+
* (zcap) to use to authorize the operation.
|
|
558
|
+
*
|
|
559
|
+
* @returns {Promise<Array>} - Resolves to the matching EDV configurations.
|
|
560
|
+
*/
|
|
561
|
+
static async findConfigs({ url, controller, referenceId, after, limit, httpsAgent, headers, capability, invocationSigner } = {}) {
|
|
562
|
+
const transport = new HttpsTransport({
|
|
563
|
+
url,
|
|
564
|
+
capability,
|
|
565
|
+
defaultHeaders: headers,
|
|
566
|
+
httpsAgent,
|
|
567
|
+
invocationSigner
|
|
568
|
+
});
|
|
569
|
+
return transport.findConfigs({ controller, referenceId, after, limit });
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Generates a multibase encoded random 128-bit identifier for a document.
|
|
573
|
+
*
|
|
574
|
+
* @returns {Promise<string>} - Resolves to the identifier.
|
|
575
|
+
*/
|
|
576
|
+
static async generateId() {
|
|
577
|
+
return EdvClientCore.generateId();
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Migrates all documents that match the given `equals` or `has` query
|
|
581
|
+
* from the attribute version configured for the `from` EdvClient instance
|
|
582
|
+
* to the attribute version configured for the `to` EdvClient instance.
|
|
583
|
+
*
|
|
584
|
+
* This method should be used with caution. It is not exposed as a public
|
|
585
|
+
* API (it is marked private by `_` convention).
|
|
586
|
+
*
|
|
587
|
+
* WARNING: Concurrent writes to an EDV store should be prevented while it is
|
|
588
|
+
* running if the operating environment cannot guarantee that uniqueness
|
|
589
|
+
* constraints will not be violated.
|
|
590
|
+
*
|
|
591
|
+
* WARNING: At present, this method will fail if the number of documents to
|
|
592
|
+
* be migrated exceeds a maximum of `999`.
|
|
593
|
+
*
|
|
594
|
+
* A more robust implementation may be provided in the future if further
|
|
595
|
+
* migrations are needed.
|
|
596
|
+
*
|
|
597
|
+
* @param {object} options - The options to use.
|
|
598
|
+
* @param {EdvClient} options.from - The EDV client instance configured to
|
|
599
|
+
* use the attribute version to convert from.
|
|
600
|
+
* @param {EdvClient} options.to - The EDV client instance configured to
|
|
601
|
+
* use the attribute version to convert to.
|
|
602
|
+
* @param {object|Array} [options.equals] - An object with key-value
|
|
603
|
+
* attribute pairs to match or an array of such objects.
|
|
604
|
+
* @param {string|Array} [options.has] - A string with an attribute name to
|
|
605
|
+
* match or an array of such strings.
|
|
606
|
+
*
|
|
607
|
+
* @returns {Promise} Resolves once the operation completes.
|
|
608
|
+
*/
|
|
609
|
+
static async _migrate({ from, to, equals, has } = {}) {
|
|
610
|
+
assert(from, 'from', 'object');
|
|
611
|
+
assert(to, 'to', 'object');
|
|
612
|
+
const { documents: docs } = await from.find({ equals, has, limit: 1000 });
|
|
613
|
+
if (docs.length >= 1000) {
|
|
614
|
+
throw new Error('Too many documents to migrate; limit is 999.');
|
|
615
|
+
}
|
|
616
|
+
// update docs in parallel chunks
|
|
617
|
+
const chunkSize = 5;
|
|
618
|
+
while (docs.length > 0) {
|
|
619
|
+
const chunk = docs.splice(0, chunkSize);
|
|
620
|
+
await Promise.all(chunk.map(async (doc) => to.update({ doc })));
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
// not used internally, but provided as a temporary backwards compatibility
|
|
624
|
+
// helper
|
|
625
|
+
_getDocUrl(id, capability) {
|
|
626
|
+
return new HttpsTransport({ edvId: this.id })._getDocUrl(id, capability);
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* Parses an EDV ID from a capability's invocation target.
|
|
630
|
+
*
|
|
631
|
+
* @param {object} options - The options to use.
|
|
632
|
+
* @param {object|string} options.capability - The authorization capability
|
|
633
|
+
* (zcap) to parse the EDV ID from.
|
|
634
|
+
*
|
|
635
|
+
* @returns {string} - The ID of the EDV.
|
|
636
|
+
*/
|
|
637
|
+
static _parseEdvId({ capability } = {}) {
|
|
638
|
+
const invocationTarget = EdvClient._getInvocationTarget({ capability });
|
|
639
|
+
const start = invocationTarget.lastIndexOf('/edvs/');
|
|
640
|
+
if (start === -1) {
|
|
641
|
+
throw new Error(`Invalid EDV invocation target (${invocationTarget}).`);
|
|
642
|
+
}
|
|
643
|
+
const end = invocationTarget.indexOf('/', start + '/edvs/'.length + 1);
|
|
644
|
+
if (end === -1) {
|
|
645
|
+
// form: https://example.com/edvs/z1238121237
|
|
646
|
+
return invocationTarget;
|
|
647
|
+
}
|
|
648
|
+
// form: https://example.com/edvs/z1238121237/...
|
|
649
|
+
return invocationTarget.slice(0, end);
|
|
650
|
+
}
|
|
651
|
+
// provided temporarily for backwards compatibility; should be moved to
|
|
652
|
+
// a separate helpers file
|
|
653
|
+
static _getInvocationTarget({ capability }) {
|
|
654
|
+
return HttpsTransport._getInvocationTarget({ capability });
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* A node.js HTTPS agent.
|
|
659
|
+
*
|
|
660
|
+
* @typedef {object} HttpsAgent
|
|
661
|
+
* @see https://nodejs.org/api/https.html#https_class_https_agent
|
|
662
|
+
*/
|
|
663
|
+
//# sourceMappingURL=EdvClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EdvClient.js","sourceRoot":"","sources":["../src/EdvClient.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD;;;;;;;;;GASG;AAEH,MAAM,OAAO,SAAU,SAAQ,aAAa;IAC1C,UAAU,CAAK;IACf,gBAAgB,CAAU;IAC1B,UAAU,CAAK;IACf,cAAc,CAAK;IAEnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,YAAY,EACV,UAAU,EACV,cAAc,EACd,IAAI,EACJ,EAAE,EACF,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,WAAW,EACX,aAAa,GAAG,aAAa,EAC7B,iBAAiB,KACV,EAAE;QACT,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC7B,MAAM,CAAC,UAAU,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAA;YAC1C,IAAI,CAAC,EAAE,EAAE,CAAC;gBACR,iCAAiC;gBACjC,EAAE,GAAG,SAAS,CAAC,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC,CAAA;YAC5C,CAAC;QACH,CAAC;QACD,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;YACnC,sBAAsB,CAAC,gBAAgB,CAAC,CAAA;QAC1C,CAAC;QAED,KAAK,CAAC;YACJ,IAAI;YACJ,EAAE;YACF,eAAe;YACf,WAAW;YACX,aAAa;YACb,iBAAiB;SAClB,CAAC,CAAA;QAEF,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