@interop/was-client 0.22.0 → 0.24.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/README.md +12 -11
- package/dist/Collection.d.ts +28 -25
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +55 -51
- package/dist/Collection.js.map +1 -1
- package/dist/Resource.d.ts +7 -7
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +19 -18
- package/dist/Resource.js.map +1 -1
- package/dist/Space.d.ts +3 -2
- package/dist/Space.d.ts.map +1 -1
- package/dist/Space.js +5 -4
- package/dist/Space.js.map +1 -1
- package/dist/WasClient.d.ts +19 -17
- package/dist/WasClient.d.ts.map +1 -1
- package/dist/WasClient.js +23 -21
- package/dist/WasClient.js.map +1 -1
- package/dist/codec.d.ts +16 -15
- package/dist/codec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.d.ts +2 -2
- package/dist/edv/EdvCodec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.js +29 -28
- package/dist/edv/EdvCodec.js.map +1 -1
- package/dist/edv/WasTransport.d.ts +9 -8
- package/dist/edv/WasTransport.d.ts.map +1 -1
- package/dist/edv/WasTransport.js +9 -8
- package/dist/edv/WasTransport.js.map +1 -1
- package/dist/edv/constants.js +1 -1
- package/dist/edv/descriptorStore.d.ts +119 -0
- package/dist/edv/descriptorStore.d.ts.map +1 -0
- package/dist/edv/{markerStore.js → descriptorStore.js} +41 -40
- package/dist/edv/descriptorStore.js.map +1 -0
- package/dist/edv/docCipher.d.ts +31 -29
- package/dist/edv/docCipher.d.ts.map +1 -1
- package/dist/edv/docCipher.js +26 -24
- package/dist/edv/docCipher.js.map +1 -1
- package/dist/edv/epochCrypto.d.ts +8 -8
- package/dist/edv/epochCrypto.d.ts.map +1 -1
- package/dist/edv/epochCrypto.js +15 -14
- package/dist/edv/epochCrypto.js.map +1 -1
- package/dist/edv/epochKeys.d.ts +18 -15
- package/dist/edv/epochKeys.d.ts.map +1 -1
- package/dist/edv/epochKeys.js +20 -19
- package/dist/edv/epochKeys.js.map +1 -1
- package/dist/edv/epochMac.d.ts +11 -10
- package/dist/edv/epochMac.d.ts.map +1 -1
- package/dist/edv/epochMac.js +24 -23
- package/dist/edv/epochMac.js.map +1 -1
- package/dist/edv/index.d.ts +11 -8
- package/dist/edv/index.d.ts.map +1 -1
- package/dist/edv/index.js +9 -7
- package/dist/edv/index.js.map +1 -1
- package/dist/edv/recipients.d.ts +92 -30
- package/dist/edv/recipients.d.ts.map +1 -1
- package/dist/edv/recipients.js +228 -80
- package/dist/edv/recipients.js.map +1 -1
- package/dist/errors.d.ts +2 -2
- package/dist/errors.js +2 -2
- package/dist/internal/codec.d.ts +8 -8
- package/dist/internal/codec.d.ts.map +1 -1
- package/dist/internal/codec.js +12 -12
- package/dist/internal/codec.js.map +1 -1
- package/dist/internal/describe.d.ts +3 -3
- package/dist/sync/envelope.d.ts +2 -2
- package/dist/sync/envelope.js +2 -2
- package/dist/sync/provisioning.d.ts +10 -10
- package/dist/sync/provisioning.js +9 -9
- package/dist/sync/types.d.ts +4 -4
- package/dist/types.d.ts +5 -5
- package/package.json +2 -2
- package/dist/edv/markerStore.d.ts +0 -118
- package/dist/edv/markerStore.d.ts.map +0 -1
- package/dist/edv/markerStore.js.map +0 -1
package/dist/edv/recipients.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PreconditionFailedError, ValidationError } from '../errors.js';
|
|
2
|
-
import {
|
|
2
|
+
import { collectionDescriptorStore } from './descriptorStore.js';
|
|
3
3
|
import { didKeyResolver, mintEpoch, unwrapEpochSecret, wrapEpochSecret } from './epochCrypto.js';
|
|
4
4
|
import { computeEpochsMac } from './epochMac.js';
|
|
5
5
|
/**
|
|
@@ -8,23 +8,24 @@ import { computeEpochsMac } from './epochMac.js';
|
|
|
8
8
|
*/
|
|
9
9
|
const MAX_CAS_ATTEMPTS = 3;
|
|
10
10
|
/**
|
|
11
|
-
* Initializes the first key epoch on a
|
|
12
|
-
* fresh epoch key, wraps it to each initial recipient, and writes
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
11
|
+
* Initializes the first key epoch on a descriptor that has no epochs yet: mints
|
|
12
|
+
* a fresh epoch key, wraps it to each initial recipient, and writes `epochs:
|
|
13
|
+
* [epoch]` / `currentEpoch` back with a compare-and-swap. After this, resources
|
|
14
|
+
* written by any recipient are encrypted under the epoch, and readers unwrap it
|
|
15
|
+
* with their own key-agreement key.
|
|
16
16
|
*
|
|
17
17
|
* On the `collection` host the collection must already be declared encrypted
|
|
18
|
-
* (its
|
|
19
|
-
* host starts absent (e.g. `
|
|
20
|
-
* not exist before the first init), the
|
|
21
|
-
* with a create-if-absent guard (`If-None-Match: *`), so
|
|
22
|
-
* inits cannot clobber one another.
|
|
18
|
+
* (its descriptor exists; this fills in the first epochs). On a store whose
|
|
19
|
+
* descriptor host starts absent (e.g. `resourceDescriptorStore`, whose roster
|
|
20
|
+
* resource does not exist before the first init), the descriptor itself is
|
|
21
|
+
* created from scratch with a create-if-absent guard (`If-None-Match: *`), so
|
|
22
|
+
* two racing first inits cannot clobber one another.
|
|
23
23
|
*
|
|
24
24
|
* @param options {object}
|
|
25
25
|
* @param [options.collection] {Collection} the (already encrypted) collection
|
|
26
|
-
* whose Description hosts the
|
|
27
|
-
*
|
|
26
|
+
* whose Description hosts the descriptor; exactly one of `collection` /
|
|
27
|
+
* `store`
|
|
28
|
+
* @param [options.store] {EncryptionDescriptorStore} an explicit descriptor store
|
|
28
29
|
* @param options.recipients {RecipientPublicKey[]} the initial readers' public
|
|
29
30
|
* key-agreement keys (each `id` is the reader's `kid`)
|
|
30
31
|
* @param [options.epoch] {{ epochId: string, secret: Uint8Array }} a
|
|
@@ -32,7 +33,7 @@ const MAX_CAS_ATTEMPTS = 3;
|
|
|
32
33
|
* whose epoch key already exists (e.g. a per-user key being enrolled into
|
|
33
34
|
* its wrap-set roster). The `epochId` must be the key's did:key and `secret`
|
|
34
35
|
* its raw 32-byte private key, exactly what {@link mintEpoch} returns.
|
|
35
|
-
* @returns {Promise<CollectionEncryption>} the new
|
|
36
|
+
* @returns {Promise<CollectionEncryption>} the new descriptor
|
|
36
37
|
*/
|
|
37
38
|
export async function initRecipients({ collection, store, recipients, epoch: premintedEpoch }) {
|
|
38
39
|
if (recipients.length === 0) {
|
|
@@ -43,29 +44,30 @@ export async function initRecipients({ collection, store, recipients, epoch: pre
|
|
|
43
44
|
id: epochId,
|
|
44
45
|
recipients: await Promise.all(recipients.map(recipient => wrapEpochSecret({ epochSecret: secret, recipient })))
|
|
45
46
|
};
|
|
46
|
-
return
|
|
47
|
-
store:
|
|
48
|
-
// A store whose
|
|
49
|
-
// (the create-if-absent branch); a Collection Description's
|
|
50
|
-
// exists, so its adapter never reaches the seed.
|
|
47
|
+
return casUpdateDescriptor({
|
|
48
|
+
store: descriptorStoreFor({ collection, store }),
|
|
49
|
+
// A store whose descriptor starts absent initializes from a bare `edv`
|
|
50
|
+
// descriptor (the create-if-absent branch); a Collection Description's
|
|
51
|
+
// descriptor always exists, so its adapter never reaches the seed.
|
|
51
52
|
seed: { scheme: 'edv' },
|
|
52
|
-
mutate: async (
|
|
53
|
-
if (
|
|
53
|
+
mutate: async (descriptor) => {
|
|
54
|
+
if (descriptor.epochs && descriptor.epochs.length > 0) {
|
|
54
55
|
throw new ValidationError('This collection already has key epochs; use addRecipient to add a ' +
|
|
55
56
|
'reader instead of initRecipients.');
|
|
56
57
|
}
|
|
57
|
-
// Declaring the first epochs, so stamp scheme version 1 when the
|
|
58
|
-
// does not already carry one, and authenticate the epoch
|
|
59
|
-
// with a MAC keyed from this first epoch's secret (computed
|
|
60
|
-
//
|
|
58
|
+
// Declaring the first epochs, so stamp scheme version 1 when the
|
|
59
|
+
// descriptor does not already carry one, and authenticate the epoch
|
|
60
|
+
// configuration with a MAC keyed from this first epoch's secret (computed
|
|
61
|
+
// over the exact descriptor being written, since a CAS retry re-reads the
|
|
62
|
+
// descriptor).
|
|
61
63
|
const next = {
|
|
62
|
-
...
|
|
63
|
-
version:
|
|
64
|
+
...descriptor,
|
|
65
|
+
version: descriptor.version ?? 1,
|
|
64
66
|
epochs: [epoch],
|
|
65
67
|
currentEpoch: epochId
|
|
66
68
|
};
|
|
67
69
|
const epochsMac = await computeEpochsMac({
|
|
68
|
-
|
|
70
|
+
descriptor: next,
|
|
69
71
|
epochSecret: secret
|
|
70
72
|
});
|
|
71
73
|
return { ...next, epochsMac };
|
|
@@ -84,18 +86,18 @@ export async function initRecipients({ collection, store, recipients, epoch: pre
|
|
|
84
86
|
*
|
|
85
87
|
* @param options {object}
|
|
86
88
|
* @param [options.collection] {Collection} the collection whose Description
|
|
87
|
-
* hosts the
|
|
88
|
-
* @param [options.store] {
|
|
89
|
+
* hosts the descriptor; exactly one of `collection` / `store`
|
|
90
|
+
* @param [options.store] {EncryptionDescriptorStore} an explicit descriptor store
|
|
89
91
|
* @param options.recipient {RecipientPublicKey} the new reader's public KAK
|
|
90
92
|
* @param options.owner {OwnerKey} the caller's own key-agreement key, to
|
|
91
93
|
* unwrap each epoch key for re-wrapping to the new reader
|
|
92
|
-
* @returns {Promise<CollectionEncryption>} the new
|
|
94
|
+
* @returns {Promise<CollectionEncryption>} the new descriptor
|
|
93
95
|
*/
|
|
94
96
|
export async function addRecipient({ collection, store, recipient, owner }) {
|
|
95
|
-
return
|
|
96
|
-
store:
|
|
97
|
-
mutate: async (
|
|
98
|
-
const epochs =
|
|
97
|
+
return casUpdateDescriptor({
|
|
98
|
+
store: descriptorStoreFor({ collection, store }),
|
|
99
|
+
mutate: async (descriptor) => {
|
|
100
|
+
const epochs = descriptor.epochs;
|
|
99
101
|
if (!epochs || epochs.length === 0) {
|
|
100
102
|
throw new ValidationError('Cannot addRecipient: this collection has no key epochs. Call ' +
|
|
101
103
|
'initRecipients first.');
|
|
@@ -131,7 +133,7 @@ export async function addRecipient({ collection, store, recipient, owner }) {
|
|
|
131
133
|
recipients: [...epoch.recipients, wrapped]
|
|
132
134
|
};
|
|
133
135
|
}));
|
|
134
|
-
return { ...
|
|
136
|
+
return { ...descriptor, epochs: nextEpochs };
|
|
135
137
|
}
|
|
136
138
|
});
|
|
137
139
|
}
|
|
@@ -167,8 +169,8 @@ export async function addRecipient({ collection, store, recipient, owner }) {
|
|
|
167
169
|
*
|
|
168
170
|
* @param options {object}
|
|
169
171
|
* @param [options.collection] {Collection} the collection whose Description
|
|
170
|
-
* hosts the
|
|
171
|
-
* @param [options.store] {
|
|
172
|
+
* hosts the descriptor; exactly one of `collection` / `store`
|
|
173
|
+
* @param [options.store] {EncryptionDescriptorStore} an explicit descriptor store
|
|
172
174
|
* @param [options.space] {Space} the collection's Space, for the default
|
|
173
175
|
* pull axis (zcap revocation); required together with `revoke` unless a
|
|
174
176
|
* custom `pull` is supplied
|
|
@@ -188,12 +190,12 @@ export async function addRecipient({ collection, store, recipient, owner }) {
|
|
|
188
190
|
* self-describing `did:key`. May resolve `null` to signal drop-this-kid:
|
|
189
191
|
* the rotation then excludes that entry from the fresh epoch instead of
|
|
190
192
|
* throwing (subject to the no-recipients-remaining guard).
|
|
191
|
-
* @returns {Promise<CollectionEncryption>} the new
|
|
193
|
+
* @returns {Promise<CollectionEncryption>} the new descriptor
|
|
192
194
|
*/
|
|
193
195
|
export async function removeRecipient({ collection, store, space, recipientId, revoke, pull, resolveRecipientKey = defaultResolveRecipientKey }) {
|
|
194
|
-
const
|
|
196
|
+
const descriptorStore = descriptorStoreFor({ collection, store });
|
|
195
197
|
// Resolve the pull axis up front, before any rotation, so a malformed call
|
|
196
|
-
// fails before the
|
|
198
|
+
// fails before the descriptor is mutated.
|
|
197
199
|
const pullAxis = resolvePullAxis({ space, revoke, pull });
|
|
198
200
|
// 1. Read axis: mint a fresh epoch, wrap it to every remaining recipient,
|
|
199
201
|
// append it, and repoint `currentEpoch` (compare-and-swap, retried on race).
|
|
@@ -201,10 +203,10 @@ export async function removeRecipient({ collection, store, space, recipientId, r
|
|
|
201
203
|
// if the CAS keeps losing the race and throws, the reader is neither pulled
|
|
202
204
|
// nor rotated, so `removeRecipient` is safely retryable to convergence.
|
|
203
205
|
const { epochId, secret } = await mintEpoch();
|
|
204
|
-
const
|
|
205
|
-
store:
|
|
206
|
-
mutate: async (
|
|
207
|
-
const epochs =
|
|
206
|
+
const rotatedDescriptor = await casUpdateDescriptor({
|
|
207
|
+
store: descriptorStore,
|
|
208
|
+
mutate: async (descriptor) => {
|
|
209
|
+
const epochs = descriptor.epochs;
|
|
208
210
|
if (!epochs || epochs.length === 0) {
|
|
209
211
|
throw new ValidationError('Cannot removeRecipient: this collection has no key epochs.');
|
|
210
212
|
}
|
|
@@ -214,7 +216,7 @@ export async function removeRecipient({ collection, store, space, recipientId, r
|
|
|
214
216
|
// still present in that older epoch, so unioning would silently re-escrow
|
|
215
217
|
// it into the fresh epoch and hand it back read access. Older epochs exist
|
|
216
218
|
// only so existing readers can decrypt history.
|
|
217
|
-
const currentEpoch = epochs.find(epoch => epoch.id ===
|
|
219
|
+
const currentEpoch = epochs.find(epoch => epoch.id === descriptor.currentEpoch) ??
|
|
218
220
|
epochs[epochs.length - 1];
|
|
219
221
|
// Already excluded from the current epoch? A prior attempt's rotation
|
|
220
222
|
// landed (its revoke step then failed transiently and the caller
|
|
@@ -255,15 +257,15 @@ export async function removeRecipient({ collection, store, space, recipientId, r
|
|
|
255
257
|
recipients: newRecipients
|
|
256
258
|
};
|
|
257
259
|
// Re-authenticate the epoch configuration under the NEW epoch's secret
|
|
258
|
-
// (the rotating caller just minted it), computed over the exact
|
|
259
|
-
// being written so a CAS retry re-MACs the re-read
|
|
260
|
+
// (the rotating caller just minted it), computed over the exact descriptor
|
|
261
|
+
// being written so a CAS retry re-MACs the re-read descriptor state.
|
|
260
262
|
const next = {
|
|
261
|
-
...
|
|
263
|
+
...descriptor,
|
|
262
264
|
epochs: [...epochs, newEpoch],
|
|
263
265
|
currentEpoch: epochId
|
|
264
266
|
};
|
|
265
267
|
const epochsMac = await computeEpochsMac({
|
|
266
|
-
|
|
268
|
+
descriptor: next,
|
|
267
269
|
epochSecret: secret
|
|
268
270
|
});
|
|
269
271
|
return { ...next, epochsMac };
|
|
@@ -272,7 +274,152 @@ export async function removeRecipient({ collection, store, space, recipientId, r
|
|
|
272
274
|
// 2. Pull axis: withdraw the reader's server-side access AFTER the rotation
|
|
273
275
|
// is durable -- the default zcap revocation, or the caller-supplied `pull`.
|
|
274
276
|
await pullAxis();
|
|
275
|
-
return
|
|
277
|
+
return rotatedDescriptor;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Replaces one reader (or several) with another in ONE descriptor write -- the
|
|
281
|
+
* shape of a key rotation cascading over a collection (e.g. a per-user key
|
|
282
|
+
* replaced by its successor): the incoming recipient is escrowed into EVERY
|
|
283
|
+
* epoch (history included, {@link addRecipient}'s semantics) and the current
|
|
284
|
+
* epoch is rotated off the retiring recipient(s) ({@link removeRecipient}'s
|
|
285
|
+
* semantics), in a single compare-and-swap. Two requests total (the read and
|
|
286
|
+
* the CAS write) against the four a compose of addRecipient + removeRecipient
|
|
287
|
+
* would cost, and no intermediate state in which both keys are current.
|
|
288
|
+
*
|
|
289
|
+
* Idempotent to convergence like its two halves: an epoch already carrying the
|
|
290
|
+
* incoming recipient is left untouched; when additionally no retiring
|
|
291
|
+
* recipient remains in the current epoch, nothing is written at all -- a naive
|
|
292
|
+
* re-run after a crash appends zero redundant epochs. An escrow-only state
|
|
293
|
+
* (the incoming recipient missing from some epoch but no retiring recipient
|
|
294
|
+
* current) writes the escrow wraps without minting an epoch; the `epochsMac`
|
|
295
|
+
* is untouched then, since it binds the epoch configuration, not the
|
|
296
|
+
* recipient wraps.
|
|
297
|
+
*
|
|
298
|
+
* The pull-axis contract is {@link removeRecipient}'s verbatim: the default
|
|
299
|
+
* zcap revocation (`space` + `revoke`) or a caller-supplied `pull` action,
|
|
300
|
+
* run only after the rotation is durable. A caller whose pull axis has
|
|
301
|
+
* already run elsewhere (e.g. a DID-document edit under a current-key-set
|
|
302
|
+
* rule) passes a no-op `pull`.
|
|
303
|
+
*
|
|
304
|
+
* The rotation ceiling is unchanged: nothing is re-encrypted, so a retired
|
|
305
|
+
* key still opens every pre-rotation epoch it was a recipient of.
|
|
306
|
+
*
|
|
307
|
+
* @param options {object}
|
|
308
|
+
* @param [options.collection] {Collection} the collection whose Description
|
|
309
|
+
* hosts the descriptor; exactly one of `collection` / `store`
|
|
310
|
+
* @param [options.store] {EncryptionDescriptorStore} an explicit descriptor store
|
|
311
|
+
* @param [options.space] {Space} the default pull axis, with `revoke`
|
|
312
|
+
* @param options.retire {string | string[]} the retiring recipient kid(s),
|
|
313
|
+
* dropped from the fresh epoch's roster
|
|
314
|
+
* @param options.recipient {RecipientPublicKey} the incoming reader's public
|
|
315
|
+
* key-agreement key, escrowed into every epoch and wrapped into the fresh one
|
|
316
|
+
* @param options.owner {OwnerKey} the caller's own key-agreement key,
|
|
317
|
+
* unwrapping each epoch key for the escrow -- it must be a recipient of
|
|
318
|
+
* every epoch (a retiring key that was escrowed everywhere qualifies)
|
|
319
|
+
* @param [options.revoke] {IDelegatedZcap | IDelegatedZcap[]} the default
|
|
320
|
+
* pull axis, with `space`
|
|
321
|
+
* @param [options.pull] {function} a caller-supplied pull action; mutually
|
|
322
|
+
* exclusive with `space` / `revoke`
|
|
323
|
+
* @param [options.resolveRecipientKey] {function} resolves a remaining
|
|
324
|
+
* recipient's kid for the fresh epoch, `null` to drop it -- the
|
|
325
|
+
* {@link removeRecipient} contract (the incoming recipient never routes
|
|
326
|
+
* through it)
|
|
327
|
+
* @returns {Promise<CollectionEncryption>} the new descriptor
|
|
328
|
+
*/
|
|
329
|
+
export async function replaceRecipient({ collection, store, space, retire, recipient, owner, revoke, pull, resolveRecipientKey = defaultResolveRecipientKey }) {
|
|
330
|
+
const descriptorStore = descriptorStoreFor({ collection, store });
|
|
331
|
+
const pullAxis = resolvePullAxis({ space, revoke, pull });
|
|
332
|
+
const retiring = Array.isArray(retire) ? retire : [retire];
|
|
333
|
+
if (retiring.length === 0) {
|
|
334
|
+
throw new ValidationError('replaceRecipient needs at least one retiring recipient kid; use ' +
|
|
335
|
+
'addRecipient for a pure escrow.');
|
|
336
|
+
}
|
|
337
|
+
if (retiring.includes(recipient.id)) {
|
|
338
|
+
throw new ValidationError('replaceRecipient cannot retire the incoming recipient itself.');
|
|
339
|
+
}
|
|
340
|
+
const { epochId, secret } = await mintEpoch();
|
|
341
|
+
const rotatedDescriptor = await casUpdateDescriptor({
|
|
342
|
+
store: descriptorStore,
|
|
343
|
+
mutate: async (descriptor) => {
|
|
344
|
+
const epochs = descriptor.epochs;
|
|
345
|
+
if (!epochs || epochs.length === 0) {
|
|
346
|
+
throw new ValidationError('Cannot replaceRecipient: this collection has no key epochs.');
|
|
347
|
+
}
|
|
348
|
+
// Escrow the incoming recipient into every epoch it is missing from
|
|
349
|
+
// (addRecipient's loop, inlined so the whole replacement is one write).
|
|
350
|
+
let escrowChanged = false;
|
|
351
|
+
const escrowed = await Promise.all(epochs.map(async (epoch) => {
|
|
352
|
+
if (epoch.recipients.some(entry => entry.header.kid === recipient.id)) {
|
|
353
|
+
return epoch;
|
|
354
|
+
}
|
|
355
|
+
const ownEntry = epoch.recipients.find(entry => entry.header.kid === owner.keyAgreementKey.id);
|
|
356
|
+
if (!ownEntry) {
|
|
357
|
+
throw new ValidationError(`Cannot replaceRecipient: the caller is not a recipient of ` +
|
|
358
|
+
`epoch "${epoch.id}", so it cannot unwrap that epoch key to ` +
|
|
359
|
+
'escrow it to the incoming reader.');
|
|
360
|
+
}
|
|
361
|
+
const epochSecret = await unwrapEpochSecret({
|
|
362
|
+
entry: ownEntry,
|
|
363
|
+
keyAgreementKey: owner.keyAgreementKey
|
|
364
|
+
});
|
|
365
|
+
if (!epochSecret) {
|
|
366
|
+
throw new ValidationError(`Cannot replaceRecipient: unwrapping epoch "${epoch.id}" with ` +
|
|
367
|
+
"the caller's key-agreement key failed.");
|
|
368
|
+
}
|
|
369
|
+
escrowChanged = true;
|
|
370
|
+
return {
|
|
371
|
+
...epoch,
|
|
372
|
+
recipients: [
|
|
373
|
+
...epoch.recipients,
|
|
374
|
+
await wrapEpochSecret({ epochSecret, recipient })
|
|
375
|
+
]
|
|
376
|
+
};
|
|
377
|
+
}));
|
|
378
|
+
// Rotate only when a retiring kid is still current (the removeRecipient
|
|
379
|
+
// no-op rule, so a naive re-run appends zero redundant epochs).
|
|
380
|
+
const currentEpoch = escrowed.find(epoch => epoch.id === descriptor.currentEpoch) ??
|
|
381
|
+
escrowed[escrowed.length - 1];
|
|
382
|
+
const rotating = currentEpoch.recipients.some(entry => retiring.includes(entry.header.kid));
|
|
383
|
+
if (!rotating) {
|
|
384
|
+
return escrowChanged ? { ...descriptor, epochs: escrowed } : null;
|
|
385
|
+
}
|
|
386
|
+
const remaining = new Set();
|
|
387
|
+
for (const entry of currentEpoch.recipients) {
|
|
388
|
+
if (!retiring.includes(entry.header.kid)) {
|
|
389
|
+
remaining.add(entry.header.kid);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
// The escrow above already placed the incoming recipient in the current
|
|
393
|
+
// epoch, so it is in `remaining`; wrap it directly (its public key is in
|
|
394
|
+
// hand) and route only the other survivors through the resolver.
|
|
395
|
+
const wrapped = await Promise.all([...remaining].map(async (kid) => {
|
|
396
|
+
if (kid === recipient.id) {
|
|
397
|
+
return wrapEpochSecret({ epochSecret: secret, recipient });
|
|
398
|
+
}
|
|
399
|
+
const resolved = await resolveRecipientKey(kid);
|
|
400
|
+
return resolved === null
|
|
401
|
+
? null
|
|
402
|
+
: wrapEpochSecret({ epochSecret: secret, recipient: resolved });
|
|
403
|
+
}));
|
|
404
|
+
const newRecipients = wrapped.filter(entry => entry !== null);
|
|
405
|
+
const newEpoch = {
|
|
406
|
+
id: epochId,
|
|
407
|
+
recipients: newRecipients
|
|
408
|
+
};
|
|
409
|
+
const next = {
|
|
410
|
+
...descriptor,
|
|
411
|
+
epochs: [...escrowed, newEpoch],
|
|
412
|
+
currentEpoch: epochId
|
|
413
|
+
};
|
|
414
|
+
const epochsMac = await computeEpochsMac({
|
|
415
|
+
descriptor: next,
|
|
416
|
+
epochSecret: secret
|
|
417
|
+
});
|
|
418
|
+
return { ...next, epochsMac };
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
await pullAxis();
|
|
422
|
+
return rotatedDescriptor;
|
|
276
423
|
}
|
|
277
424
|
/**
|
|
278
425
|
* Resolves the pull axis of {@link removeRecipient} -- exactly one of the
|
|
@@ -332,65 +479,65 @@ async function defaultResolveRecipientKey(kid) {
|
|
|
332
479
|
return { id: resolved.id, publicKeyMultibase: resolved.publicKeyMultibase };
|
|
333
480
|
}
|
|
334
481
|
/**
|
|
335
|
-
* Resolves the
|
|
482
|
+
* Resolves the descriptor store a recipient operation targets: the explicit
|
|
336
483
|
* `store`, or the Collection Description adapter over the `collection` sugar.
|
|
337
484
|
* Exactly one of the two must be supplied.
|
|
338
485
|
*
|
|
339
486
|
* @param options {object}
|
|
340
487
|
* @param [options.collection] {Collection}
|
|
341
|
-
* @param [options.store] {
|
|
342
|
-
* @returns {
|
|
488
|
+
* @param [options.store] {EncryptionDescriptorStore}
|
|
489
|
+
* @returns {EncryptionDescriptorStore}
|
|
343
490
|
*/
|
|
344
|
-
function
|
|
491
|
+
function descriptorStoreFor({ collection, store }) {
|
|
345
492
|
if (collection !== undefined && store !== undefined) {
|
|
346
493
|
throw new ValidationError('Pass either `collection` (the Collection Description hosts the ' +
|
|
347
|
-
'
|
|
494
|
+
'descriptor) or `store` (an explicit descriptor store), not both.');
|
|
348
495
|
}
|
|
349
496
|
if (store !== undefined) {
|
|
350
497
|
return store;
|
|
351
498
|
}
|
|
352
499
|
if (collection !== undefined) {
|
|
353
|
-
return
|
|
500
|
+
return collectionDescriptorStore({ collection });
|
|
354
501
|
}
|
|
355
|
-
throw new ValidationError('A recipient operation needs its
|
|
502
|
+
throw new ValidationError('A recipient operation needs its descriptor host: pass `collection` or ' +
|
|
356
503
|
'`store`.');
|
|
357
504
|
}
|
|
358
505
|
/**
|
|
359
|
-
* Reads the store's
|
|
360
|
-
* a compare-and-swap (`If-Match`). Retries on a stale (`412`) validator,
|
|
361
|
-
* re-reading the fresh
|
|
506
|
+
* Reads the store's descriptor, applies `mutate`, and writes the result back
|
|
507
|
+
* with a compare-and-swap (`If-Match`). Retries on a stale (`412`) validator,
|
|
508
|
+
* re-reading the fresh descriptor each time, up to {@link MAX_CAS_ATTEMPTS};
|
|
362
509
|
* surfaces {@link PreconditionFailedError} if it keeps losing the race. A
|
|
363
|
-
* `mutate` that resolves `null` signals "no change needed" (the
|
|
364
|
-
* reflects the desired state, e.g. an idempotent retry): nothing is
|
|
365
|
-
* and the current
|
|
510
|
+
* `mutate` that resolves `null` signals "no change needed" (the descriptor
|
|
511
|
+
* already reflects the desired state, e.g. an idempotent retry): nothing is
|
|
512
|
+
* written and the current descriptor is returned as-is.
|
|
366
513
|
*
|
|
367
|
-
* When the store reports no
|
|
514
|
+
* When the store reports no descriptor yet (`read()` resolves `null`, e.g. the
|
|
368
515
|
* resource adapter before the first `initRecipients`), the optional `seed` is
|
|
369
516
|
* mutated instead and the result written with the store's create-if-absent
|
|
370
517
|
* guard (`If-None-Match: *`). Only `initRecipients` passes a seed; without
|
|
371
|
-
* one an absent
|
|
372
|
-
* writer created the first
|
|
518
|
+
* one an absent descriptor is refused. Losing the create race (a concurrent
|
|
519
|
+
* writer created the first descriptor) re-enters the loop and re-reads, like a
|
|
373
520
|
* stale CAS.
|
|
374
521
|
*
|
|
375
522
|
* @param options {object}
|
|
376
|
-
* @param options.store {
|
|
377
|
-
* @param options.mutate {function}
|
|
523
|
+
* @param options.store {EncryptionDescriptorStore}
|
|
524
|
+
* @param options.mutate {function} descriptor to the next descriptor (may be async),
|
|
378
525
|
* or `null` to skip the write
|
|
379
|
-
* @param [options.seed] {CollectionEncryption} the
|
|
526
|
+
* @param [options.seed] {CollectionEncryption} the descriptor to mutate when the
|
|
380
527
|
* store holds none yet
|
|
381
|
-
* @returns {Promise<CollectionEncryption>} the written (or current)
|
|
528
|
+
* @returns {Promise<CollectionEncryption>} the written (or current) descriptor
|
|
382
529
|
*/
|
|
383
|
-
async function
|
|
530
|
+
async function casUpdateDescriptor({ store, mutate, seed }) {
|
|
384
531
|
let lastError;
|
|
385
532
|
for (let attempt = 0; attempt < MAX_CAS_ATTEMPTS; attempt++) {
|
|
386
533
|
const current = await store.read();
|
|
387
534
|
if (current === null) {
|
|
388
535
|
if (seed === undefined) {
|
|
389
|
-
throw new ValidationError('Cannot manage recipients: this
|
|
390
|
-
'
|
|
536
|
+
throw new ValidationError('Cannot manage recipients: this descriptor store holds no encryption ' +
|
|
537
|
+
'descriptor yet. Call initRecipients first.');
|
|
391
538
|
}
|
|
392
539
|
if (store.create === undefined) {
|
|
393
|
-
throw new ValidationError('Cannot initialize recipients: this
|
|
540
|
+
throw new ValidationError('Cannot initialize recipients: this descriptor store holds no descriptor ' +
|
|
394
541
|
'and does not support creating one.');
|
|
395
542
|
}
|
|
396
543
|
const created = await mutate(seed);
|
|
@@ -403,17 +550,18 @@ async function casUpdateMarker({ store, mutate, seed }) {
|
|
|
403
550
|
}
|
|
404
551
|
catch (err) {
|
|
405
552
|
if (err instanceof PreconditionFailedError) {
|
|
406
|
-
// A concurrent writer created the first
|
|
553
|
+
// A concurrent writer created the first descriptor: re-read and
|
|
554
|
+
// re-apply.
|
|
407
555
|
lastError = err;
|
|
408
556
|
continue;
|
|
409
557
|
}
|
|
410
558
|
throw err;
|
|
411
559
|
}
|
|
412
560
|
}
|
|
413
|
-
const next = await mutate(current.
|
|
561
|
+
const next = await mutate(current.descriptor);
|
|
414
562
|
if (next === null) {
|
|
415
|
-
// The
|
|
416
|
-
return current.
|
|
563
|
+
// The descriptor already reflects the desired state: nothing to write.
|
|
564
|
+
return current.descriptor;
|
|
417
565
|
}
|
|
418
566
|
try {
|
|
419
567
|
await store.replace(next, { ifMatch: current.etag });
|
|
@@ -429,7 +577,7 @@ async function casUpdateMarker({ store, mutate, seed }) {
|
|
|
429
577
|
}
|
|
430
578
|
}
|
|
431
579
|
throw new PreconditionFailedError(`Recipient change lost the compare-and-swap race after ${MAX_CAS_ATTEMPTS} ` +
|
|
432
|
-
'attempts (another writer kept updating the stored
|
|
580
|
+
'attempts (another writer kept updating the stored descriptor). ' +
|
|
433
581
|
'Retry the operation.', { cause: lastError });
|
|
434
582
|
}
|
|
435
583
|
//# sourceMappingURL=recipients.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recipients.js","sourceRoot":"","sources":["../../src/edv/recipients.ts"],"names":[],"mappings":"AAmCA,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAOxD,OAAO,EACL,cAAc,EACd,SAAS,EACT,iBAAiB,EACjB,eAAe,EAChB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAahD;;;GAGG;AACH,MAAM,gBAAgB,GAAG,CAAC,CAAA;AAE1B;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EACnC,UAAU,EACV,KAAK,EACL,UAAU,EACV,KAAK,EAAE,cAAc,EAMtB;IACC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,eAAe,CACvB,uEAAuE,CACxE,CAAA;IACH,CAAC;IACD,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,cAAc,IAAI,CAAC,MAAM,SAAS,EAAE,CAAC,CAAA;IACjE,MAAM,KAAK,GAA8B;QACvC,EAAE,EAAE,OAAO;QACX,UAAU,EAAE,MAAM,OAAO,CAAC,GAAG,CAC3B,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CACzB,eAAe,CAAC,EAAE,WAAW,EAAE,MAAM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AAgB,GAAG;QAC1E,iEAAiE;QACjE,sBAAsB,EACxB,EAAE,KAAK,EAAE,SAAkB,EAAE,CAC9B,CAAA;AACH,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -92,7 +92,7 @@ export declare class QuotaExceededError extends WasError {
|
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
94
|
* A client-side, fail-closed encryption error: a collection is declared
|
|
95
|
-
* encrypted (by a per-handle override or its `encryption`
|
|
95
|
+
* encrypted (by a per-handle override or its `encryption` descriptor) but this
|
|
96
96
|
* client cannot build the codec -- no `encryption` provider is configured, or
|
|
97
97
|
* the keystore holds no keys for the collection (or does not handle its
|
|
98
98
|
* scheme). Raised before any request, so it carries no HTTP status; recover by
|
|
@@ -105,7 +105,7 @@ export declare class EncryptionError extends WasError {
|
|
|
105
105
|
/**
|
|
106
106
|
* A fail-closed key-epoch error: a reader could not unwrap any epoch key it
|
|
107
107
|
* needs to decrypt a resource on a multi-recipient encrypted Collection -- none
|
|
108
|
-
* of the
|
|
108
|
+
* of the descriptor's `recipients` entries yielded a key for this reader's
|
|
109
109
|
* key-agreement key (it was never a recipient, or has been removed and the
|
|
110
110
|
* epoch rotated). A subtype of {@link EncryptionError}, so existing
|
|
111
111
|
* `catch (EncryptionError)` fail-closed handling still catches it.
|
package/dist/errors.js
CHANGED
|
@@ -119,7 +119,7 @@ export class QuotaExceededError extends WasError {
|
|
|
119
119
|
}
|
|
120
120
|
/**
|
|
121
121
|
* A client-side, fail-closed encryption error: a collection is declared
|
|
122
|
-
* encrypted (by a per-handle override or its `encryption`
|
|
122
|
+
* encrypted (by a per-handle override or its `encryption` descriptor) but this
|
|
123
123
|
* client cannot build the codec -- no `encryption` provider is configured, or
|
|
124
124
|
* the keystore holds no keys for the collection (or does not handle its
|
|
125
125
|
* scheme). Raised before any request, so it carries no HTTP status; recover by
|
|
@@ -135,7 +135,7 @@ export class EncryptionError extends WasError {
|
|
|
135
135
|
/**
|
|
136
136
|
* A fail-closed key-epoch error: a reader could not unwrap any epoch key it
|
|
137
137
|
* needs to decrypt a resource on a multi-recipient encrypted Collection -- none
|
|
138
|
-
* of the
|
|
138
|
+
* of the descriptor's `recipients` entries yielded a key for this reader's
|
|
139
139
|
* key-agreement key (it was never a recipient, or has been removed and the
|
|
140
140
|
* epoch rotated). A subtype of {@link EncryptionError}, so existing
|
|
141
141
|
* `catch (EncryptionError)` fail-closed handling still catches it.
|
package/dist/internal/codec.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ import type { EncryptionOverride, IZcap } from '../types.js';
|
|
|
4
4
|
/**
|
|
5
5
|
* A per-handle codec cache. Memoizes the in-flight resolution so concurrent
|
|
6
6
|
* callers share one round-trip, but drops it on rejection so a transient
|
|
7
|
-
* failure (e.g. a 500/network error during
|
|
7
|
+
* failure (e.g. a 500/network error during descriptor discovery) does not
|
|
8
8
|
* permanently poison the handle, and exposes `reset()` for when a handle's
|
|
9
|
-
* encryption state changes (e.g. `Collection.configure()` adds the
|
|
9
|
+
* encryption state changes (e.g. `Collection.configure()` adds the descriptor).
|
|
10
10
|
*/
|
|
11
11
|
export declare class CodecHolder {
|
|
12
12
|
#private;
|
|
@@ -57,20 +57,20 @@ export declare function collectionCodecHolder(context: ClientContext, options: {
|
|
|
57
57
|
*/
|
|
58
58
|
export declare const identityCodec: ResourceCodec;
|
|
59
59
|
/**
|
|
60
|
-
* Resolves the codec for a collection by deciding policy (override >
|
|
61
|
-
* plaintext) and then, when encrypted, building the encrypting codec from the
|
|
60
|
+
* Resolves the codec for a collection by deciding policy (override > descriptor
|
|
61
|
+
* > plaintext) and then, when encrypted, building the encrypting codec from the
|
|
62
62
|
* keystore. Fails closed: a collection declared encrypted (by override or
|
|
63
|
-
*
|
|
64
|
-
* than falling back to {@link identityCodec}.
|
|
63
|
+
* descriptor) for which no codec can be built throws {@link EncryptionError}
|
|
64
|
+
* rather than falling back to {@link identityCodec}.
|
|
65
65
|
*
|
|
66
66
|
* @param context {ClientContext}
|
|
67
67
|
* @param options {object}
|
|
68
68
|
* @param options.spaceId {string}
|
|
69
69
|
* @param options.collectionId {string}
|
|
70
70
|
* @param [options.override] {EncryptionOverride} per-handle override; wins
|
|
71
|
-
* over the
|
|
71
|
+
* over the descriptor and skips the descriptor read
|
|
72
72
|
* @param [options.capability] {IZcap} the handle's bound capability, used for
|
|
73
|
-
* the
|
|
73
|
+
* the descriptor-discovery describe (which happens only when there is no
|
|
74
74
|
* override and the client has a keystore)
|
|
75
75
|
* @returns {Promise<ResourceCodec>}
|
|
76
76
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/internal/codec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/internal/codec.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAgB,aAAa,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAIjD,OAAO,KAAK,EAEV,kBAAkB,EAClB,KAAK,EAIN,MAAM,aAAa,CAAA;AAEpB;;;;;;GAMG;AACH,qBAAa,WAAW;;IAItB;;;OAGG;gBACS,OAAO,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC;IAIjD;;;;OAIG;IACH,GAAG,IAAI,OAAO,CAAC,aAAa,CAAC;IAiB7B;;;;OAIG;IACH,KAAK,IAAI,IAAI;CAGd;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE;IACP,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,kBAAkB,CAAA;IAC7B,UAAU,CAAC,EAAE,KAAK,CAAA;CACnB,GACA,WAAW,CAEb;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,aAoC3B,CAAA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,aAAa,EACtB,EACE,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,UAAU,EACX,EAAE;IACD,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,kBAAkB,CAAA;IAC7B,UAAU,CAAC,EAAE,KAAK,CAAA;CACnB,GACA,OAAO,CAAC,aAAa,CAAC,CA2DxB"}
|