@interop/wallet-core 0.109.0 → 0.111.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.
Files changed (44) hide show
  1. package/dist/clientAnnex/gc.d.ts +31 -2
  2. package/dist/clientAnnex/gc.d.ts.map +1 -1
  3. package/dist/clientAnnex/gc.js +44 -7
  4. package/dist/clientAnnex/gc.js.map +1 -1
  5. package/dist/clientAnnex/heal.d.ts.map +1 -1
  6. package/dist/clientAnnex/heal.js +13 -3
  7. package/dist/clientAnnex/heal.js.map +1 -1
  8. package/dist/clientAnnex/index.d.ts +2 -2
  9. package/dist/clientAnnex/index.d.ts.map +1 -1
  10. package/dist/clientAnnex/index.js +1 -1
  11. package/dist/clientAnnex/index.js.map +1 -1
  12. package/dist/clientAnnex/log.d.ts +160 -4
  13. package/dist/clientAnnex/log.d.ts.map +1 -1
  14. package/dist/clientAnnex/log.js +229 -17
  15. package/dist/clientAnnex/log.js.map +1 -1
  16. package/dist/connections/grants.d.ts +48 -3
  17. package/dist/connections/grants.d.ts.map +1 -1
  18. package/dist/connections/grants.js +54 -3
  19. package/dist/connections/grants.js.map +1 -1
  20. package/dist/connections/index.d.ts +7 -4
  21. package/dist/connections/index.d.ts.map +1 -1
  22. package/dist/connections/index.js +7 -4
  23. package/dist/connections/index.js.map +1 -1
  24. package/dist/connections/replicas.d.ts +43 -1
  25. package/dist/connections/replicas.d.ts.map +1 -1
  26. package/dist/connections/replicas.js +87 -14
  27. package/dist/connections/replicas.js.map +1 -1
  28. package/dist/connections/upsert.d.ts +52 -19
  29. package/dist/connections/upsert.d.ts.map +1 -1
  30. package/dist/connections/upsert.js +93 -41
  31. package/dist/connections/upsert.js.map +1 -1
  32. package/dist/descriptors/index.d.ts +3 -4
  33. package/dist/descriptors/index.d.ts.map +1 -1
  34. package/dist/descriptors/index.js +3 -4
  35. package/dist/descriptors/index.js.map +1 -1
  36. package/dist/descriptors/logSource.d.ts +32 -16
  37. package/dist/descriptors/logSource.d.ts.map +1 -1
  38. package/dist/descriptors/logSource.js +36 -16
  39. package/dist/descriptors/logSource.js.map +1 -1
  40. package/dist/keys/collectionLogStore.d.ts +2 -2
  41. package/dist/keys/collectionLogStore.d.ts.map +1 -1
  42. package/dist/keys/collectionLogStore.js +2 -3
  43. package/dist/keys/collectionLogStore.js.map +1 -1
  44. package/package.json +2 -2
