@interop/was-client 0.63.0 → 0.65.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 +2 -1
- package/dist/Collection.d.ts +3 -1
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +32 -37
- package/dist/Collection.js.map +1 -1
- package/dist/Resource.d.ts +3 -1
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +3 -1
- package/dist/Resource.js.map +1 -1
- package/dist/Space.d.ts +32 -14
- package/dist/Space.d.ts.map +1 -1
- package/dist/Space.js +104 -42
- package/dist/Space.js.map +1 -1
- package/dist/edv/epochRoster.d.ts +20 -11
- package/dist/edv/epochRoster.d.ts.map +1 -1
- package/dist/edv/epochRoster.js +29 -16
- package/dist/edv/epochRoster.js.map +1 -1
- package/dist/edv/index.d.ts +3 -1
- package/dist/edv/index.d.ts.map +1 -1
- package/dist/edv/index.js +3 -1
- package/dist/edv/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/cas.d.ts +45 -0
- package/dist/internal/cas.d.ts.map +1 -1
- package/dist/internal/cas.js +59 -2
- package/dist/internal/cas.js.map +1 -1
- package/dist/internal/conditional.d.ts +16 -2
- package/dist/internal/conditional.d.ts.map +1 -1
- package/dist/internal/conditional.js +22 -2
- package/dist/internal/conditional.js.map +1 -1
- package/dist/internal/write.d.ts.map +1 -1
- package/dist/internal/write.js +4 -1
- package/dist/internal/write.js.map +1 -1
- package/package.json +1 -1
package/dist/Space.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { spacePath, spaceMeta, spaceExport, spaceImport, spaceBackends, registeredBackend, spaceQuotas, spacePolicy, spaceLinkset, toUrl } from './internal/paths.js';
|
|
2
2
|
import { assertNotReserved } from './internal/reserved.js';
|
|
3
|
+
import { composeAndSwap } from './internal/cas.js';
|
|
3
4
|
import { collectionWritableFields, unreadableDescriptionError } from './internal/describe.js';
|
|
4
5
|
import { delegateGrantAt } from './internal/grant.js';
|
|
5
6
|
import { submitRevocation } from './internal/revoke.js';
|
|
@@ -31,6 +32,23 @@ function spaceMetadataBody({ id, name, controller, type }) {
|
|
|
31
32
|
...(type !== undefined && { type })
|
|
32
33
|
};
|
|
33
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* The error for a successful response that carried no parsed JSON body where
|
|
37
|
+
* one is required. The request layer parses a body into `data` only for a JSON
|
|
38
|
+
* content type, so naming the content type the server sent points at the
|
|
39
|
+
* cause (a mislabeled or body-less 2xx).
|
|
40
|
+
*
|
|
41
|
+
* @param options {object}
|
|
42
|
+
* @param options.response {HttpResponse | null}
|
|
43
|
+
* @param options.operation {string} the request, as the message's subject
|
|
44
|
+
* @param options.expected {string} what the body should have carried
|
|
45
|
+
* @returns {WasServerError}
|
|
46
|
+
*/
|
|
47
|
+
function missingJsonBodyError({ response, operation, expected }) {
|
|
48
|
+
const contentType = response?.headers.get('content-type') ?? 'no content-type';
|
|
49
|
+
return new WasServerError(`${operation} response carried no JSON body (the server sent ` +
|
|
50
|
+
`${contentType}); expected ${expected}.`);
|
|
51
|
+
}
|
|
34
52
|
export class Space {
|
|
35
53
|
id;
|
|
36
54
|
#context;
|
|
@@ -130,7 +148,9 @@ export class Space {
|
|
|
130
148
|
path: this.#metaPath,
|
|
131
149
|
method: 'PUT',
|
|
132
150
|
capability: this.#capability,
|
|
133
|
-
|
|
151
|
+
// The handle's own `id` goes last: a caller handing back a read
|
|
152
|
+
// description (which carries its own `id`) cannot retarget the write.
|
|
153
|
+
json: spaceMetadataBody({ ...description, id: this.id }),
|
|
134
154
|
headers: writeHeaders({
|
|
135
155
|
precondition: {
|
|
136
156
|
ifMatch: options.ifMatch,
|
|
@@ -148,6 +168,12 @@ export class Space {
|
|
|
148
168
|
* Creates or updates the space by id (upsert). Merges the given fields over
|
|
149
169
|
* the current description; `controller` defaults to the wrapped signer's DID.
|
|
150
170
|
*
|
|
171
|
+
* The merge runs against the same read the write is pinned to (`If-Match`
|
|
172
|
+
* with that read's `ETag`), and rebases with it: a rival write landing in
|
|
173
|
+
* between fails the precondition, and the description is re-read and merged
|
|
174
|
+
* over rather than clobbered. A backend that serves no validator gets an
|
|
175
|
+
* unconditional `PUT`.
|
|
176
|
+
*
|
|
151
177
|
* Fails closed when the current description is unreadable and the caller did
|
|
152
178
|
* not supply a full description (both `name` and `controller`), mirroring
|
|
153
179
|
* {@link Collection.configure}: WAS returns 404 for both not-found and
|
|
@@ -157,57 +183,77 @@ export class Space {
|
|
|
157
183
|
* ownership change) and dropping the existing `name`. Pass `force: true` to
|
|
158
184
|
* proceed anyway (a deliberate create through a handle), or supply both
|
|
159
185
|
* `name` and `controller` explicitly so nothing is merged from the unreadable
|
|
160
|
-
* current.
|
|
186
|
+
* current. The check runs against each attempt's baseline, so a rebase that
|
|
187
|
+
* re-reads nothing is refused the same way.
|
|
161
188
|
*
|
|
162
189
|
* @param desc {object}
|
|
163
190
|
* @param [desc.name] {string}
|
|
164
191
|
* @param [desc.controller] {string}
|
|
165
192
|
* @param [desc.type] {string[]} the Space Metadata object's `type` array (e.g.
|
|
166
193
|
* a typed auxiliary Space). The server accepts it at creation only and
|
|
167
|
-
* treats it as immutable afterwards, so pass it on the create
|
|
168
|
-
* update the current description's `type
|
|
194
|
+
* treats it as immutable afterwards, so pass it on the create. On an
|
|
195
|
+
* update, omit it to re-send the current description's `type`; a supplied
|
|
196
|
+
* `type` is sent as given, and the server rejects one that differs from
|
|
197
|
+
* the stored value with a `ValidationError`
|
|
169
198
|
* @param [desc.force] {boolean} proceed even when the current description is
|
|
170
199
|
* unreadable and a full description is not supplied (see above)
|
|
171
200
|
* @param [desc.current] {SpaceMetadata | null} the current description,
|
|
172
|
-
* when the caller has already read it -- the merge and
|
|
173
|
-
* check then run against this instead of a second
|
|
174
|
-
* `
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
* @returns {Promise<SpaceMetadata>}
|
|
201
|
+
* when the caller has already read it -- the first attempt's merge and
|
|
202
|
+
* fail-closed check then run against this instead of a second read. Its
|
|
203
|
+
* `etag`, when present, is the validator that attempt pins to, so a copy
|
|
204
|
+
* another client has since overwritten loses the compare-and-swap and is
|
|
205
|
+
* re-read rather than merged forward. `null` means the caller read it and
|
|
206
|
+
* found the Space absent or unreadable, which is a supplied answer;
|
|
207
|
+
* omitting the member entirely is what asks for the read
|
|
208
|
+
* @returns {Promise<Omit<SpaceMetadata, 'type'> & { type?: string[] }>} the
|
|
209
|
+
* description as written by the last attempt; `type` is absent when it
|
|
210
|
+
* was neither supplied nor read from the current description, since the
|
|
211
|
+
* server's value is then unknown
|
|
180
212
|
*/
|
|
181
213
|
async configure(desc) {
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
214
|
+
const written = await composeAndSwap({
|
|
215
|
+
read: async () => {
|
|
216
|
+
const read = await this.describeWithEtag();
|
|
217
|
+
return read === null
|
|
218
|
+
? { value: null }
|
|
219
|
+
: { value: read.description, etag: read.etag };
|
|
220
|
+
},
|
|
221
|
+
...(desc.current !== undefined && {
|
|
222
|
+
current: { value: desc.current, etag: desc.current?.etag }
|
|
223
|
+
}),
|
|
224
|
+
compose: (current) => {
|
|
225
|
+
if (current === null &&
|
|
226
|
+
!desc.force &&
|
|
227
|
+
!(desc.name !== undefined && desc.controller !== undefined)) {
|
|
228
|
+
throw unreadableDescriptionError({
|
|
229
|
+
operation: `configure space "${this.id}"`,
|
|
230
|
+
consequence: 'merging forward could silently change the controller or drop ' +
|
|
231
|
+
'the existing name',
|
|
232
|
+
advice: 'Supply both `name` and `controller` explicitly, use a ' +
|
|
233
|
+
'read-capable capability, or pass `force: true` if you are ' +
|
|
234
|
+
'creating a new space.'
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
return spaceMetadataBody({
|
|
238
|
+
id: this.id,
|
|
239
|
+
name: desc.name ?? current?.name,
|
|
240
|
+
controller: desc.controller ??
|
|
241
|
+
current?.controller ??
|
|
242
|
+
this.#context.controllerDid,
|
|
243
|
+
type: desc.type ?? current?.type
|
|
244
|
+
});
|
|
245
|
+
},
|
|
246
|
+
write: async (body, { ifMatch }) => {
|
|
247
|
+
await this.replaceDescription(body, { ifMatch });
|
|
248
|
+
return body;
|
|
249
|
+
},
|
|
250
|
+
operation: 'Space configuration'
|
|
203
251
|
});
|
|
204
252
|
return {
|
|
205
|
-
|
|
206
|
-
type: type ?? ['Space'],
|
|
207
|
-
...(name !== undefined ? { name } : {}),
|
|
253
|
+
...written,
|
|
208
254
|
// `controller` is a user-supplied DID string; assert it as the branded
|
|
209
255
|
// `IDID` the wire type now uses (the server validates the DID form).
|
|
210
|
-
controller: controller
|
|
256
|
+
controller: written.controller
|
|
211
257
|
};
|
|
212
258
|
}
|
|
213
259
|
/**
|
|
@@ -424,8 +470,15 @@ export class Space {
|
|
|
424
470
|
capability: this.#capability,
|
|
425
471
|
json: registration
|
|
426
472
|
});
|
|
427
|
-
|
|
428
|
-
|
|
473
|
+
const descriptor = dataOrNull(response);
|
|
474
|
+
if (descriptor === null) {
|
|
475
|
+
throw missingJsonBodyError({
|
|
476
|
+
response,
|
|
477
|
+
operation: 'Backend registration',
|
|
478
|
+
expected: 'the sanitized backend descriptor'
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
return descriptor;
|
|
429
482
|
}
|
|
430
483
|
/**
|
|
431
484
|
* Creates or replaces a registered `external` backend by id
|
|
@@ -633,8 +686,15 @@ export class Space {
|
|
|
633
686
|
body,
|
|
634
687
|
headers: { 'content-type': 'application/x-tar' }
|
|
635
688
|
});
|
|
636
|
-
|
|
637
|
-
|
|
689
|
+
const stats = dataOrNull(response);
|
|
690
|
+
if (stats === null) {
|
|
691
|
+
throw missingJsonBodyError({
|
|
692
|
+
response,
|
|
693
|
+
operation: 'Import',
|
|
694
|
+
expected: 'the import stats'
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
return stats;
|
|
638
698
|
}
|
|
639
699
|
/**
|
|
640
700
|
* Reads the space's access-control policy. Returns `null` when no policy is
|
|
@@ -664,7 +724,9 @@ export class Space {
|
|
|
664
724
|
});
|
|
665
725
|
}
|
|
666
726
|
/**
|
|
667
|
-
* Returns `true` when this space's policy is `PublicCanRead`.
|
|
727
|
+
* Returns `true` when this space's policy is `PublicCanRead`. Answers
|
|
728
|
+
* `false` when no policy is set or it is not visible to you, so a `false`
|
|
729
|
+
* does not prove the space is private.
|
|
668
730
|
*
|
|
669
731
|
* @returns {Promise<boolean>}
|
|
670
732
|
*/
|
package/dist/Space.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Space.js","sourceRoot":"","sources":["../src/Space.ts"],"names":[],"mappings":"AAeA,OAAO,EACL,SAAS,EACT,SAAS,EACT,WAAW,EACX,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,KAAK,EACN,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAEvD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,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AAS,CAAC,MAAsB;QACpC,OAAO,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE;YAChC,UAAU,EAAE,IAAI,CAAC,WAAW;YAC5B,MAAM;YACN,UAAU,EAAE,IAAI,CAAC,WAAW;SAC7B,CAAC,CAAA;IACJ,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,QAAQ;QACZ,OAAO,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE;YACnC,UAAU,EAAE,IAAI,CAAC,WAAW;YAC5B,UAAU,EAAE,IAAI,CAAC,WAAW;SAC7B,CAAC,CAAA;IACJ,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,SAAS;QACb,OAAO,eAAe,CAAC,IAAI,CAAC,QAAQ,EAAE;YACpC,UAAU,EAAE,IAAI,CAAC,WAAW;YAC5B,UAAU,EAAE,IAAI,CAAC,WAAW;SAC7B,CAAC,CAAA;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,WAAW;QACf,OAAO,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE;YACjC,UAAU,EAAE,IAAI,CAAC,WAAW;YAC5B,UAAU,EAAE,IAAI,CAAC,WAAW;SAC7B,CAAC,CAAA;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,OAAO;QACX,OAAO,QAAQ,CAAU,IAAI,CAAC,QAAQ,EAAE;YACtC,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3B,UAAU,EAAE,IAAI,CAAC,WAAW;SAC7B,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -15,19 +15,28 @@ export declare function hasKeyEpochs(encryption?: CollectionEncryption): encrypt
|
|
|
15
15
|
epochs: CollectionEncryptionEpoch[];
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
|
-
* Whether two descriptors
|
|
19
|
-
*
|
|
20
|
-
* order. An `
|
|
21
|
-
*
|
|
18
|
+
* Whether two descriptors carry the same epoch configuration: equal `scheme`,
|
|
19
|
+
* equal `version`, equal `currentEpoch`, AND the same epoch ids in the same
|
|
20
|
+
* order. An absent `version` compares as `EDV_SCHEME_VERSION`, the value the
|
|
21
|
+
* codec reads it as. This is the value the encrypted collections spec defines as the epoch
|
|
22
|
+
* configuration, the one a client pins, so a consumer pinning a descriptor
|
|
23
|
+
* with this comparator implements that pin. An `undefined` descriptor equals
|
|
24
|
+
* only another `undefined` one, so a caller holding nothing yet reads a
|
|
25
|
+
* freshly-read descriptor as a change.
|
|
22
26
|
*
|
|
23
|
-
* This is
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
+
* This is configuration identity, not descriptor equality. Two parts of the
|
|
28
|
+
* descriptor are deliberately outside it. The recipients wrapped inside each
|
|
29
|
+
* epoch are not compared: adding or removing a reader within an existing epoch
|
|
30
|
+
* leaves every epoch id and the write epoch alone, so the keys this reader
|
|
27
31
|
* already resolved stay correct and a cipher built from the older descriptor
|
|
28
|
-
* stays valid.
|
|
29
|
-
*
|
|
30
|
-
*
|
|
32
|
+
* stays valid. The `hmac` member is not compared either. The spec states that
|
|
33
|
+
* on pure point state neither is covered by the pin, so a host can substitute
|
|
34
|
+
* them undetected here. Only the log form of the descriptor authenticates
|
|
35
|
+
* them.
|
|
36
|
+
*
|
|
37
|
+
* A rotation (a new epoch appended and `currentEpoch` moved onto it) reads as
|
|
38
|
+
* a change, and so does any move of `scheme` or `version`, including a
|
|
39
|
+
* `version` decrease a pinning consumer must refuse.
|
|
31
40
|
*
|
|
32
41
|
* @param [current] {CollectionEncryption} the descriptor in hand
|
|
33
42
|
* @param [next] {CollectionEncryption} the descriptor to compare it against
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epochRoster.d.ts","sourceRoot":"","sources":["../../src/edv/epochRoster.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"epochRoster.d.ts","sourceRoot":"","sources":["../../src/edv/epochRoster.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EACV,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,aAAa,CAAA;AAEpB;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAC1B,UAAU,CAAC,EAAE,oBAAoB,GAChC,UAAU,IAAI,oBAAoB,GAAG;IACtC,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,yBAAyB,EAAE,CAAA;CACpC,CAOA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,CAAC,EAAE,oBAAoB,EAC9B,IAAI,CAAC,EAAE,oBAAoB,GAC1B,OAAO,CAkBT;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,YAAY,EACZ,KAAK,EACN,EAAE;IACD,MAAM,EAAE,yBAAyB,EAAE,CAAA;IACnC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,EAAE,MAAM,CAAA;CACd,GAAG,yBAAyB,CAkB5B"}
|
package/dist/edv/epochRoster.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* Crypto-free predicates over a Collection's `encryption` descriptor: whether it
|
|
6
|
-
* carries a usable key-epoch roster, and whether two descriptors
|
|
7
|
-
*
|
|
8
|
-
* descriptor -- open it, refuse it fail-closed, rebuild a cipher
|
|
9
|
-
* not have to pull in the epoch crypto to ask.
|
|
6
|
+
* carries a usable key-epoch roster, and whether two descriptors carry the same
|
|
7
|
+
* epoch configuration. Neither touches key material, so a caller deciding what
|
|
8
|
+
* to do with a descriptor -- open it, refuse it fail-closed, rebuild a cipher
|
|
9
|
+
* for it -- does not have to pull in the epoch crypto to ask.
|
|
10
10
|
*
|
|
11
11
|
* These exist because every consumer that holds descriptors (a local replica
|
|
12
12
|
* deciding whether a collection is encrypted, a sync layer deciding whether a
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* consumers to be worth anything.
|
|
16
16
|
*/
|
|
17
17
|
import { EncryptionError } from '../errors.js';
|
|
18
|
+
import { EDV_SCHEME_VERSION } from './constants.js';
|
|
18
19
|
/**
|
|
19
20
|
* Whether a descriptor carries a usable key-epoch roster: it is present, its
|
|
20
21
|
* `currentEpoch` is a string, and its `epochs` list is a non-empty array. Both
|
|
@@ -33,19 +34,28 @@ export function hasKeyEpochs(encryption) {
|
|
|
33
34
|
encryption.epochs.length > 0);
|
|
34
35
|
}
|
|
35
36
|
/**
|
|
36
|
-
* Whether two descriptors
|
|
37
|
-
*
|
|
38
|
-
* order. An `
|
|
39
|
-
*
|
|
37
|
+
* Whether two descriptors carry the same epoch configuration: equal `scheme`,
|
|
38
|
+
* equal `version`, equal `currentEpoch`, AND the same epoch ids in the same
|
|
39
|
+
* order. An absent `version` compares as `EDV_SCHEME_VERSION`, the value the
|
|
40
|
+
* codec reads it as. This is the value the encrypted collections spec defines as the epoch
|
|
41
|
+
* configuration, the one a client pins, so a consumer pinning a descriptor
|
|
42
|
+
* with this comparator implements that pin. An `undefined` descriptor equals
|
|
43
|
+
* only another `undefined` one, so a caller holding nothing yet reads a
|
|
44
|
+
* freshly-read descriptor as a change.
|
|
40
45
|
*
|
|
41
|
-
* This is
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
46
|
+
* This is configuration identity, not descriptor equality. Two parts of the
|
|
47
|
+
* descriptor are deliberately outside it. The recipients wrapped inside each
|
|
48
|
+
* epoch are not compared: adding or removing a reader within an existing epoch
|
|
49
|
+
* leaves every epoch id and the write epoch alone, so the keys this reader
|
|
45
50
|
* already resolved stay correct and a cipher built from the older descriptor
|
|
46
|
-
* stays valid.
|
|
47
|
-
*
|
|
48
|
-
*
|
|
51
|
+
* stays valid. The `hmac` member is not compared either. The spec states that
|
|
52
|
+
* on pure point state neither is covered by the pin, so a host can substitute
|
|
53
|
+
* them undetected here. Only the log form of the descriptor authenticates
|
|
54
|
+
* them.
|
|
55
|
+
*
|
|
56
|
+
* A rotation (a new epoch appended and `currentEpoch` moved onto it) reads as
|
|
57
|
+
* a change, and so does any move of `scheme` or `version`, including a
|
|
58
|
+
* `version` decrease a pinning consumer must refuse.
|
|
49
59
|
*
|
|
50
60
|
* @param [current] {CollectionEncryption} the descriptor in hand
|
|
51
61
|
* @param [next] {CollectionEncryption} the descriptor to compare it against
|
|
@@ -55,7 +65,10 @@ export function epochRostersEqual(current, next) {
|
|
|
55
65
|
if (current === undefined || next === undefined) {
|
|
56
66
|
return current === undefined && next === undefined;
|
|
57
67
|
}
|
|
58
|
-
if (current.
|
|
68
|
+
if (current.scheme !== next.scheme ||
|
|
69
|
+
(current.version ?? EDV_SCHEME_VERSION) !==
|
|
70
|
+
(next.version ?? EDV_SCHEME_VERSION) ||
|
|
71
|
+
current.currentEpoch !== next.currentEpoch) {
|
|
59
72
|
return false;
|
|
60
73
|
}
|
|
61
74
|
const currentIds = (current.epochs ?? []).map(epoch => epoch.id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epochRoster.js","sourceRoot":"","sources":["../../src/edv/epochRoster.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"epochRoster.js","sourceRoot":"","sources":["../../src/edv/epochRoster.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAMnD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAC1B,UAAiC;IAKjC,OAAO,CACL,UAAU,KAAK,SAAS;QACxB,OAAO,UAAU,CAAC,YAAY,KAAK,QAAQ;QAC3C,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;QAChC,UAAU,CAAC,MAAM,CAAC,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,CAAA;IACH,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,YAAY,CAAC,CAAA;IAC7D,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,eAAe,CACvB,cAAc,KAAK,2BAA2B,YAAY,YAAY;YACpE,gEAAgE;YAChE,iEAAiE;YACjE,UAAU,CACb,CAAA;IACH,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
|
package/dist/edv/index.d.ts
CHANGED
|
@@ -35,7 +35,9 @@
|
|
|
35
35
|
*
|
|
36
36
|
* `hasKeyEpochs` and `epochRostersEqual` are the crypto-free predicates over a
|
|
37
37
|
* descriptor: whether it carries a usable roster, and whether two descriptors
|
|
38
|
-
*
|
|
38
|
+
* carry the same epoch configuration (`scheme`, `version`, `currentEpoch`, and
|
|
39
|
+
* the ordered epoch ids; recipients and the `hmac` member deliberately
|
|
40
|
+
* excluded).
|
|
39
41
|
*
|
|
40
42
|
* `x25519RecipientFromDidKey` is the one rule for turning a grantee named only
|
|
41
43
|
* by its Ed25519 `did:key` controller into a `RecipientPublicKey`, so a
|
package/dist/edv/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/edv/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/edv/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;AACH,OAAO,EACL,mBAAmB,EACnB,QAAQ,EACR,mBAAmB,EACpB,MAAM,eAAe,CAAA;AACtB,YAAY,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACnE,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kBAAkB,EAClB,mBAAmB,EACpB,MAAM,cAAc,CAAA;AACrB,YAAY,EACV,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AACtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAA;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA"}
|
package/dist/edv/index.js
CHANGED
|
@@ -35,7 +35,9 @@
|
|
|
35
35
|
*
|
|
36
36
|
* `hasKeyEpochs` and `epochRostersEqual` are the crypto-free predicates over a
|
|
37
37
|
* descriptor: whether it carries a usable roster, and whether two descriptors
|
|
38
|
-
*
|
|
38
|
+
* carry the same epoch configuration (`scheme`, `version`, `currentEpoch`, and
|
|
39
|
+
* the ordered epoch ids; recipients and the `hmac` member deliberately
|
|
40
|
+
* excluded).
|
|
39
41
|
*
|
|
40
42
|
* `x25519RecipientFromDidKey` is the one rule for turning a grantee named only
|
|
41
43
|
* by its Ed25519 `did:key` controller into a `RecipientPublicKey`, so a
|
package/dist/edv/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/edv/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/edv/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;AACH,OAAO,EACL,mBAAmB,EACnB,QAAQ,EACR,mBAAmB,EACpB,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACtE,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,gBAAgB,EACjB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EACL,eAAe,EACf,yBAAyB,EAC1B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EACL,8BAA8B,EAC9B,oCAAoC,EACpC,0BAA0B,EAC1B,8BAA8B,EAC9B,yBAAyB,EAC1B,MAAM,iCAAiC,CAAA;AAExC,OAAO,EACL,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,eAAe,EAChB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEjD,OAAO,EACL,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,cAAc,EACf,MAAM,cAAc,CAAA;AAErB,OAAO,EACL,kBAAkB,EAClB,6BAA6B,EAC7B,cAAc,EACd,sBAAsB,EACtB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,cAAc,CAAA;AAKrB,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AACtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAA;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { Space } from './Space.js';
|
|
|
10
10
|
export { Collection } from './Collection.js';
|
|
11
11
|
export { Resource } from './Resource.js';
|
|
12
12
|
export { zcapClientForSigner } from './zcapClient.js';
|
|
13
|
+
export { discoverService } from './internal/service.js';
|
|
13
14
|
export { parseSpaceTarget } from './internal/paths.js';
|
|
14
15
|
export type { ParsedSpacePath } from './internal/paths.js';
|
|
15
16
|
export { readEtag, writeHeaders } from './internal/conditional.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAClE,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAElE,OAAO,EACL,QAAQ,EACR,aAAa,EACb,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,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-10,6 +10,7 @@ export { Space } from './Space.js';
|
|
|
10
10
|
export { Collection } from './Collection.js';
|
|
11
11
|
export { Resource } from './Resource.js';
|
|
12
12
|
export { zcapClientForSigner } from './zcapClient.js';
|
|
13
|
+
export { discoverService } from './internal/service.js';
|
|
13
14
|
export { parseSpaceTarget } from './internal/paths.js';
|
|
14
15
|
export { readEtag, writeHeaders } from './internal/conditional.js';
|
|
15
16
|
export { WasError, NotFoundError, CapabilityRevokedError, CapabilityExpiredError, ValidationError, AlreadyRevokedError, AuthRequiredError, NotImplementedError, NotSupportedError, IncompatibleServerError, ConflictError, PreconditionFailedError, PayloadTooLargeError, QuotaExceededError, EncryptionError, EncryptOnlyCipherError, KeyUnwrapError, IntegrityError, WasSyncAuthError, WasSyncConflictError, WasSyncNotFoundError, WasServerError, httpStatus, mapError } from './errors.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEtD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAGlE,OAAO,EACL,QAAQ,EACR,aAAa,EACb,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,EACvB,aAAa,EACb,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,UAAU,EACV,QAAQ,EACT,MAAM,aAAa,CAAA;AAIpB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/internal/cas.d.ts
CHANGED
|
@@ -95,4 +95,49 @@ export declare function compareAndSwap<T>({ store, mutate, operation, onAbsent,
|
|
|
95
95
|
onAbsent?: () => T;
|
|
96
96
|
maxAttempts?: number;
|
|
97
97
|
}): Promise<T>;
|
|
98
|
+
/**
|
|
99
|
+
* A merging write over a versioned object, run through {@link compareAndSwap}.
|
|
100
|
+
* `compose` is handed a baseline read and returns the write body, and `write`
|
|
101
|
+
* sends that body pinned to the baseline's validator. A lost race (a `412`)
|
|
102
|
+
* re-reads, re-composes, and re-sends, so a merge is only applied over a
|
|
103
|
+
* version this write observed. A baseline carrying no validator makes its
|
|
104
|
+
* attempt an unconditional write (`ifMatch` is `undefined`), which is all a
|
|
105
|
+
* backend without `conditional-writes` offers.
|
|
106
|
+
*
|
|
107
|
+
* Unlike a plain {@link CasStore}, the body is not the stored value itself.
|
|
108
|
+
* The stored value may be `null` (an absent or unreadable object), and
|
|
109
|
+
* `compose` decides whether proceeding from it is safe; a refusal it throws
|
|
110
|
+
* propagates unchanged. `compose` runs once per attempt, so a caller that
|
|
111
|
+
* needs what was merged reads it from the value `write` resolves, which is the
|
|
112
|
+
* last attempt's.
|
|
113
|
+
*
|
|
114
|
+
* @param options {object}
|
|
115
|
+
* @param options.read {function} reads a fresh baseline and its validator;
|
|
116
|
+
* may throw a caller-specific refusal (e.g. for an unreadable object)
|
|
117
|
+
* @param [options.current] {object} a baseline the caller has already read,
|
|
118
|
+
* used for the first attempt only; a rebase calls `read`
|
|
119
|
+
* @param options.compose {function} baseline to write body (may be async)
|
|
120
|
+
* @param options.write {function} sends the body under `ifMatch`; a stale
|
|
121
|
+
* validator throws `PreconditionFailedError` (412)
|
|
122
|
+
* @param options.operation {string} what the caller is doing, for the
|
|
123
|
+
* exhaustion error's message
|
|
124
|
+
* @param [options.maxAttempts] {number} defaults to {@link DEFAULT_CAS_ATTEMPTS}
|
|
125
|
+
* @returns {Promise<R>} what the successful `write` resolved
|
|
126
|
+
*/
|
|
127
|
+
export declare function composeAndSwap<B, W extends object, R>({ read, current, compose, write, operation, maxAttempts }: {
|
|
128
|
+
read: () => Promise<{
|
|
129
|
+
value: B;
|
|
130
|
+
etag?: string;
|
|
131
|
+
}>;
|
|
132
|
+
current?: {
|
|
133
|
+
value: B;
|
|
134
|
+
etag?: string;
|
|
135
|
+
};
|
|
136
|
+
compose: (baseline: B) => W | Promise<W>;
|
|
137
|
+
write: (body: W, precondition: {
|
|
138
|
+
ifMatch?: string;
|
|
139
|
+
}) => Promise<R>;
|
|
140
|
+
operation: string;
|
|
141
|
+
maxAttempts?: number;
|
|
142
|
+
}): Promise<R>;
|
|
98
143
|
//# sourceMappingURL=cas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cas.d.ts","sourceRoot":"","sources":["../../src/internal/cas.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cas.d.ts","sourceRoot":"","sources":["../../src/internal/cas.ts"],"names":[],"mappings":"AAeA;;;;;GAKG;AACH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