@interop/was-client 0.20.0 → 0.21.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.
@@ -41,6 +41,22 @@ export declare class Resource {
41
41
  * @returns {Promise<Json | Blob | null>}
42
42
  */
43
43
  get(): Promise<Json | Blob | null>;
44
+ /**
45
+ * Reads the resource together with its `ETag` validator (the backend's
46
+ * `conditional-writes` feature) -- the Resource counterpart of
47
+ * `Collection.describeWithEtag`. The `ETag` is the opaque validator to pass
48
+ * to {@link put}'s `ifMatch` for a lost-update-safe (compare-and-swap)
49
+ * write. The value is decoded like {@link get} (JSON parsed, binary as a
50
+ * `Blob`, decrypted on an encrypted collection). Returns `null` if the
51
+ * resource is missing or not visible to you (404 conflation caveat); `etag`
52
+ * is absent against a backend that does not version resources.
53
+ *
54
+ * @returns {Promise<{ data: Json | Blob; etag?: string } | null>}
55
+ */
56
+ getWithEtag(): Promise<{
57
+ data: Json | Blob;
58
+ etag?: string;
59
+ } | null>;
44
60
  /**
45
61
  * Reads the resource body as text. Returns `null` on a missing/unauthorized
46
62
  * resource (404 conflation caveat). A raw escape hatch: it does NOT run the
@@ -1 +1 @@
1
- {"version":3,"file":"Resource.d.ts","sourceRoot":"","sources":["../src/Resource.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAc1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,KAAK,EACV,kBAAkB,EAClB,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,YAAY,CAAA;AAkBnB,qBAAa,QAAQ;;IACnB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IA8BnB;;;;;;;;;;;;;;;;OA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ACG,MAAM,CAAC,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAgB/D;;;;;;;;;;;;;;;;OAgBG;IACG,IAAI,IAAI,OAAO,CAAC,CAAC,gBAAgB,GAAG;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,IAAI,CAAC;IAkCpE;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACG,OAAO,CACX,IAAI,GAAE;QAAE,MAAM,CAAC,EAAE,sBAAsB,CAAA;KAAO,EAC9C,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,OAAO,CAAA;KAAO,GACxD,OAAO,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAyC7B;;;;;;;;;;OAUG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1C;;;;;;OAMG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ1D;;;;;;OAMG;IACG,SAAS,IAAI,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAOjD;;;;;OAKG;IACG,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAQtD;;;;;OAKG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAOhC;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IAOlC;;;;;OAKG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CAMnC"}
package/dist/Resource.js CHANGED
@@ -140,6 +140,28 @@ export class Resource {
140
140
  const response = await this.#read();
141
141
  return response === null ? null : codec.decode(response, this.id);
142
142
  }
143
+ /**
144
+ * Reads the resource together with its `ETag` validator (the backend's
145
+ * `conditional-writes` feature) -- the Resource counterpart of
146
+ * `Collection.describeWithEtag`. The `ETag` is the opaque validator to pass
147
+ * to {@link put}'s `ifMatch` for a lost-update-safe (compare-and-swap)
148
+ * write. The value is decoded like {@link get} (JSON parsed, binary as a
149
+ * `Blob`, decrypted on an encrypted collection). Returns `null` if the
150
+ * resource is missing or not visible to you (404 conflation caveat); `etag`
151
+ * is absent against a backend that does not version resources.
152
+ *
153
+ * @returns {Promise<{ data: Json | Blob; etag?: string } | null>}
154
+ */
155
+ async getWithEtag() {
156
+ const codec = await this.#codec();
157
+ const response = await this.#read();
158
+ if (response === null) {
159
+ return null;
160
+ }
161
+ const data = await codec.decode(response, this.id);
162
+ const etag = readEtag(response);
163
+ return etag !== undefined ? { data, etag } : { data };
164
+ }
143
165
  /**
144
166
  * Reads the resource body as text. Returns `null` on a missing/unauthorized
145
167
  * resource (404 conflation caveat). A raw escape hatch: it does NOT run the
@@ -1 +1 @@
1
- {"version":3,"file":"Resource.js","sourceRoot":"","sources":["../src/Resource.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AAClE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EACL,UAAU,EACV,WAAW,EACX,YAAY,EACZ,cAAc,EACd,eAAe,EAChB,MAAM,sBA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ACH,KAAK,CAAC,SAAS;QACb,OAAO,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE;YAC/B,UAAU,EAAE,IAAI,CAAC,WAAW;YAC5B,UAAU,EAAE,IAAI,CAAC,WAAW;SAC7B,CAAC,CAAA;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,SAAS,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;;;;;OAKG;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;;;;OAIG;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;;;;;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;CACF"}
@@ -20,12 +20,17 @@
20
20
  * `addRecipient` / `removeRecipient` manage the readers and rotate the epoch
21
21
  * key, so the same `createEdvEncryption` provider transparently encrypts each
22
22
  * write under the current epoch and decrypts any epoch a reader still holds.
23
+ * They mutate the marker through the marker-store seam: the Collection
24
+ * Description by default, or any `MarkerStore` -- e.g. `resourceMarkerStore`
25
+ * for a marker hosted as a plain JSON Resource.
23
26
  */
24
27
  export { createEdvEncryption, EdvCodec } from './EdvCodec.js';
25
28
  export type { EdvKeys } from './EdvCodec.js';
26
29
  export { WasTransport, JOSE_CONTENT_TYPE } from './WasTransport.js';
27
30
  export { initRecipients, addRecipient, removeRecipient } from './recipients.js';
28
31
  export type { OwnerKey, RecipientPublicKey } from './recipients.js';
32
+ export { collectionMarkerStore, resourceMarkerStore } from './markerStore.js';
33
+ export type { MarkerStore } from './markerStore.js';
29
34
  export { mintEpoch, epochKeyIdFor } from './epochCrypto.js';
30
35
  export { createEdvDocCipher, ownerRecipient, UnknownEpochError, isEncryptedEnvelope } from './docCipher.js';
31
36
  export type { DocCipher } from './docCipher.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/edv/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7D,YAAY,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAC/E,YAAY,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,gBAAgB,CAAA;AACvB,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/edv/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7D,YAAY,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAC/E,YAAY,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAC7E,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,gBAAgB,CAAA;AACvB,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA"}
package/dist/edv/index.js CHANGED
@@ -20,10 +20,14 @@
20
20
  * `addRecipient` / `removeRecipient` manage the readers and rotate the epoch
21
21
  * key, so the same `createEdvEncryption` provider transparently encrypts each
22
22
  * write under the current epoch and decrypts any epoch a reader still holds.
23
+ * They mutate the marker through the marker-store seam: the Collection
24
+ * Description by default, or any `MarkerStore` -- e.g. `resourceMarkerStore`
25
+ * for a marker hosted as a plain JSON Resource.
23
26
  */
24
27
  export { createEdvEncryption, EdvCodec } from './EdvCodec.js';
25
28
  export { WasTransport, JOSE_CONTENT_TYPE } from './WasTransport.js';
26
29
  export { initRecipients, addRecipient, removeRecipient } from './recipients.js';
30
+ export { collectionMarkerStore, resourceMarkerStore } from './markerStore.js';
27
31
  export { mintEpoch, epochKeyIdFor } from './epochCrypto.js';
28
32
  export { createEdvDocCipher, ownerRecipient, UnknownEpochError, isEncryptedEnvelope } from './docCipher.js';
29
33
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/edv/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAE7D,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAE/E,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/edv/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAE7D,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAE/E,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAE7E,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,gBAAgB,CAAA"}
@@ -0,0 +1,118 @@
1
+ /*!
2
+ * Copyright (c) 2026 Interop Alliance. All rights reserved.
3
+ */
4
+ /**
5
+ * The marker-store seam: where a `CollectionEncryption` marker lives and how it
6
+ * is compare-and-swapped. The recipient primitives (`initRecipients` /
7
+ * `addRecipient` / `removeRecipient`) mutate a marker only through this port,
8
+ * so the same key-epoch machinery manages a Collection's own `encryption`
9
+ * marker (the classic host) or a marker hosted as a plain JSON Resource (e.g. a
10
+ * per-user-key roster in a private collection).
11
+ *
12
+ * Two adapters:
13
+ *
14
+ * - {@link collectionMarkerStore} -- the Collection Description's `encryption`
15
+ * member, read with `describeWithEtag` and written back with
16
+ * `replaceDescription` + `If-Match`. The server enforces the marker
17
+ * invariants (append-only epochs, monotone `currentEpoch`, non-decreasing
18
+ * `version`) on this path.
19
+ * - {@link resourceMarkerStore} -- a marker stored verbatim as a JSON Resource.
20
+ * The server treats the resource as opaque content and enforces NO marker
21
+ * invariants there; integrity rests on the client-side `epochsMac` (verified
22
+ * by writers before encrypting) plus client-side epoch pinning. Both the
23
+ * compare-and-swap and the create-if-absent guard ride the backend's
24
+ * `conditional-writes` feature. The hosting collection must be plaintext: on
25
+ * an encrypted collection the EDV codec computes the write preconditions
26
+ * itself and the store's `ifMatch` would not be honored.
27
+ */
28
+ import type { Collection } from '../Collection.js';
29
+ import type { Resource } from '../Resource.js';
30
+ import type { CollectionEncryption } from '../types.js';
31
+ /**
32
+ * Where a `CollectionEncryption` marker lives: a read-with-validator plus a
33
+ * compare-and-swap write, the two operations the recipient primitives' CAS
34
+ * loop needs. Implementations host the marker anywhere a versioned JSON value
35
+ * can live; the two shipped adapters are {@link collectionMarkerStore} and
36
+ * {@link resourceMarkerStore}.
37
+ */
38
+ export interface MarkerStore {
39
+ /**
40
+ * Reads the current marker together with the opaque `etag` validator the
41
+ * next {@link replace} must be compare-and-swapped against. Resolves `null`
42
+ * when no marker exists yet AND this store can create one (the resource
43
+ * adapter before the first `initRecipients`); a store whose host must
44
+ * already exist (the description adapter) throws instead of resolving
45
+ * `null`. Throws when the hosted value is not an `edv`-scheme marker.
46
+ *
47
+ * @returns {Promise<{ marker: CollectionEncryption; etag?: string } | null>}
48
+ */
49
+ read(): Promise<{
50
+ marker: CollectionEncryption;
51
+ etag?: string;
52
+ } | null>;
53
+ /**
54
+ * Replaces the marker, compare-and-swapped against `ifMatch` (the validator
55
+ * from {@link read}); a stale validator throws `PreconditionFailedError`
56
+ * (412). Must follow a {@link read} on the same store instance -- an adapter
57
+ * may forward sibling state observed by its most recent read (the
58
+ * description adapter forwards the description's `name` / `backend`).
59
+ *
60
+ * @param marker {CollectionEncryption}
61
+ * @param options {object}
62
+ * @param [options.ifMatch] {string} the validator from the prior read;
63
+ * absent against a host that does not version its writes
64
+ * @returns {Promise<void>}
65
+ */
66
+ replace(marker: CollectionEncryption, options: {
67
+ ifMatch?: string;
68
+ }): Promise<void>;
69
+ /**
70
+ * Creates the FIRST marker where {@link read} resolved `null`, guarded
71
+ * create-if-absent (`If-None-Match: *`); throws `PreconditionFailedError`
72
+ * (412) when a concurrent writer created one first. Absent on stores whose
73
+ * host always exists (the description adapter).
74
+ *
75
+ * @param marker {CollectionEncryption}
76
+ * @returns {Promise<void>}
77
+ */
78
+ create?(marker: CollectionEncryption): Promise<void>;
79
+ }
80
+ /**
81
+ * The Collection Description adapter: the marker is the Description's
82
+ * `encryption` member. Read fails closed when the Description is unreadable
83
+ * (WAS masks unauthorized reads as 404) or the collection is not declared
84
+ * encrypted with the `edv` scheme; the CAS write forwards the description's
85
+ * sibling fields (`name` / `backend`) observed by the most recent read, so
86
+ * the replace-semantics PUT does not drop them. No `create`: a Collection
87
+ * Description always exists, so a first marker is declared via
88
+ * `collection.configure({ encryption })`, never through this store.
89
+ *
90
+ * @param options {object}
91
+ * @param options.collection {Collection}
92
+ * @returns {MarkerStore}
93
+ */
94
+ export declare function collectionMarkerStore({ collection }: {
95
+ collection: Collection;
96
+ }): MarkerStore;
97
+ /**
98
+ * The plain-JSON-Resource adapter: the marker is the resource's entire
99
+ * content, stored verbatim. Read resolves `null` when the resource is absent
100
+ * (the pre-`initRecipients` state -- `create` then writes the first marker
101
+ * with `If-None-Match: *`), and throws when the resource holds something other
102
+ * than an `edv`-scheme marker object.
103
+ *
104
+ * The server enforces no marker invariants on a resource (unlike a Collection
105
+ * Description): rollback/tamper detection rests on the marker's `epochsMac`
106
+ * and client-side epoch pinning, and the CAS/create guards ride the backend's
107
+ * `conditional-writes` feature. Host the resource in a plaintext collection --
108
+ * on an encrypted collection the EDV codec computes the write preconditions
109
+ * itself, so this store's `ifMatch` would not be honored.
110
+ *
111
+ * @param options {object}
112
+ * @param options.resource {Resource}
113
+ * @returns {MarkerStore}
114
+ */
115
+ export declare function resourceMarkerStore({ resource }: {
116
+ resource: Resource;
117
+ }): MarkerStore;
118
+ //# sourceMappingURL=markerStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markerStore.d.ts","sourceRoot":"","sources":["../../src/edv/markerStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAG9C,OAAO,KAAK,EAEV,oBAAoB,EAErB,MAAM,aAAa,CAAA;AAEpB;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;;;;;;OASG;IACH,IAAI,IAAI,OAAO,CAAC;QAAE,MAAM,EAAE,oBAAoB,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAA;IAEvE;;;;;;;;;;;;OAYG;IACH,OAAO,CACL,MAAM,EAAE,oBAAoB,EAC5B,OAAO,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAC5B,OAAO,CAAC,IAAI,CAAC,CAAA;IAEhB;;;;;;;;OAQG;IACH,MAAM,CAAC,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACrD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,UAAU,EACX,EAAE;IACD,UAAU,EAAE,UAAU,CAAA;CACvB,GAAG,WAAW,CAoCd;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACT,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAA;CACnB,GAAG,WAAW,CAgCd"}
@@ -0,0 +1,108 @@
1
+ import { unreadableDescriptionError } from '../internal/describe.js';
2
+ import { ValidationError } from '../errors.js';
3
+ /**
4
+ * The Collection Description adapter: the marker is the Description's
5
+ * `encryption` member. Read fails closed when the Description is unreadable
6
+ * (WAS masks unauthorized reads as 404) or the collection is not declared
7
+ * encrypted with the `edv` scheme; the CAS write forwards the description's
8
+ * sibling fields (`name` / `backend`) observed by the most recent read, so
9
+ * the replace-semantics PUT does not drop them. No `create`: a Collection
10
+ * Description always exists, so a first marker is declared via
11
+ * `collection.configure({ encryption })`, never through this store.
12
+ *
13
+ * @param options {object}
14
+ * @param options.collection {Collection}
15
+ * @returns {MarkerStore}
16
+ */
17
+ export function collectionMarkerStore({ collection }) {
18
+ // The sibling description fields observed by the most recent read, forwarded
19
+ // verbatim by the CAS write (the server's replace semantics would otherwise
20
+ // drop them). Safe to forward even if stale: the write is pinned to the same
21
+ // read's ETag, so a concurrent description change fails the CAS instead.
22
+ let described;
23
+ return {
24
+ async read() {
25
+ const current = await collection.describeWithEtag();
26
+ if (current === null) {
27
+ throw unreadableDescriptionError({
28
+ operation: 'manage recipients',
29
+ advice: 'Use a capability that can read the Collection Description.'
30
+ });
31
+ }
32
+ const marker = current.description.encryption;
33
+ if (!marker || marker.scheme !== 'edv') {
34
+ throw new ValidationError('Cannot manage recipients: this collection is not declared ' +
35
+ "encrypted with the 'edv' scheme.");
36
+ }
37
+ described = current.description;
38
+ return { marker, etag: current.etag };
39
+ },
40
+ async replace(marker, { ifMatch }) {
41
+ await collection.replaceDescription({
42
+ name: described?.name,
43
+ backend: described?.backend,
44
+ encryption: marker
45
+ }, { ifMatch });
46
+ }
47
+ };
48
+ }
49
+ /**
50
+ * The plain-JSON-Resource adapter: the marker is the resource's entire
51
+ * content, stored verbatim. Read resolves `null` when the resource is absent
52
+ * (the pre-`initRecipients` state -- `create` then writes the first marker
53
+ * with `If-None-Match: *`), and throws when the resource holds something other
54
+ * than an `edv`-scheme marker object.
55
+ *
56
+ * The server enforces no marker invariants on a resource (unlike a Collection
57
+ * Description): rollback/tamper detection rests on the marker's `epochsMac`
58
+ * and client-side epoch pinning, and the CAS/create guards ride the backend's
59
+ * `conditional-writes` feature. Host the resource in a plaintext collection --
60
+ * on an encrypted collection the EDV codec computes the write preconditions
61
+ * itself, so this store's `ifMatch` would not be honored.
62
+ *
63
+ * @param options {object}
64
+ * @param options.resource {Resource}
65
+ * @returns {MarkerStore}
66
+ */
67
+ export function resourceMarkerStore({ resource }) {
68
+ return {
69
+ async read() {
70
+ const current = await resource.getWithEtag();
71
+ if (current === null) {
72
+ return null;
73
+ }
74
+ const marker = current.data;
75
+ if (marker === null ||
76
+ typeof marker !== 'object' ||
77
+ Array.isArray(marker) ||
78
+ marker instanceof Blob ||
79
+ marker.scheme !== 'edv') {
80
+ throw new ValidationError(`Cannot manage recipients: the resource "${resource.id}" does not ` +
81
+ "hold a CollectionEncryption marker with the 'edv' scheme.");
82
+ }
83
+ return {
84
+ marker: marker,
85
+ etag: current.etag
86
+ };
87
+ },
88
+ async replace(marker, { ifMatch }) {
89
+ await resource.put(markerAsJson(marker), { ifMatch });
90
+ },
91
+ async create(marker) {
92
+ await resource.put(markerAsJson(marker), { ifNoneMatch: true });
93
+ }
94
+ };
95
+ }
96
+ /**
97
+ * Casts a marker to the `JsonObject` a resource write takes. The marker types
98
+ * are interfaces without index signatures, so they do not structurally satisfy
99
+ * `JsonObject` -- but a marker is plain JSON by construction (it round-trips
100
+ * through the Collection Description on the classic host), so this is sound.
101
+ *
102
+ * @param marker {CollectionEncryption}
103
+ * @returns {JsonObject}
104
+ */
105
+ function markerAsJson(marker) {
106
+ return marker;
107
+ }
108
+ //# sourceMappingURL=markerStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markerStore.js","sourceRoot":"","sources":["../../src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Q,EAGT;IACC,OAAO;QACL,KAAK,CAAC,IAAI;YACR,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAA;YAC5C,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;gBACrB,OAAO,IAAI,CAAA;YACb,CAAC;YACD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAA;YAC3B,IACE,MAAM,KAAK,IAAI;gBACf,OAAO,MAAM,KAAK,QAAQ;gBAC1B,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;gBACrB,MAAM,YAAY,IAAI;gBACrB,MAA+B,CAAC,MAAM,KAAK,KAAK,EACjD,CAAC;gBACD,MAAM,IAAI,eAAe,CACvB,2CAA2C,QAAQ,CAAC,EAAE,aAAa;oBACjE,2DAA2D,CAC9D,CAAA;YACH,CAAC;YACD,OAAO;gBACL,MAAM,EAAE,MAAyC;gBACjD,IAAI,EAAE,OAAO,CAAC,IAAI;aACnB,CAAA;QACH,CAAC;QACD,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE;YAC/B,MAAM,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;QACvD,CAAC;QACD,KAAK,CAAC,MAAM,CAAC,MAAM;YACjB,MAAM,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAA;QACjE,CAAC;KACF,CAAA;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,YAAY,CAAC,MAA4B;IAChD,OAAO,MAA+B,CAAA;AACxC,CAAC"}
@@ -5,14 +5,20 @@
5
5
  * Recipient and key-epoch management for multi-recipient encrypted Collections:
6
6
  * initializing the first epoch, adding a reader (escrow -- history included),
7
7
  * and removing a reader (the full revoke-and-rotate procedure). Each operation
8
- * mutates the Collection's `encryption` marker and writes it back with a
9
- * compare-and-swap (`If-Match`), retrying on a concurrent change so two racing
10
- * recipient edits cannot clobber one another.
8
+ * mutates a `CollectionEncryption` marker through the marker-store seam (see
9
+ * `markerStore.ts`) -- the Collection Description's `encryption` member for the
10
+ * `collection` sugar, or any explicit `store`, such as a marker hosted as a
11
+ * plain JSON Resource -- and writes it back with a compare-and-swap
12
+ * (`If-Match`), retrying on a concurrent change so two racing recipient edits
13
+ * cannot clobber one another.
11
14
  *
12
15
  * The two axes stay separate and are both required to actually remove a reader:
13
16
  *
14
- * - **pull** -- the zcap the server checks at request time. Revoking it stops
15
- * the server serving that reader ciphertext. Immediate and total.
17
+ * - **pull** -- the reader's server-side access. For a Collection this is the
18
+ * zcap the server checks at request time: revoking it stops the server
19
+ * serving that reader ciphertext. Immediate and total. A marker whose pull
20
+ * axis lives elsewhere (e.g. a DID document naming the readers) supplies a
21
+ * `pull` action instead of the default zcap revocation.
16
22
  * - **read** -- possession of an epoch key. Rotating the epoch means resources
17
23
  * written afterward are encrypted under a key the removed reader does not
18
24
  * hold. Prospective only.
@@ -27,6 +33,7 @@
27
33
  import type { IKeyAgreementKey } from '@interop/data-integrity-core';
28
34
  import type { Collection } from '../Collection.js';
29
35
  import type { Space } from '../Space.js';
36
+ import type { MarkerStore } from './markerStore.js';
30
37
  import type { CollectionEncryption, IDelegatedZcap } from '../types.js';
31
38
  import type { RecipientPublicKey } from './epochCrypto.js';
32
39
  export type { RecipientPublicKey } from './epochCrypto.js';
@@ -38,20 +45,30 @@ export interface OwnerKey {
38
45
  keyAgreementKey: IKeyAgreementKey;
39
46
  }
40
47
  /**
41
- * Initializes the first key epoch on a Collection that is declared encrypted
42
- * but has no epochs yet: mints a fresh epoch key, wraps it to each initial
43
- * recipient, and writes `epochs: [epoch]` / `currentEpoch` back with a
44
- * compare-and-swap. After this, resources written by any recipient are encrypted
45
- * under the epoch, and readers unwrap it with their own key-agreement key.
48
+ * Initializes the first key epoch on a marker that has no epochs yet: mints a
49
+ * fresh epoch key, wraps it to each initial recipient, and writes
50
+ * `epochs: [epoch]` / `currentEpoch` back with a compare-and-swap. After this,
51
+ * resources written by any recipient are encrypted under the epoch, and readers
52
+ * unwrap it with their own key-agreement key.
53
+ *
54
+ * On the `collection` host the collection must already be declared encrypted
55
+ * (its marker exists; this fills in the first epochs). On a store whose marker
56
+ * host starts absent (e.g. `resourceMarkerStore`, whose roster resource does
57
+ * not exist before the first init), the marker itself is created from scratch
58
+ * with a create-if-absent guard (`If-None-Match: *`), so two racing first
59
+ * inits cannot clobber one another.
46
60
  *
47
61
  * @param options {object}
48
- * @param options.collection {Collection} the (already encrypted) collection
62
+ * @param [options.collection] {Collection} the (already encrypted) collection
63
+ * whose Description hosts the marker; exactly one of `collection` / `store`
64
+ * @param [options.store] {MarkerStore} an explicit marker store
49
65
  * @param options.recipients {RecipientPublicKey[]} the initial readers' public
50
66
  * key-agreement keys (each `id` is the reader's `kid`)
51
67
  * @returns {Promise<CollectionEncryption>} the new marker
52
68
  */
53
- export declare function initRecipients({ collection, recipients }: {
54
- collection: Collection;
69
+ export declare function initRecipients({ collection, store, recipients }: {
70
+ collection?: Collection;
71
+ store?: MarkerStore;
55
72
  recipients: RecipientPublicKey[];
56
73
  }): Promise<CollectionEncryption>;
57
74
  /**
@@ -65,14 +82,17 @@ export declare function initRecipients({ collection, recipients }: {
65
82
  * a compare-and-swap, retried on a concurrent change.
66
83
  *
67
84
  * @param options {object}
68
- * @param options.collection {Collection} the collection
85
+ * @param [options.collection] {Collection} the collection whose Description
86
+ * hosts the marker; exactly one of `collection` / `store`
87
+ * @param [options.store] {MarkerStore} an explicit marker store
69
88
  * @param options.recipient {RecipientPublicKey} the new reader's public KAK
70
89
  * @param options.owner {OwnerKey} the caller's own key-agreement key, to
71
90
  * unwrap each epoch key for re-wrapping to the new reader
72
91
  * @returns {Promise<CollectionEncryption>} the new marker
73
92
  */
74
- export declare function addRecipient({ collection, recipient, owner }: {
75
- collection: Collection;
93
+ export declare function addRecipient({ collection, store, recipient, owner }: {
94
+ collection?: Collection;
95
+ store?: MarkerStore;
76
96
  recipient: RecipientPublicKey;
77
97
  owner: OwnerKey;
78
98
  }): Promise<CollectionEncryption>;
@@ -85,17 +105,21 @@ export declare function addRecipient({ collection, recipient, owner }: {
85
105
  * as a new epoch, and repoint `currentEpoch`, with a compare-and-swap.
86
106
  * Resources written afterward are unreadable to the removed reader (the read
87
107
  * axis; prospective).
88
- * 2. **Revoke the reader's zcap(s)** via `space.revoke()`, so the server stops
89
- * serving it ciphertext (the pull axis; immediate).
108
+ * 2. **Pull the reader's server-side access** (the pull axis; immediate). By
109
+ * default that revokes the reader's zcap(s) via `space.revoke()`, so the
110
+ * server stops serving it ciphertext; a caller whose pull axis lives
111
+ * elsewhere (e.g. a DID document naming the readers) supplies its own
112
+ * `pull` action instead.
90
113
  *
91
- * The rotation runs first so it is durable before the irreversible revocation:
92
- * a rotation that keeps losing the compare-and-swap throws with nothing revoked,
93
- * leaving the operation safely retryable rather than half-applied. The revoke
94
- * step tolerates an already-revoked capability (a retry re-revokes) so the
95
- * operation converges. The rotation itself is likewise idempotent with respect
114
+ * The rotation runs first so it is durable before the irreversible pull:
115
+ * a rotation that keeps losing the compare-and-swap throws with nothing pulled,
116
+ * leaving the operation safely retryable rather than half-applied. The default
117
+ * revoke step tolerates an already-revoked capability (a retry re-revokes) so
118
+ * the operation converges; a custom `pull` should likewise tolerate a retry.
119
+ * The rotation itself is likewise idempotent with respect
96
120
  * to retries: when the current epoch already excludes the departing reader
97
- * (a prior attempt's rotation landed but its revoke failed transiently), no
98
- * fresh epoch is minted or appended -- the retry skips straight to the revoke
121
+ * (a prior attempt's rotation landed but its pull failed transiently), no
122
+ * fresh epoch is minted or appended -- the retry skips straight to the pull
99
123
  * step instead of accumulating a redundant epoch per attempt.
100
124
  *
101
125
  * Important: this does not re-encrypt existing resources, so the removed
@@ -103,24 +127,37 @@ export declare function addRecipient({ collection, recipient, owner }: {
103
127
  * resource whose ciphertext it gets. Neither half alone removes a reader.
104
128
  *
105
129
  * @param options {object}
106
- * @param options.collection {Collection} the collection
107
- * @param options.space {Space} the collection's Space, for the zcap revocation
130
+ * @param [options.collection] {Collection} the collection whose Description
131
+ * hosts the marker; exactly one of `collection` / `store`
132
+ * @param [options.store] {MarkerStore} an explicit marker store
133
+ * @param [options.space] {Space} the collection's Space, for the default
134
+ * pull axis (zcap revocation); required together with `revoke` unless a
135
+ * custom `pull` is supplied
108
136
  * @param options.recipientId {string} the removed reader's key-agreement key
109
137
  * id (`kid`), dropped from the new epoch's recipients
110
- * @param options.revoke {IDelegatedZcap | IDelegatedZcap[]} the reader's
111
- * delegated capability/capabilities to revoke (the pull axis)
138
+ * @param [options.revoke] {IDelegatedZcap | IDelegatedZcap[]} the reader's
139
+ * delegated capability/capabilities to revoke (the default pull axis);
140
+ * required together with `space` unless a custom `pull` is supplied
141
+ * @param [options.pull] {function} a caller-supplied pull action replacing
142
+ * the default zcap revocation. Runs only after the rotation is durable, and
143
+ * should tolerate being re-run (removeRecipient is retried to convergence).
144
+ * Mutually exclusive with `space` / `revoke`.
112
145
  * @param [options.resolveRecipientKey] {function} resolves a remaining
113
146
  * recipient's `kid` to its public key-agreement key, so the fresh epoch key
114
147
  * can be wrapped to it. Defaults to a `did:key` resolver (the `kid` fragment
115
148
  * is the X25519 public key); override for recipients whose `kid` is not a
116
- * self-describing `did:key`.
149
+ * self-describing `did:key`. May resolve `null` to signal drop-this-kid:
150
+ * the rotation then excludes that entry from the fresh epoch instead of
151
+ * throwing (subject to the no-recipients-remaining guard).
117
152
  * @returns {Promise<CollectionEncryption>} the new marker
118
153
  */
119
- export declare function removeRecipient({ collection, space, recipientId, revoke, resolveRecipientKey }: {
120
- collection: Collection;
121
- space: Space;
154
+ export declare function removeRecipient({ collection, store, space, recipientId, revoke, pull, resolveRecipientKey }: {
155
+ collection?: Collection;
156
+ store?: MarkerStore;
157
+ space?: Space;
122
158
  recipientId: string;
123
- revoke: IDelegatedZcap | IDelegatedZcap[];
124
- resolveRecipientKey?: (kid: string) => Promise<RecipientPublicKey>;
159
+ revoke?: IDelegatedZcap | IDelegatedZcap[];
160
+ pull?: () => Promise<void>;
161
+ resolveRecipientKey?: (kid: string) => Promise<RecipientPublicKey | null>;
125
162
  }): Promise<CollectionEncryption>;
126
163
  //# sourceMappingURL=recipients.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"recipients.d.ts","sourceRoot":"","sources":["../../src/edv/recipients.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAGxC,OAAO,KAAK,EACV,oBAAoB,EAEpB,cAAc,EACf,MAAM,aAAa,CAAA;AAQpB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAE1D,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAE1D;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,eAAe,EAAE,gBAAgB,CAAA;CAClC;AAQD;;;;;;;;;;;;GAYG;AACH,wBAAsB,cAAc,CAAC,EACnC,UAAU,EACV,UAAU,EACX,EAAE;IACD,UAAU,EAAE,UAAU,CAAA;IACtB,UAAU,EAAE,kBAAkB,EAAE,CAAA;CACjC,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAyChC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,YAAY,CAAC,EACjC,UAAU,EACV,SAAS,EACT,KAAK,EACN,EAAE;IACD,UAAU,EAAE,UAAU,CAAA;IACtB,SAAS,EAAE,kBAAkB,CAAA;IAC7B,KAAK,EAAE,QAAQ,CAAA;CAChB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAuDhC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,OAAO,CAAC,oBAAoB,CAAC,CA6ChC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,YAAY,CAAC,EACjC,UAAU,EACV,KAAK,EACL,SAAS,EACT,KAAK,EACN,EAAE;IACD,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,KAAK,CAAC,EAAE,WAAW,CAAA;IACnB,SAAS,EAAE,kBAAkB,CAAA;IAC7B,KAAK,EAAE,QAAQ,CAAA;CAChB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAuDhC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,wBAAsB,eAAe,CAAC,EACpC,UAAU,EACV,KAAK,EACL,KAAK,EACL,WAAW,EACX,MAAM,EACN,IAAI,EACJ,mBAAgD,EACjD,EAAE;IACD,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,KAAK,CAAC,EAAE,WAAW,CAAA;IACnB,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,cAAc,GAAG,cAAc,EAAE,CAAA;IAC1C,IAAI,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,mBAAmB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAA;CAC1E,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAgGhC"}
@@ -1,5 +1,5 @@
1
- import { unreadableDescriptionError } from '../internal/describe.js';
2
1
  import { PreconditionFailedError, ValidationError } from '../errors.js';
2
+ import { collectionMarkerStore } from './markerStore.js';
3
3
  import { didKeyResolver, mintEpoch, unwrapEpochSecret, wrapEpochSecret } from './epochCrypto.js';
4
4
  import { computeEpochsMac } from './epochMac.js';
5
5
  /**
@@ -8,19 +8,28 @@ import { computeEpochsMac } from './epochMac.js';
8
8
  */
9
9
  const MAX_CAS_ATTEMPTS = 3;
10
10
  /**
11
- * Initializes the first key epoch on a Collection that is declared encrypted
12
- * but has no epochs yet: mints a fresh epoch key, wraps it to each initial
13
- * recipient, and writes `epochs: [epoch]` / `currentEpoch` back with a
14
- * compare-and-swap. After this, resources written by any recipient are encrypted
15
- * under the epoch, and readers unwrap it with their own key-agreement key.
11
+ * Initializes the first key epoch on a marker that has no epochs yet: mints a
12
+ * fresh epoch key, wraps it to each initial recipient, and writes
13
+ * `epochs: [epoch]` / `currentEpoch` back with a compare-and-swap. After this,
14
+ * resources written by any recipient are encrypted under the epoch, and readers
15
+ * unwrap it with their own key-agreement key.
16
+ *
17
+ * On the `collection` host the collection must already be declared encrypted
18
+ * (its marker exists; this fills in the first epochs). On a store whose marker
19
+ * host starts absent (e.g. `resourceMarkerStore`, whose roster resource does
20
+ * not exist before the first init), the marker itself is created from scratch
21
+ * with a create-if-absent guard (`If-None-Match: *`), so two racing first
22
+ * inits cannot clobber one another.
16
23
  *
17
24
  * @param options {object}
18
- * @param options.collection {Collection} the (already encrypted) collection
25
+ * @param [options.collection] {Collection} the (already encrypted) collection
26
+ * whose Description hosts the marker; exactly one of `collection` / `store`
27
+ * @param [options.store] {MarkerStore} an explicit marker store
19
28
  * @param options.recipients {RecipientPublicKey[]} the initial readers' public
20
29
  * key-agreement keys (each `id` is the reader's `kid`)
21
30
  * @returns {Promise<CollectionEncryption>} the new marker
22
31
  */
23
- export async function initRecipients({ collection, recipients }) {
32
+ export async function initRecipients({ collection, store, recipients }) {
24
33
  if (recipients.length === 0) {
25
34
  throw new ValidationError('initRecipients needs at least one recipient to wrap the epoch key to.');
26
35
  }
@@ -30,7 +39,11 @@ export async function initRecipients({ collection, recipients }) {
30
39
  recipients: await Promise.all(recipients.map(recipient => wrapEpochSecret({ epochSecret: secret, recipient })))
31
40
  };
32
41
  return casUpdateMarker({
33
- collection,
42
+ store: markerStoreFor({ collection, store }),
43
+ // A store whose marker starts absent initializes from a bare `edv` marker
44
+ // (the create-if-absent branch); a Collection Description's marker always
45
+ // exists, so its adapter never reaches the seed.
46
+ seed: { scheme: 'edv' },
34
47
  mutate: async (marker) => {
35
48
  if (marker.epochs && marker.epochs.length > 0) {
36
49
  throw new ValidationError('This collection already has key epochs; use addRecipient to add a ' +
@@ -65,15 +78,17 @@ export async function initRecipients({ collection, recipients }) {
65
78
  * a compare-and-swap, retried on a concurrent change.
66
79
  *
67
80
  * @param options {object}
68
- * @param options.collection {Collection} the collection
81
+ * @param [options.collection] {Collection} the collection whose Description
82
+ * hosts the marker; exactly one of `collection` / `store`
83
+ * @param [options.store] {MarkerStore} an explicit marker store
69
84
  * @param options.recipient {RecipientPublicKey} the new reader's public KAK
70
85
  * @param options.owner {OwnerKey} the caller's own key-agreement key, to
71
86
  * unwrap each epoch key for re-wrapping to the new reader
72
87
  * @returns {Promise<CollectionEncryption>} the new marker
73
88
  */
74
- export async function addRecipient({ collection, recipient, owner }) {
89
+ export async function addRecipient({ collection, store, recipient, owner }) {
75
90
  return casUpdateMarker({
76
- collection,
91
+ store: markerStoreFor({ collection, store }),
77
92
  mutate: async (marker) => {
78
93
  const epochs = marker.epochs;
79
94
  if (!epochs || epochs.length === 0) {
@@ -124,17 +139,21 @@ export async function addRecipient({ collection, recipient, owner }) {
124
139
  * as a new epoch, and repoint `currentEpoch`, with a compare-and-swap.
125
140
  * Resources written afterward are unreadable to the removed reader (the read
126
141
  * axis; prospective).
127
- * 2. **Revoke the reader's zcap(s)** via `space.revoke()`, so the server stops
128
- * serving it ciphertext (the pull axis; immediate).
142
+ * 2. **Pull the reader's server-side access** (the pull axis; immediate). By
143
+ * default that revokes the reader's zcap(s) via `space.revoke()`, so the
144
+ * server stops serving it ciphertext; a caller whose pull axis lives
145
+ * elsewhere (e.g. a DID document naming the readers) supplies its own
146
+ * `pull` action instead.
129
147
  *
130
- * The rotation runs first so it is durable before the irreversible revocation:
131
- * a rotation that keeps losing the compare-and-swap throws with nothing revoked,
132
- * leaving the operation safely retryable rather than half-applied. The revoke
133
- * step tolerates an already-revoked capability (a retry re-revokes) so the
134
- * operation converges. The rotation itself is likewise idempotent with respect
148
+ * The rotation runs first so it is durable before the irreversible pull:
149
+ * a rotation that keeps losing the compare-and-swap throws with nothing pulled,
150
+ * leaving the operation safely retryable rather than half-applied. The default
151
+ * revoke step tolerates an already-revoked capability (a retry re-revokes) so
152
+ * the operation converges; a custom `pull` should likewise tolerate a retry.
153
+ * The rotation itself is likewise idempotent with respect
135
154
  * to retries: when the current epoch already excludes the departing reader
136
- * (a prior attempt's rotation landed but its revoke failed transiently), no
137
- * fresh epoch is minted or appended -- the retry skips straight to the revoke
155
+ * (a prior attempt's rotation landed but its pull failed transiently), no
156
+ * fresh epoch is minted or appended -- the retry skips straight to the pull
138
157
  * step instead of accumulating a redundant epoch per attempt.
139
158
  *
140
159
  * Important: this does not re-encrypt existing resources, so the removed
@@ -142,28 +161,43 @@ export async function addRecipient({ collection, recipient, owner }) {
142
161
  * resource whose ciphertext it gets. Neither half alone removes a reader.
143
162
  *
144
163
  * @param options {object}
145
- * @param options.collection {Collection} the collection
146
- * @param options.space {Space} the collection's Space, for the zcap revocation
164
+ * @param [options.collection] {Collection} the collection whose Description
165
+ * hosts the marker; exactly one of `collection` / `store`
166
+ * @param [options.store] {MarkerStore} an explicit marker store
167
+ * @param [options.space] {Space} the collection's Space, for the default
168
+ * pull axis (zcap revocation); required together with `revoke` unless a
169
+ * custom `pull` is supplied
147
170
  * @param options.recipientId {string} the removed reader's key-agreement key
148
171
  * id (`kid`), dropped from the new epoch's recipients
149
- * @param options.revoke {IDelegatedZcap | IDelegatedZcap[]} the reader's
150
- * delegated capability/capabilities to revoke (the pull axis)
172
+ * @param [options.revoke] {IDelegatedZcap | IDelegatedZcap[]} the reader's
173
+ * delegated capability/capabilities to revoke (the default pull axis);
174
+ * required together with `space` unless a custom `pull` is supplied
175
+ * @param [options.pull] {function} a caller-supplied pull action replacing
176
+ * the default zcap revocation. Runs only after the rotation is durable, and
177
+ * should tolerate being re-run (removeRecipient is retried to convergence).
178
+ * Mutually exclusive with `space` / `revoke`.
151
179
  * @param [options.resolveRecipientKey] {function} resolves a remaining
152
180
  * recipient's `kid` to its public key-agreement key, so the fresh epoch key
153
181
  * can be wrapped to it. Defaults to a `did:key` resolver (the `kid` fragment
154
182
  * is the X25519 public key); override for recipients whose `kid` is not a
155
- * self-describing `did:key`.
183
+ * self-describing `did:key`. May resolve `null` to signal drop-this-kid:
184
+ * the rotation then excludes that entry from the fresh epoch instead of
185
+ * throwing (subject to the no-recipients-remaining guard).
156
186
  * @returns {Promise<CollectionEncryption>} the new marker
157
187
  */
158
- export async function removeRecipient({ collection, space, recipientId, revoke, resolveRecipientKey = defaultResolveRecipientKey }) {
188
+ export async function removeRecipient({ collection, store, space, recipientId, revoke, pull, resolveRecipientKey = defaultResolveRecipientKey }) {
189
+ const markerStore = markerStoreFor({ collection, store });
190
+ // Resolve the pull axis up front, before any rotation, so a malformed call
191
+ // fails before the marker is mutated.
192
+ const pullAxis = resolvePullAxis({ space, revoke, pull });
159
193
  // 1. Read axis: mint a fresh epoch, wrap it to every remaining recipient,
160
194
  // append it, and repoint `currentEpoch` (compare-and-swap, retried on race).
161
- // Rotate FIRST so the rotation is durable before any irreversible revocation:
162
- // if the CAS keeps losing the race and throws, the reader is neither revoked
195
+ // Rotate FIRST so the rotation is durable before any irreversible pull:
196
+ // if the CAS keeps losing the race and throws, the reader is neither pulled
163
197
  // nor rotated, so `removeRecipient` is safely retryable to convergence.
164
198
  const { epochId, secret } = await mintEpoch();
165
199
  const rotatedMarker = await casUpdateMarker({
166
- collection,
200
+ store: markerStore,
167
201
  mutate: async (marker) => {
168
202
  const epochs = marker.epochs;
169
203
  if (!epochs || epochs.length === 0) {
@@ -195,10 +229,22 @@ export async function removeRecipient({ collection, space, recipientId, revoke,
195
229
  throw new ValidationError('Cannot removeRecipient: no recipients would remain after the ' +
196
230
  'removal (a collection with no readers cannot be rotated to).');
197
231
  }
198
- const newRecipients = await Promise.all([...remaining].map(async (kid) => wrapEpochSecret({
199
- epochSecret: secret,
200
- recipient: await resolveRecipientKey(kid)
201
- })));
232
+ // Wrap the fresh epoch key to each remaining recipient. The resolver may
233
+ // signal drop-this-kid by resolving `null` (e.g. a roster entry whose
234
+ // key material is no longer resolvable), so the rotation excludes that
235
+ // entry instead of throwing.
236
+ const wrapped = await Promise.all([...remaining].map(async (kid) => {
237
+ const recipient = await resolveRecipientKey(kid);
238
+ return recipient === null
239
+ ? null
240
+ : wrapEpochSecret({ epochSecret: secret, recipient });
241
+ }));
242
+ const newRecipients = wrapped.filter(entry => entry !== null);
243
+ if (newRecipients.length === 0) {
244
+ throw new ValidationError('Cannot removeRecipient: no recipients would remain after the ' +
245
+ 'removal (resolveRecipientKey dropped every remaining entry, ' +
246
+ 'and a collection with no readers cannot be rotated to).');
247
+ }
202
248
  const newEpoch = {
203
249
  id: epochId,
204
250
  recipients: newRecipients
@@ -218,26 +264,55 @@ export async function removeRecipient({ collection, space, recipientId, revoke,
218
264
  return { ...next, epochsMac };
219
265
  }
220
266
  });
221
- // 2. Pull axis: revoke the reader's capability/capabilities AFTER the rotation
222
- // is durable. Tolerate an already-revoked capability so a retry (after a
223
- // transient revoke failure) converges rather than throwing in the loop:
224
- // `space.revoke` is not idempotent and reports an already-revoked capability
225
- // as ValidationError. That same status also covers tampered/expired/foreign
226
- // capabilities, which the client cannot distinguish here, so this swallows
227
- // only ValidationError and re-throws anything else.
228
- const toRevoke = Array.isArray(revoke) ? revoke : [revoke];
229
- for (const zcap of toRevoke) {
230
- try {
231
- await space.revoke(zcap);
267
+ // 2. Pull axis: withdraw the reader's server-side access AFTER the rotation
268
+ // is durable -- the default zcap revocation, or the caller-supplied `pull`.
269
+ await pullAxis();
270
+ return rotatedMarker;
271
+ }
272
+ /**
273
+ * Resolves the pull axis of {@link removeRecipient} -- exactly one of the
274
+ * default zcap revocation (`space` + `revoke`) or a caller-supplied `pull`
275
+ * action -- into the single action run after the rotation is durable.
276
+ *
277
+ * @param options {object}
278
+ * @param [options.space] {Space}
279
+ * @param [options.revoke] {IDelegatedZcap | IDelegatedZcap[]}
280
+ * @param [options.pull] {function}
281
+ * @returns {function} the pull action
282
+ */
283
+ function resolvePullAxis({ space, revoke, pull }) {
284
+ if (pull !== undefined) {
285
+ if (space !== undefined || revoke !== undefined) {
286
+ throw new ValidationError('removeRecipient takes either the default pull axis (`space` + ' +
287
+ '`revoke`, the zcap revocation) or a custom `pull` action, not both.');
232
288
  }
233
- catch (err) {
234
- if (err instanceof ValidationError) {
235
- continue;
289
+ return pull;
290
+ }
291
+ if (space === undefined || revoke === undefined) {
292
+ throw new ValidationError('removeRecipient needs its pull axis: pass `space` and `revoke` (the ' +
293
+ 'default zcap revocation), or a custom `pull` action.');
294
+ }
295
+ // The default pull: revoke the reader's capability/capabilities. Tolerate an
296
+ // already-revoked capability so a retry (after a transient revoke failure)
297
+ // converges rather than throwing in the loop: `space.revoke` is not
298
+ // idempotent and reports an already-revoked capability as ValidationError.
299
+ // That same status also covers tampered/expired/foreign capabilities, which
300
+ // the client cannot distinguish here, so this swallows only ValidationError
301
+ // and re-throws anything else.
302
+ const toRevoke = Array.isArray(revoke) ? revoke : [revoke];
303
+ return async function revokeZcaps() {
304
+ for (const zcap of toRevoke) {
305
+ try {
306
+ await space.revoke(zcap);
307
+ }
308
+ catch (err) {
309
+ if (err instanceof ValidationError) {
310
+ continue;
311
+ }
312
+ throw err;
236
313
  }
237
- throw err;
238
314
  }
239
- }
240
- return rotatedMarker;
315
+ };
241
316
  }
242
317
  /**
243
318
  * The default recipient-key resolver: treats a `kid` as a self-describing
@@ -252,46 +327,91 @@ async function defaultResolveRecipientKey(kid) {
252
327
  return { id: resolved.id, publicKeyMultibase: resolved.publicKeyMultibase };
253
328
  }
254
329
  /**
255
- * Reads the Collection Description, applies `mutate` to its `encryption` marker,
256
- * and writes it back with a compare-and-swap (`If-Match`). Retries on a stale
257
- * (`412`) validator, re-reading the fresh marker each time, up to
258
- * {@link MAX_CAS_ATTEMPTS}; surfaces {@link PreconditionFailedError} if it keeps
259
- * losing the race. A `mutate` that resolves `null` signals "no change needed"
260
- * (the marker already reflects the desired state, e.g. an idempotent retry):
261
- * nothing is written and the current marker is returned as-is.
330
+ * Resolves the marker store a recipient operation targets: the explicit
331
+ * `store`, or the Collection Description adapter over the `collection` sugar.
332
+ * Exactly one of the two must be supplied.
333
+ *
334
+ * @param options {object}
335
+ * @param [options.collection] {Collection}
336
+ * @param [options.store] {MarkerStore}
337
+ * @returns {MarkerStore}
338
+ */
339
+ function markerStoreFor({ collection, store }) {
340
+ if (collection !== undefined && store !== undefined) {
341
+ throw new ValidationError('Pass either `collection` (the Collection Description hosts the ' +
342
+ 'marker) or `store` (an explicit marker store), not both.');
343
+ }
344
+ if (store !== undefined) {
345
+ return store;
346
+ }
347
+ if (collection !== undefined) {
348
+ return collectionMarkerStore({ collection });
349
+ }
350
+ throw new ValidationError('A recipient operation needs its marker host: pass `collection` or ' +
351
+ '`store`.');
352
+ }
353
+ /**
354
+ * Reads the store's marker, applies `mutate`, and writes the result back with
355
+ * a compare-and-swap (`If-Match`). Retries on a stale (`412`) validator,
356
+ * re-reading the fresh marker each time, up to {@link MAX_CAS_ATTEMPTS};
357
+ * surfaces {@link PreconditionFailedError} if it keeps losing the race. A
358
+ * `mutate` that resolves `null` signals "no change needed" (the marker already
359
+ * reflects the desired state, e.g. an idempotent retry): nothing is written
360
+ * and the current marker is returned as-is.
361
+ *
362
+ * When the store reports no marker yet (`read()` resolves `null`, e.g. the
363
+ * resource adapter before the first `initRecipients`), the optional `seed` is
364
+ * mutated instead and the result written with the store's create-if-absent
365
+ * guard (`If-None-Match: *`). Only `initRecipients` passes a seed; without
366
+ * one an absent marker is refused. Losing the create race (a concurrent
367
+ * writer created the first marker) re-enters the loop and re-reads, like a
368
+ * stale CAS.
262
369
  *
263
370
  * @param options {object}
264
- * @param options.collection {Collection}
371
+ * @param options.store {MarkerStore}
265
372
  * @param options.mutate {function} marker to the next marker (may be async),
266
373
  * or `null` to skip the write
374
+ * @param [options.seed] {CollectionEncryption} the marker to mutate when the
375
+ * store holds none yet
267
376
  * @returns {Promise<CollectionEncryption>} the written (or current) marker
268
377
  */
269
- async function casUpdateMarker({ collection, mutate }) {
378
+ async function casUpdateMarker({ store, mutate, seed }) {
270
379
  let lastError;
271
380
  for (let attempt = 0; attempt < MAX_CAS_ATTEMPTS; attempt++) {
272
- const current = await collection.describeWithEtag();
381
+ const current = await store.read();
273
382
  if (current === null) {
274
- throw unreadableDescriptionError({
275
- operation: 'manage recipients',
276
- advice: 'Use a capability that can read the Collection Description.'
277
- });
278
- }
279
- const marker = current.description.encryption;
280
- if (!marker || marker.scheme !== 'edv') {
281
- throw new ValidationError('Cannot manage recipients: this collection is not declared encrypted ' +
282
- "with the 'edv' scheme.");
383
+ if (seed === undefined) {
384
+ throw new ValidationError('Cannot manage recipients: this marker store holds no encryption ' +
385
+ 'marker yet. Call initRecipients first.');
386
+ }
387
+ if (store.create === undefined) {
388
+ throw new ValidationError('Cannot initialize recipients: this marker store holds no marker ' +
389
+ 'and does not support creating one.');
390
+ }
391
+ const created = await mutate(seed);
392
+ if (created === null) {
393
+ return seed;
394
+ }
395
+ try {
396
+ await store.create(created);
397
+ return created;
398
+ }
399
+ catch (err) {
400
+ if (err instanceof PreconditionFailedError) {
401
+ // A concurrent writer created the first marker: re-read and re-apply.
402
+ lastError = err;
403
+ continue;
404
+ }
405
+ throw err;
406
+ }
283
407
  }
284
- const next = await mutate(marker);
408
+ const next = await mutate(current.marker);
285
409
  if (next === null) {
286
410
  // The marker already reflects the desired state: nothing to write.
287
- return marker;
411
+ return current.marker;
288
412
  }
289
413
  try {
290
- await collection.replaceDescription({
291
- name: current.description.name,
292
- backend: current.description.backend,
293
- encryption: next
294
- }, { ifMatch: current.etag });
414
+ await store.replace(next, { ifMatch: current.etag });
295
415
  return next;
296
416
  }
297
417
  catch (err) {
@@ -304,7 +424,7 @@ async function casUpdateMarker({ collection, mutate }) {
304
424
  }
305
425
  }
306
426
  throw new PreconditionFailedError(`Recipient change lost the compare-and-swap race after ${MAX_CAS_ATTEMPTS} ` +
307
- 'attempts (another writer kept updating the Collection Description). ' +
427
+ 'attempts (another writer kept updating the stored marker). ' +
308
428
  'Retry the operation.', { cause: lastError });
309
429
  }
310
430
  //# sourceMappingURL=recipients.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"recipients.js","sourceRoot":"","sources":["../../src/edv/recipients.ts"],"names":[],"mappings":"AA6BA,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAA;AACpE,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAMvE,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;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EACnC,UAAU,EACV,UAAU,EAIX;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,MAAM,SAAS,EAAE,CAAA;IAC7C,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,EAAE,SAAS,EAAE,CAAC,CACpD,CACF;KACF,CAAA;IACD,OAAO,eAAe,CAAC;QACrB,UAAU;QACV,MAAM,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE;YACrB,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,C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AM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QACzC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAClB,mEAAmE;YACnE,OAAO,OAAO,CAAC,MAAM,CAAA;QACvB,CAAC;QACD,IAAI,CAAC;YACH,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;YACpD,OAAO,IAAI,CAAA;QACb,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,GAAG,YAAY,uBAAuB,EAAE,CAAC;gBAC3C,oEAAoE;gBACpE,SAAS,GAAG,GAAG,CAAA;gBACf,SAAQ;YACV,CAAC;YACD,MAAM,GAAG,CAAA;QACX,CAAC;IACH,CAAC;IACD,MAAM,IAAI,uBAAuB,CAC/B,yDAAyD,gBAAgB,GAAG;QAC1E,6DAA6D;QAC7D,sBAAsB,EACxB,EAAE,KAAK,EAAE,SAAkB,EAAE,CAC9B,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@interop/was-client",
3
3
  "description": "A developer-friendly client for Wallet Attached Storage (WAS) servers.",
4
- "version": "0.20.0",
4
+ "version": "0.21.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "pnpm run clear && tsc",