@@ -8,7 +8,9 @@
8
8
  * (a pull grant, with a first registration's pending id in the same write),
9
9
  * `settleReplicaRegistration` (the landed id), `setReplicaMarker` and
10
10
  * `clearReplicaMarker` over `stoppedAt`, `restartedAt`, and `lostAt`, and
11
- * `removeReplica`.
11
+ * `removeReplica`. Beside them, `restatedReplicaServerDids` is the restate
12
+ * predicate a fresh client-annex generation's replica pointers are read
13
+ * under.
12
14
  *
13
15
  * Each runs `writeConnection` (`upsert.ts`), the one bounded compare-and-swap
14
16
  * loop at the party's resource id, and refuses an entry of another kind with
@@ -20,8 +22,9 @@
20
22
  */
21
23
  import { normalizeDisplayName } from '../labelText.js';
22
24
  import { REPLICA_SERVER_KIND, isConnectionFreshId, newConnectionEntry, spaceContainerUrl } from './entry.js';
23
- import { isTargetInSpace, normalizedActions } from './grants.js';
24
- import { assertKind, checkedDelegatedZcap, renewedGrantRecord, writePartyConnection } from './upsert.js';
25
+ import { verifyRecordedGrantProof } from './grantProof.js';
26
+ import { isTargetInSpace } from './grants.js';
27
+ import { assertKind, assertPullGrantActions, assertTargetInSpaces, checkedDelegatedZcap, renewedGrantRecord, writePartyConnection } from './upsert.js';
25
28
  /**
26
29
  * The intent markers a replica item carries.
27
30
  */
@@ -221,7 +224,8 @@ export async function recordReplicas({ store, hmacKey, did, url, replicas, name,
221
224
  *
222
225
  * Refuses an entry of another kind with {@link ConnectionKindMismatchError},
223
226
  * a retired entry with an `Error`, and a capability not delegated to the
224
- * server's DID or not targeting `fromSpace` (`checkedDelegatedZcap`), one
227
+ * server's DID (`checkedDelegatedZcap`) or not targeting `fromSpace`
228
+ * (`assertTargetInSpaces`), one
225
229
  * allowing any action but `GET` (a pull grant reads and nothing else), or a
226
230
  * `pendingRegistrationId` that is not a fresh id, with a `TypeError`. An entry listing no item for
227
231
  * `fromSpace` is refused with an `Error`. An absent entry writes nothing.
@@ -246,16 +250,9 @@ export async function recordReplicaGrant({ store, hmacKey, did, fromSpace: space
246
250
  throw new TypeError('A first registration has no recorded grant to renew; pass a pending ' +
247
251
  'registration id or a renewed grant, not both.');
248
252
  }
249
- const zcap = checkedDelegatedZcap({
250
- did,
251
- spaceUrl: fromSpace,
252
- zcap: zcapValue
253
- });
254
- const actions = normalizedActions({ allowedAction: zcap.allowedAction });
255
- if (actions.length !== 1 || actions[0] !== 'GET') {
256
- throw new TypeError(`A pull grant allows GET and nothing else; its allowed actions are ` +
257
- `${JSON.stringify(actions)}.`);
258
- }
253
+ const zcap = checkedDelegatedZcap({ did, zcap: zcapValue });
254
+ assertTargetInSpaces({ zcap, spaceUrls: [fromSpace] });
255
+ assertPullGrantActions({ zcap });
259
256
  if (pendingRegistrationId !== undefined) {
260
257
  assertFreshId({ value: pendingRegistrationId, what: 'registration id' });
261
258
  }
@@ -536,4 +533,80 @@ export async function removeReplica({ store, hmacKey, did, fromSpace: value }) {
536
533
  }
537
534
  });
538
535
  }
536
+ /**
537
+ * THE RESTATE PREDICATE (app-connect-spec decision 0001): the replica
538
+ * servers whose pointer a fresh client-annex generation restates, read off
539
+ * the connections directory. A server is selected when its `replica-server`
540
+ * entry is not declined and lists at least one replica Space that is not
541
+ * stopped (`stoppedAt` unset) and has a recorded pull grant
542
+ * (`recordReplicaGrant`: controller the server's DID, target under that
543
+ * source Space) whose delegation proof verifies as this account's
544
+ * (`verifyRecordedGrantProof`). A registration torn before its pull grant
545
+ * was recorded is therefore not restated, and neither is a planted entry
546
+ * carrying no wallet-signed grant. Entries of another kind are skipped.
547
+ *
548
+ * The one selector both wallets hand to the swap and GC entry points as
549
+ * `replicaServerDids`, so the two replicas of an account restate the same
550
+ * pointer set. Order is the entries' order, each server once. What the
551
+ * proof check throws (an annex read that fails) propagates, so a caller
552
+ * whose directory cannot be verified restates nothing rather than a subset.
553
+ *
554
+ * @param options {object}
555
+ * @param options.entries {ConnectionEntry[]} the directory's entries, or
556
+ * the `replica-server` ones
557
+ * @param options.signerCheck {object} what each grant is verified against
558
+ * (`verifyRecordedGrantProof`'s `signerCheck`)
559
+ * @param options.signerCheck.doc {PublishedKeyDocument} the locally
560
+ * verified account document
561
+ * @param [options.signerCheck.clientAnnexDid] {string} the annex DID the
562
+ * document's delegated-clients pointer currently names
563
+ * @param options.signerCheck.annexDocument {AnnexDocumentResolver}
564
+ * @returns {Promise<string[]>} the selected servers' DIDs
565
+ */
566
+ export async function restatedReplicaServerDids({ entries, signerCheck }) {
567
+ const selected = new Set();
568
+ for (const entry of entries) {
569
+ if (entry.kind !== REPLICA_SERVER_KIND ||
570
+ entry.id === undefined ||
571
+ entry.declined !== undefined ||
572
+ selected.has(entry.id)) {
573
+ continue;
574
+ }
575
+ if (await hasVerifiedPullGrant({ entry, serverDid: entry.id, signerCheck })) {
576
+ selected.add(entry.id);
577
+ }
578
+ }
579
+ return [...selected];
580
+ }
581
+ /**
582
+ * Whether a `replica-server` entry records a pull grant for one of its live
583
+ * replica Spaces whose delegation proof verifies as this account's: the
584
+ * per-entry half of {@link restatedReplicaServerDids}. Verification stops at
585
+ * the first grant that verifies.
586
+ *
587
+ * @param options {object}
588
+ * @param options.entry {ConnectionEntry}
589
+ * @param options.serverDid {string} the entry's id, the server's DID
590
+ * @param options.signerCheck {object} `verifyRecordedGrantProof`'s
591
+ * `signerCheck`
592
+ * @returns {Promise<boolean>}
593
+ */
594
+ async function hasVerifiedPullGrant({ entry, serverDid, signerCheck }) {
595
+ const live = entry.replicas.filter(item => item.stoppedAt === undefined);
596
+ const pullGrants = entry.grants.filter(grant => grant.zcap.controller === serverDid &&
597
+ live.some(item => isTargetInSpace({
598
+ target: grant.zcap.invocationTarget,
599
+ spaceUrl: item.fromSpace
600
+ })));
601
+ for (const grant of pullGrants) {
602
+ const result = await verifyRecordedGrantProof({
603
+ zcap: grant.zcap,
604
+ signerCheck
605
+ });
606
+ if (result.verified) {
607
+ return true;
608
+ }
609
+ }
610
+ return false;
611
+ }
539
612
  //# sourceMappingURL=replicas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"replicas.js","sourceRoot":"","sources":["../../src/connections/replicas.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAGhE,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,aAAa,CAAA;AAGpB;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,WAAW,EAAE,aAAa,EAAE,QAAQ,CAAU,CAAA;AAO9E;;;;;;;;GAQG;AACH,SAAS,iBAAiB,CACxB,UAAwC;IAExC,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAA;IAC7D,IAAI,KAAK,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QACrB,MAAM,IAAI,SAAS,CACjB,oEAAoE;YAClE,qBAAqB,CACxB,CAAA;IACH,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,aAAa,CAAC,EAAE,KAAK,EAAE,IAAI,EAAmC;IACrE,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE,C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
113
113
  /**
114
114
  * A capability the wallet delegated, checked strictly: its known members
115
- * well-formed, its `controller` the party's DID, its `invocationTarget`
116
- * under this Space. The target check is the same one every reader applies,
117
- * so a grant that is stored is a grant the revocation index will see.
115
+ * well-formed and its `controller` the party's DID. The target check is
116
+ * {@link assertTargetInSpaces}, run where the target set is known.
118
117
  *
119
118
  * @param options {object}
120
119
  * @param options.did {string}
121
- * @param options.spaceUrl {string}
122
120
  * @param options.zcap {object}
123
121
  * @returns {ConnectionZcap}
124
122
  */
125
- export declare function checkedDelegatedZcap({ did, spaceUrl, zcap: value }: {
123
+ export declare function checkedDelegatedZcap({ did, zcap: value }: {
126
124
  did: string;
127
- spaceUrl: string;
128
125
  zcap: object;
129
126
  }): ConnectionZcap;
127
+ /**
128
+ * Refuses with a `TypeError` a capability whose `invocationTarget` is under
129
+ * none of `spaceUrls`. The check is the same one every reader applies, over
130
+ * the same set (`accountContainerUrls` for a party entry, the item's
131
+ * `fromSpace` for a pull grant), so a grant that is stored is a grant the
132
+ * revocation index will see.
133
+ *
134
+ * @param options {object}
135
+ * @param options.zcap {ConnectionZcap}
136
+ * @param options.spaceUrls {string[]} the container URLs the grant may
137
+ * target
138
+ */
139
+ export declare function assertTargetInSpaces({ zcap, spaceUrls }: {
140
+ zcap: ConnectionZcap;
141
+ spaceUrls: string[];
142
+ }): void;
143
+ /**
144
+ * Refuses with a `TypeError` a capability allowing any action but `GET`: a
145
+ * replica server's grant reads and nothing else, whichever helper records it.
146
+ *
147
+ * @param options {object}
148
+ * @param options.zcap {ConnectionZcap}
149
+ */
150
+ export declare function assertPullGrantActions({ zcap }: {
151
+ zcap: ConnectionZcap;
152
+ }): void;
130
153
  /**
131
154
  * The record a renewal appends: `zcap` renewing the recorded grant
132
155
  * `sourceZcapId`, keeping the source's `grantKind` and `grantedAt` and
@@ -183,10 +206,18 @@ export declare function renewedGrantRecord({ entry, zcap, sourceZcapId, stamp }:
183
206
  * written once. A tag that does not verify under `hmacKey` is refused with a
184
207
  * `TypeError` before anything is read.
185
208
  *
186
- * Refuses an entry of another kind with {@link ConnectionKindMismatchError},
187
- * and a grant delegated to another party or targeting another Space with a
188
- * `TypeError`, before anything is written. Without `spaceUrl` (a session with
189
- * no Space, which delegates nothing) only a zero-grant write proceeds, and a
209
+ * Refuses a grant delegated to another party, or of an unknown kind, with a
210
+ * `TypeError` before anything is read. Inside the read-modify-write, and
211
+ * before anything is written, it refuses an entry of another kind with
212
+ * {@link ConnectionKindMismatchError}, then a grant targeting none of the
213
+ * account's container URLs (`accountContainerUrls` over the stored entry, so
214
+ * a `replica-server` entry admits a grant on a recorded `fromSpace`; a
215
+ * create admits the account Space alone) with a `TypeError`. When `kind` is
216
+ * `replica-server` every grant must allow `GET` and nothing else, the rule
217
+ * `recordReplicaGrant` applies, since a replica server only ever pulls; the
218
+ * pull grant's item and registration-id rules stay with that helper, the
219
+ * designed path for recording one. Without `spaceUrl` (a session with no
220
+ * Space, which delegates nothing) only a zero-grant write proceeds, and a
190
221
  * call carrying any grant throws a `TypeError`.
191
222
  *
192
223
  * @param options {object}
@@ -194,8 +225,8 @@ export declare function renewedGrantRecord({ entry, zcap, sourceZcapId, stamp }:
194
225
  * @param options.hmacKey {ConnectionIdKey}
195
226
  * @param options.did {string} the party's DID, every grant's controller
196
227
  * @param options.kind {ConnectionKind} the kind this flow writes
197
- * @param [options.spaceUrl] {string} this Space's container URL, every
198
- * grant's target prefix; absent on a session with no Space
228
+ * @param [options.spaceUrl] {string} the account Space's container URL;
229
+ * absent on a session with no Space
199
230
  * @param options.grants {Array<object>} `{ zcap, grantKind }` per grant
200
231
  * @param [options.name] {string} the party's self-declared name
201
232
  * @param [options.origin] {string} the attested Web origin (App Connect)
@@ -261,11 +292,13 @@ export declare function removeGrants({ store, hmacKey, did, zcapIds }: {
261
292
  * Throws when a read finds a grant that passes the reader checks and is not
262
293
  * among `handledZcapIds`: a concurrent consent merged it, and the revocation
263
294
  * must run again before the entry may retire. A grant that fails the reader
264
- * checks (another party's controller, a target outside this Space) is not
265
- * the party's, and the retirement empties it with the rest. Without
266
- * `spaceUrl` (a session with no Space, which delegates nothing) no grant can
267
- * be the party's, so none counts as unhandled and the retirement empties
268
- * them all.
295
+ * checks (another party's controller, a target under none of the account's
296
+ * container URLs read off the entry) is not the party's, and the retirement
297
+ * empties it with the rest. On a `replica-server` entry a pull grant on a
298
+ * recorded `fromSpace` passes, so an unrevoked one holds the retirement.
299
+ * Without `spaceUrl` (a session with no Space, which delegates nothing) no
300
+ * grant can be the party's, so none counts as unhandled and the retirement
301
+ * empties them all.
269
302
  *
270
303
  * An entry whose `replicas` list is not empty is refused with an `Error`:
271
304
  * each item is removed (`removeReplica`) once its replica Space is gone, and
@@ -278,8 +311,8 @@ export declare function removeGrants({ store, hmacKey, did, zcapIds }: {
278
311
  * @param options.did {string} the party's DID
279
312
  * @param options.handledZcapIds {Iterable<string>} the capability ids the
280
313
  * revocation POSTed
281
- * @param [options.spaceUrl] {string} this Space's container URL, every
282
- * session with a Space passes it
314
+ * @param [options.spaceUrl] {string} the account Space's container URL,
315
+ * every session with a Space passes it
283
316
  * @param [options.now] {Date}
284
317
  * @returns {Promise<ConnectionWriteResult>}
285
318
  */
@@ -1 +1 @@
1
- {"version":3,"file":"upsert.d.ts","sourceRoot":"","sources":["../../src/connections/upsert.ts"],"names":[],"mappings":"AAAA;;GAEG;AAmEH,OAAO,KAAK,EACV,eAAe,EACf,qBAAqB,EACrB,cAAc,EAGd,cAAc,EACd,SAAS,EACT,iBAAiB,EAClB,MAAM,YAAY,CAAA;AAcnB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAOlD;;;;;;;GAOG;AACH,MAAM,MAAM,sBAAsB,GAChC,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAA;AAEhD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAA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MAAM,CAAA;IACX,gBAAgB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IACnC,GAAG,CAAC,EAAE,IAAI,CAAA;CACX,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAuCjC;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CAAC,EACxC,KAAK,EACL,OAAO,EACP,GAAG,EACJ,EAAE;IACD,KAAK,EAAE,gBAAgB,CAAA;IACvB,OAAO,EAAE,eAAe,CAAA;IACxB,GAAG,EAAE,MAAM,CAAA;CACZ,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAkBjC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,KAAK,EACL,OAAO,EACP,GAAG,EACH,MAAM,EACP,EAAE;IACD,KAAK,EAAE,gBAAgB,CAAA;IACvB,OAAO,EAAE,eAAe,CAAA;IACxB,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;CACf,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAkBjC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,YAAY,CAAC,EACjC,KAAK,EACL,OAAO,EACP,GAAG,EACH,GAAgB,EACjB,EAAE;IACD,KAAK,EAAE,gBAAgB,CAAA;IACvB,OAAO,EAAE,eAAe,CAAA;IACxB,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,CAAC,EAAE,IAAI,CAAA;CACX,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAejC"}
1
+ {"version":3,"file":"upsert.d.ts","sourceRoot":"","sources":["../../src/connections/upsert.ts"],"names":[],"mappings":"AAAA;;GAEG;AAoEH,OAAO,KAAK,EACV,eAAe,EACf,qBAAqB,EACrB,cAAc,EAGd,cAAc,EACd,SAAS,EACT,iBAAiB,EAClB,MAAM,YAAY,CAAA;AAiBnB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EAAE,gBAA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E,gBAAgB,CAAA;IACvB,OAAO,EAAE,eAAe,CAAA;IACxB,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,CAAC,EAAE,IAAI,CAAA;CACX,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAejC"}
@@ -49,9 +49,9 @@ import { isJsonObject } from '../jsonObject.js';
49
49
  import { normalizeDisplayName } from '../labelText.js';
50
50
  import { REVOCATION_CLOCK_SKEW_MS } from '../webvh/index.js';
51
51
  import { signingKeyMultibaseOfDid } from './didKey.js';
52
- import { CONNECTION_ENTRY_VERSION, GRANT_KINDS, RECEIVED_GRANT_KINDS, isWritableConnectionEntry, newConnectionEntry, parseConnectionEntry, parseConnectionZcap } from './entry.js';
52
+ import { CONNECTION_ENTRY_VERSION, GRANT_KINDS, RECEIVED_GRANT_KINDS, REPLICA_SERVER_KIND, isWritableConnectionEntry, newConnectionEntry, parseConnectionEntry, parseConnectionZcap } from './entry.js';
53
53
  import { ConnectionKindMismatchError } from './errors.js';
54
- import { allowsAction, connectionGrants, grantScopeKey, latestIndexPerScope, isTargetInSpace, liveInboxChannel, receivedGrantLapsed, receivedGrants } from './grants.js';
54
+ import { allowsAction, accountContainerUrls, connectionGrants, grantScopeKey, latestIndexPerScope, isTargetInAnySpace, isTargetInSpace, liveInboxChannel, normalizedActions, receivedGrantLapsed, receivedGrants } from './grants.js';
55
55
  import { claimedResourceId } from './read.js';
56
56
  import { connectionResourceId, verifyConnectionSeedTag } from './resourceId.js';
57
57
  const PRECONDITION_FAILED_ERROR_NAME = 'PreconditionFailedError';
@@ -215,40 +215,65 @@ export function assertKind({ entry, kind }) {
215
215
  }
216
216
  /**
217
217
  * A capability the wallet delegated, checked strictly: its known members
218
- * well-formed, its `controller` the party's DID, its `invocationTarget`
219
- * under this Space. The target check is the same one every reader applies,
220
- * so a grant that is stored is a grant the revocation index will see.
218
+ * well-formed and its `controller` the party's DID. The target check is
219
+ * {@link assertTargetInSpaces}, run where the target set is known.
221
220
  *
222
221
  * @param options {object}
223
222
  * @param options.did {string}
224
- * @param options.spaceUrl {string}
225
223
  * @param options.zcap {object}
226
224
  * @returns {ConnectionZcap}
227
225
  */
228
- export function checkedDelegatedZcap({ did, spaceUrl, zcap: value }) {
226
+ export function checkedDelegatedZcap({ did, zcap: value }) {
229
227
  const zcap = requiredConnectionZcap({ value, what: 'grant to record' });
230
228
  if (zcap.controller !== did) {
231
229
  throw new TypeError(`A grant to record must be delegated to the party "${did}"; its ` +
232
230
  `controller is "${zcap.controller}".`);
233
231
  }
234
- if (!isTargetInSpace({ target: zcap.invocationTarget, spaceUrl })) {
235
- throw new TypeError('A grant to record must target this Space; its invocation target is ' +
236
- `"${zcap.invocationTarget}".`);
237
- }
238
232
  return zcap;
239
233
  }
240
234
  /**
241
- * The capability of one grant to record: {@link checkedDelegatedZcap}, and
242
- * its kind one this build writes.
235
+ * Refuses with a `TypeError` a capability whose `invocationTarget` is under
236
+ * none of `spaceUrls`. The check is the same one every reader applies, over
237
+ * the same set (`accountContainerUrls` for a party entry, the item's
238
+ * `fromSpace` for a pull grant), so a grant that is stored is a grant the
239
+ * revocation index will see.
240
+ *
241
+ * @param options {object}
242
+ * @param options.zcap {ConnectionZcap}
243
+ * @param options.spaceUrls {string[]} the container URLs the grant may
244
+ * target
245
+ */
246
+ export function assertTargetInSpaces({ zcap, spaceUrls }) {
247
+ if (!isTargetInAnySpace({ target: zcap.invocationTarget, spaceUrls })) {
248
+ throw new TypeError("A grant to record must target one of the account's Spaces; its " +
249
+ `invocation target is "${zcap.invocationTarget}".`);
250
+ }
251
+ }
252
+ /**
253
+ * Refuses with a `TypeError` a capability allowing any action but `GET`: a
254
+ * replica server's grant reads and nothing else, whichever helper records it.
255
+ *
256
+ * @param options {object}
257
+ * @param options.zcap {ConnectionZcap}
258
+ */
259
+ export function assertPullGrantActions({ zcap }) {
260
+ const actions = normalizedActions({ allowedAction: zcap.allowedAction });
261
+ if (actions.length !== 1 || actions[0] !== 'GET') {
262
+ throw new TypeError(`A pull grant allows GET and nothing else; its allowed actions are ` +
263
+ `${JSON.stringify(actions)}.`);
264
+ }
265
+ }
266
+ /**
267
+ * The capability of one grant to record: {@link checkedDelegatedZcap}, and its kind
268
+ * one this build writes. The target check runs where the target set is known.
243
269
  *
244
270
  * @param options {object}
245
271
  * @param options.did {string}
246
- * @param options.spaceUrl {string}
247
272
  * @param options.grant {object}
248
273
  * @returns {ConnectionZcap}
249
274
  */
250
- function checkedGrant({ did, spaceUrl, grant }) {
251
- const zcap = checkedDelegatedZcap({ did, spaceUrl, zcap: grant.zcap });
275
+ function checkedGrant({ did, grant }) {
276
+ const zcap = checkedDelegatedZcap({ did, zcap: grant.zcap });
252
277
  if (!GRANT_KINDS.includes(grant.grantKind)) {
253
278
  throw new TypeError(`Unknown grant kind "${grant.grantKind}".`);
254
279
  }
@@ -463,10 +488,18 @@ function supersedeAndQueueEnvelope({ outbox, message, stamp, supersedes }) {
463
488
  * written once. A tag that does not verify under `hmacKey` is refused with a
464
489
  * `TypeError` before anything is read.
465
490
  *
466
- * Refuses an entry of another kind with {@link ConnectionKindMismatchError},
467
- * and a grant delegated to another party or targeting another Space with a
468
- * `TypeError`, before anything is written. Without `spaceUrl` (a session with
469
- * no Space, which delegates nothing) only a zero-grant write proceeds, and a
491
+ * Refuses a grant delegated to another party, or of an unknown kind, with a
492
+ * `TypeError` before anything is read. Inside the read-modify-write, and
493
+ * before anything is written, it refuses an entry of another kind with
494
+ * {@link ConnectionKindMismatchError}, then a grant targeting none of the
495
+ * account's container URLs (`accountContainerUrls` over the stored entry, so
496
+ * a `replica-server` entry admits a grant on a recorded `fromSpace`; a
497
+ * create admits the account Space alone) with a `TypeError`. When `kind` is
498
+ * `replica-server` every grant must allow `GET` and nothing else, the rule
499
+ * `recordReplicaGrant` applies, since a replica server only ever pulls; the
500
+ * pull grant's item and registration-id rules stay with that helper, the
501
+ * designed path for recording one. Without `spaceUrl` (a session with no
502
+ * Space, which delegates nothing) only a zero-grant write proceeds, and a
470
503
  * call carrying any grant throws a `TypeError`.
471
504
  *
472
505
  * @param options {object}
@@ -474,8 +507,8 @@ function supersedeAndQueueEnvelope({ outbox, message, stamp, supersedes }) {
474
507
  * @param options.hmacKey {ConnectionIdKey}
475
508
  * @param options.did {string} the party's DID, every grant's controller
476
509
  * @param options.kind {ConnectionKind} the kind this flow writes
477
- * @param [options.spaceUrl] {string} this Space's container URL, every
478
- * grant's target prefix; absent on a session with no Space
510
+ * @param [options.spaceUrl] {string} the account Space's container URL;
511
+ * absent on a session with no Space
479
512
  * @param options.grants {Array<object>} `{ zcap, grantKind }` per grant
480
513
  * @param [options.name] {string} the party's self-declared name
481
514
  * @param [options.origin] {string} the attested Web origin (App Connect)
@@ -493,15 +526,20 @@ function supersedeAndQueueEnvelope({ outbox, message, stamp, supersedes }) {
493
526
  */
494
527
  export async function recordGrants({ store, hmacKey, did, kind, spaceUrl, grants, name, origin, url, appKey, seed, seedTag, message, unlessRetired, now = new Date() }) {
495
528
  await assertPairwiseSeed({ hmacKey, seed, seedTag });
529
+ if (grants.length > 0 && spaceUrl === undefined) {
530
+ throw new TypeError("A grant to record needs the account Space's container URL; a write " +
531
+ 'with no Space records no grants.');
532
+ }
496
533
  const stamp = now.toISOString();
534
+ // The shape, controller, and kind checks need no stored entry, so they run
535
+ // once here; the target check does, so it runs inside the write.
497
536
  const recorded = [];
498
537
  const seen = new Set();
499
538
  for (const grant of grants) {
500
- if (spaceUrl === undefined) {
501
- throw new TypeError("A grant to record needs this Space's container URL; a write with " +
502
- 'no Space records no grants.');
539
+ const zcap = checkedGrant({ did, grant });
540
+ if (kind === REPLICA_SERVER_KIND) {
541
+ assertPullGrantActions({ zcap });
503
542
  }
504
- const zcap = checkedGrant({ did, spaceUrl, grant });
505
543
  if (!seen.has(zcap.id)) {
506
544
  seen.add(zcap.id);
507
545
  recorded.push({ zcap, grantKind: grant.grantKind, grantedAt: stamp });
@@ -527,6 +565,20 @@ export async function recordGrants({ store, hmacKey, did, kind, spaceUrl, grants
527
565
  did,
528
566
  change(current) {
529
567
  const stored = current?.entry;
568
+ if (stored !== undefined) {
569
+ assertKind({ entry: stored, kind });
570
+ if (unlessRetired && stored.retired !== undefined) {
571
+ return { stop: 'unchanged' };
572
+ }
573
+ }
574
+ // The target set is read off the stored entry; a create admits the
575
+ // account Space alone. With no Space `recorded` is empty.
576
+ if (spaceUrl !== undefined) {
577
+ const spaceUrls = accountContainerUrls({ entry: stored, spaceUrl });
578
+ for (const grant of recorded) {
579
+ assertTargetInSpaces({ zcap: grant.zcap, spaceUrls });
580
+ }
581
+ }
530
582
  const held = new Set(stored?.grants.map(grant => grant.zcap.id));
531
583
  let body;
532
584
  if (current === undefined) {
@@ -537,10 +589,6 @@ export async function recordGrants({ store, hmacKey, did, kind, spaceUrl, grants
537
589
  };
538
590
  }
539
591
  else {
540
- assertKind({ entry: current.entry, kind });
541
- if (unlessRetired && current.entry.retired !== undefined) {
542
- return { stop: 'unchanged' };
543
- }
544
592
  body = {
545
593
  ...current.body,
546
594
  ...declared,
@@ -617,11 +665,13 @@ export async function removeGrants({ store, hmacKey, did, zcapIds }) {
617
665
  * Throws when a read finds a grant that passes the reader checks and is not
618
666
  * among `handledZcapIds`: a concurrent consent merged it, and the revocation
619
667
  * must run again before the entry may retire. A grant that fails the reader
620
- * checks (another party's controller, a target outside this Space) is not
621
- * the party's, and the retirement empties it with the rest. Without
622
- * `spaceUrl` (a session with no Space, which delegates nothing) no grant can
623
- * be the party's, so none counts as unhandled and the retirement empties
624
- * them all.
668
+ * checks (another party's controller, a target under none of the account's
669
+ * container URLs read off the entry) is not the party's, and the retirement
670
+ * empties it with the rest. On a `replica-server` entry a pull grant on a
671
+ * recorded `fromSpace` passes, so an unrevoked one holds the retirement.
672
+ * Without `spaceUrl` (a session with no Space, which delegates nothing) no
673
+ * grant can be the party's, so none counts as unhandled and the retirement
674
+ * empties them all.
625
675
  *
626
676
  * An entry whose `replicas` list is not empty is refused with an `Error`:
627
677
  * each item is removed (`removeReplica`) once its replica Space is gone, and
@@ -634,8 +684,8 @@ export async function removeGrants({ store, hmacKey, did, zcapIds }) {
634
684
  * @param options.did {string} the party's DID
635
685
  * @param options.handledZcapIds {Iterable<string>} the capability ids the
636
686
  * revocation POSTed
637
- * @param [options.spaceUrl] {string} this Space's container URL, every
638
- * session with a Space passes it
687
+ * @param [options.spaceUrl] {string} the account Space's container URL,
688
+ * every session with a Space passes it
639
689
  * @param [options.now] {Date}
640
690
  * @returns {Promise<ConnectionWriteResult>}
641
691
  */
@@ -953,10 +1003,12 @@ export async function recordRenewedGrants({ store, hmacKey, did, pairwiseDid, sp
953
1003
  if (renewals.length === 0) {
954
1004
  throw new TypeError('A renewal write needs at least one renewed grant.');
955
1005
  }
956
- const renewed = renewals.map(renewal => ({
957
- zcap: checkedDelegatedZcap({ did, spaceUrl, zcap: renewal.zcap }),
958
- sourceZcapId: renewal.sourceZcapId
959
- }));
1006
+ // An agent entry records no replica, so its target set is this Space.
1007
+ const renewed = renewals.map(renewal => {
1008
+ const zcap = checkedDelegatedZcap({ did, zcap: renewal.zcap });
1009
+ assertTargetInSpaces({ zcap, spaceUrls: [spaceUrl] });
1010
+ return { zcap, sourceZcapId: renewal.sourceZcapId };
1011
+ });
960
1012
  if (new Set(renewed.map(renewal => renewal.sourceZcapId)).size !==
961
1013
  renewed.length) {
962
1014
  throw new TypeError('Each renewed grant must renew a different record.');