@interop/wallet-core 0.101.1 → 0.103.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 (113) hide show
  1. package/README.md +33 -17
  2. package/dist/audiences/audienceGrant.d.ts +49 -0
  3. package/dist/audiences/audienceGrant.d.ts.map +1 -0
  4. package/dist/audiences/audienceGrant.js +46 -0
  5. package/dist/audiences/audienceGrant.js.map +1 -0
  6. package/dist/audiences/index.d.ts +10 -0
  7. package/dist/audiences/index.d.ts.map +1 -0
  8. package/dist/audiences/index.js +10 -0
  9. package/dist/audiences/index.js.map +1 -0
  10. package/dist/clientAnnex/grantRevocation.d.ts +0 -10
  11. package/dist/clientAnnex/grantRevocation.d.ts.map +1 -1
  12. package/dist/clientAnnex/grantRevocation.js +1 -23
  13. package/dist/clientAnnex/grantRevocation.js.map +1 -1
  14. package/dist/clientAnnex/index.d.ts +1 -1
  15. package/dist/clientAnnex/index.d.ts.map +1 -1
  16. package/dist/clientAnnex/index.js +1 -1
  17. package/dist/clientAnnex/index.js.map +1 -1
  18. package/dist/clientAnnex/log.d.ts +2 -1
  19. package/dist/clientAnnex/log.d.ts.map +1 -1
  20. package/dist/clientAnnex/log.js +5 -2
  21. package/dist/clientAnnex/log.js.map +1 -1
  22. package/dist/clients/rosterPolicy.d.ts.map +1 -1
  23. package/dist/clients/rosterPolicy.js +3 -1
  24. package/dist/clients/rosterPolicy.js.map +1 -1
  25. package/dist/connections/didKey.d.ts +27 -0
  26. package/dist/connections/didKey.d.ts.map +1 -1
  27. package/dist/connections/didKey.js +42 -6
  28. package/dist/connections/didKey.js.map +1 -1
  29. package/dist/connections/entry.d.ts +95 -13
  30. package/dist/connections/entry.d.ts.map +1 -1
  31. package/dist/connections/entry.js +102 -16
  32. package/dist/connections/entry.js.map +1 -1
  33. package/dist/connections/grants.d.ts +225 -3
  34. package/dist/connections/grants.d.ts.map +1 -1
  35. package/dist/connections/grants.js +293 -8
  36. package/dist/connections/grants.js.map +1 -1
  37. package/dist/connections/index.d.ts +15 -8
  38. package/dist/connections/index.d.ts.map +1 -1
  39. package/dist/connections/index.js +13 -6
  40. package/dist/connections/index.js.map +1 -1
  41. package/dist/connections/read.d.ts.map +1 -1
  42. package/dist/connections/read.js +2 -1
  43. package/dist/connections/read.js.map +1 -1
  44. package/dist/connections/resourceId.d.ts +33 -0
  45. package/dist/connections/resourceId.d.ts.map +1 -1
  46. package/dist/connections/resourceId.js +88 -8
  47. package/dist/connections/resourceId.js.map +1 -1
  48. package/dist/connections/upsert.d.ts +219 -7
  49. package/dist/connections/upsert.d.ts.map +1 -1
  50. package/dist/connections/upsert.js +628 -41
  51. package/dist/connections/upsert.js.map +1 -1
  52. package/dist/connections/writers.js +2 -1
  53. package/dist/connections/writers.js.map +1 -1
  54. package/dist/descriptors/index.d.ts +5 -0
  55. package/dist/descriptors/index.d.ts.map +1 -1
  56. package/dist/descriptors/index.js +5 -0
  57. package/dist/descriptors/index.js.map +1 -1
  58. package/dist/descriptors/logSource.d.ts +9 -4
  59. package/dist/descriptors/logSource.d.ts.map +1 -1
  60. package/dist/descriptors/logSource.js +13 -6
  61. package/dist/descriptors/logSource.js.map +1 -1
  62. package/dist/jsonObject.d.ts +16 -0
  63. package/dist/jsonObject.d.ts.map +1 -0
  64. package/dist/jsonObject.js +18 -0
  65. package/dist/jsonObject.js.map +1 -0
  66. package/dist/keys/index.d.ts +13 -9
  67. package/dist/keys/index.d.ts.map +1 -1
  68. package/dist/keys/index.js +11 -7
  69. package/dist/keys/index.js.map +1 -1
  70. package/dist/keys/userKeyCascade.d.ts +46 -0
  71. package/dist/keys/userKeyCascade.d.ts.map +1 -1
  72. package/dist/keys/userKeyCascade.js +153 -65
  73. package/dist/keys/userKeyCascade.js.map +1 -1
  74. package/dist/keys/userKeyRoster.d.ts +60 -7
  75. package/dist/keys/userKeyRoster.d.ts.map +1 -1
  76. package/dist/keys/userKeyRoster.js +165 -47
  77. package/dist/keys/userKeyRoster.js.map +1 -1
  78. package/dist/keys/userKeyRosterCascade.d.ts.map +1 -1
  79. package/dist/keys/userKeyRosterCascade.js +1 -0
  80. package/dist/keys/userKeyRosterCascade.js.map +1 -1
  81. package/dist/menders/ids.d.ts +1 -1
  82. package/dist/menders/ids.d.ts.map +1 -1
  83. package/dist/menders/ids.js +20 -4
  84. package/dist/menders/ids.js.map +1 -1
  85. package/dist/space/collections.d.ts +23 -3
  86. package/dist/space/collections.d.ts.map +1 -1
  87. package/dist/space/collections.js +26 -2
  88. package/dist/space/collections.js.map +1 -1
  89. package/dist/space/inboxMessage.d.ts +47 -0
  90. package/dist/space/inboxMessage.d.ts.map +1 -0
  91. package/dist/space/inboxMessage.js +86 -0
  92. package/dist/space/inboxMessage.js.map +1 -0
  93. package/dist/space/index.d.ts +6 -1
  94. package/dist/space/index.d.ts.map +1 -1
  95. package/dist/space/index.js +5 -1
  96. package/dist/space/index.js.map +1 -1
  97. package/dist/sync/contactsConflict.d.ts +23 -10
  98. package/dist/sync/contactsConflict.d.ts.map +1 -1
  99. package/dist/sync/contactsConflict.js +40 -21
  100. package/dist/sync/contactsConflict.js.map +1 -1
  101. package/dist/webvh/didWebProjection.d.ts +38 -5
  102. package/dist/webvh/didWebProjection.d.ts.map +1 -1
  103. package/dist/webvh/didWebProjection.js +35 -22
  104. package/dist/webvh/didWebProjection.js.map +1 -1
  105. package/dist/webvh/index.d.ts +4 -3
  106. package/dist/webvh/index.d.ts.map +1 -1
  107. package/dist/webvh/index.js +4 -3
  108. package/dist/webvh/index.js.map +1 -1
  109. package/dist/webvh/standingZcap.d.ts +19 -2
  110. package/dist/webvh/standingZcap.d.ts.map +1 -1
  111. package/dist/webvh/standingZcap.js +31 -3
  112. package/dist/webvh/standingZcap.js.map +1 -1
  113. package/package.json +11 -5
@@ -1,4 +1,12 @@
1
1
  import type { ConnectionEntry, ConnectionZcap, GrantKind } from './entry.js';
2
+ import type { PublishedKeyDocument } from '../webvh/index.js';
3
+ /**
4
+ * The agent grant renewal window: ninety days before its `expires`, a grant
5
+ * to an agent is due for renewal. Distinct from the thirty-day window the
6
+ * standing recorded zcaps share, since an agent cannot ask the owner for a
7
+ * fresh grant on its own.
8
+ */
9
+ export declare const AGENT_GRANT_RENEWAL_WINDOW_MS: number;
2
10
  /**
3
11
  * One grant that passed the reader checks, with the members a decision
4
12
  * reads taken off its capability.
@@ -17,7 +25,7 @@ export interface ConnectionGrant {
17
25
  */
18
26
  target: string;
19
27
  allowedAction?: string | string[];
20
- expires?: string;
28
+ expires: string;
21
29
  grantKind: GrantKind;
22
30
  grantedAt: string;
23
31
  /**
@@ -83,8 +91,8 @@ export declare function grantTargets({ grants }: {
83
91
  grants: ConnectionGrant[];
84
92
  }): string[];
85
93
  /**
86
- * Splits grants into the live and the expired. A grant with no `expires` is
87
- * live. One whose `expires` is at or before `now` is expired.
94
+ * Splits grants into the live and the expired. A grant whose `expires` is at
95
+ * or before `now` is expired.
88
96
  *
89
97
  * @param options {object}
90
98
  * @param options.grants {ConnectionGrant[]}
@@ -109,4 +117,218 @@ export declare function splitGrantsByExpiry({ grants, now }: {
109
117
  export declare function grantRecipientKid({ grant }: {
110
118
  grant: ConnectionGrant;
111
119
  }): string | undefined;
120
+ /**
121
+ * One received grant that passed the received-list checks, with the members
122
+ * a decision reads taken off its capability.
123
+ */
124
+ export interface ConnectionReceivedGrant {
125
+ /**
126
+ * The capability's `id`.
127
+ */
128
+ zcapId: string;
129
+ /**
130
+ * The capability's `controller`, equal to the wallet's pairwise DID toward
131
+ * the party.
132
+ */
133
+ controller: string;
134
+ /**
135
+ * The capability's `invocationTarget`, outside this Space.
136
+ */
137
+ target: string;
138
+ allowedAction?: string | string[];
139
+ expires: string;
140
+ /**
141
+ * The record's `grantKind`, as stored.
142
+ */
143
+ grantKind: string;
144
+ receivedAt: string;
145
+ /**
146
+ * The stored capability, verbatim: what an invocation presents.
147
+ */
148
+ zcap: ConnectionZcap;
149
+ }
150
+ /**
151
+ * Whether a capability's action set names a verb. A string action is a
152
+ * one-member set.
153
+ *
154
+ * @param options {object}
155
+ * @param [options.allowedAction] {string | string[]}
156
+ * @param options.action {string}
157
+ * @returns {boolean}
158
+ */
159
+ export declare function allowsAction({ allowedAction, action }: {
160
+ allowedAction?: string | string[];
161
+ action: string;
162
+ }): boolean;
163
+ /**
164
+ * A capability's action set as a sorted array: a string is a one-member
165
+ * set, and an absent member is the empty set.
166
+ *
167
+ * @param options {object}
168
+ * @param [options.allowedAction] {string | string[]}
169
+ * @returns {string[]}
170
+ */
171
+ export declare function normalizedActions({ allowedAction }: {
172
+ allowedAction?: string | string[];
173
+ }): string[];
174
+ /**
175
+ * The scope key two capabilities share when one renews the other: the
176
+ * `controller`, the `invocationTarget` compared verbatim (a trailing `*`
177
+ * marker counts), and the normalized `allowedAction`. The renewal pivot and
178
+ * {@link latestGrantsPerScope} key on the same string.
179
+ *
180
+ * @param options {object}
181
+ * @param options.zcap {ConnectionZcap}
182
+ * @returns {string}
183
+ */
184
+ export declare function grantScopeKey({ zcap }: {
185
+ zcap: ConnectionZcap;
186
+ }): string;
187
+ /**
188
+ * The received grants of one entry that pass the received-list checks, in
189
+ * stored order: the opposite rule to {@link connectionGrants}. A record is
190
+ * kept only when its `zcap.controller` is the wallet's pairwise DID toward
191
+ * the party and its `invocationTarget` is outside this Space. An `'inbox'`
192
+ * record must also allow `POST`. A retired entry yields none, since readers
193
+ * ignore the received list on a retired entry.
194
+ *
195
+ * @param options {object}
196
+ * @param options.entry {ConnectionEntry}
197
+ * @param options.pairwiseDid {string} the wallet's pairwise DID toward the
198
+ * party
199
+ * @param options.spaceUrl {string} this Space's container URL
200
+ * @returns {ConnectionReceivedGrant[]}
201
+ */
202
+ export declare function receivedGrants({ entry, pairwiseDid, spaceUrl }: {
203
+ entry: ConnectionEntry;
204
+ pairwiseDid: string;
205
+ spaceUrl: string;
206
+ }): ConnectionReceivedGrant[];
207
+ /**
208
+ * Whether a received grant has lapsed as of `now`: it lapses at the earlier
209
+ * of its `expires` and `receivedAt + maxLifetimeMs`. A record with an
210
+ * unparseable `receivedAt` reads as lapsed.
211
+ *
212
+ * @param options {object}
213
+ * @param options.grant {object} the grant's `expires` and `receivedAt`: a
214
+ * `ConnectionReceivedGrant`, or a stored record's members
215
+ * @param options.now {Date}
216
+ * @param options.maxLifetimeMs {number} the longest a received grant is
217
+ * used after it was stored
218
+ * @returns {boolean}
219
+ */
220
+ export declare function receivedGrantLapsed({ grant, now, maxLifetimeMs }: {
221
+ grant: Pick<ConnectionReceivedGrant, 'expires' | 'receivedAt'>;
222
+ now: Date;
223
+ maxLifetimeMs: number;
224
+ }): boolean;
225
+ /**
226
+ * The live inbox channel: of the `'inbox'` received grants not lapsed
227
+ * ({@link receivedGrantLapsed}), the one with the greatest `expires`. A tie
228
+ * keeps the later record in stored order.
229
+ *
230
+ * @param options {object}
231
+ * @param options.grants {ConnectionReceivedGrant[]} the received list, as
232
+ * {@link receivedGrants} returns it
233
+ * @param options.now {Date}
234
+ * @param options.maxLifetimeMs {number}
235
+ * @returns {ConnectionReceivedGrant | undefined}
236
+ */
237
+ export declare function liveInboxChannel({ grants, now, maxLifetimeMs }: {
238
+ grants: ConnectionReceivedGrant[];
239
+ now: Date;
240
+ maxLifetimeMs: number;
241
+ }): ConnectionReceivedGrant | undefined;
242
+ /**
243
+ * The latest grant per scope. A scope is the grant's `controller`, its
244
+ * `target` compared verbatim (a trailing `*` marker included), and its
245
+ * action set (a string is a one-member set, and order does not matter). The
246
+ * latest is the one with the greatest `expires`, and a tie keeps the later
247
+ * record in stored order. One grant per scope, in first-seen scope order.
248
+ *
249
+ * @param options {object}
250
+ * @param options.grants {ConnectionGrant[]}
251
+ * @returns {ConnectionGrant[]}
252
+ */
253
+ export declare function latestGrantsPerScope({ grants }: {
254
+ grants: ConnectionGrant[];
255
+ }): ConnectionGrant[];
256
+ /**
257
+ * The index of the latest capability in each scope ({@link grantScopeKey})
258
+ * of a list: the greatest `expires`, a tie going to the later one. Scopes
259
+ * come out in first-seen order.
260
+ *
261
+ * @param options {object}
262
+ * @param options.zcaps {ConnectionZcap[]}
263
+ * @returns {Map<string, number>} scope key to the latest capability's index
264
+ */
265
+ export declare function latestIndexPerScope({ zcaps }: {
266
+ zcaps: ConnectionZcap[];
267
+ }): Map<string, number>;
268
+ /**
269
+ * The grants one connection request's consent produced: those sharing their
270
+ * `grantedAt` with an inbox grant on the same list (one targeting exactly
271
+ * this Space's inbox collection container and allowing `POST`), whose action
272
+ * set is exactly `GET` and `HEAD` on a Collection container, or exactly
273
+ * `POST` on the inbox. A write grant, and a read grant from another consent,
274
+ * are out of scope.
275
+ *
276
+ * @param options {object}
277
+ * @param options.grants {ConnectionGrant[]}
278
+ * @param options.spaceUrl {string} this Space's container URL
279
+ * @returns {ConnectionGrant[]}
280
+ */
281
+ export declare function renewalScopeGrants({ grants, spaceUrl }: {
282
+ grants: ConnectionGrant[];
283
+ spaceUrl: string;
284
+ }): ConnectionGrant[];
285
+ /**
286
+ * Whether a grant to an agent is due for renewal. A grant already past its
287
+ * `expires` is not due: it is gone, and a fresh consent replaces it. One
288
+ * inside the renewal window is due (`zcapExpiring`'s polarity). Past that, a
289
+ * grant whose embedded parent is
290
+ * not the generation delegation the account currently points at is dead by
291
+ * replacement and due, while its parent's own signer still stands under
292
+ * `capabilityDelegation`. When that signer has left the document the grant
293
+ * fails its proof check instead and is not due here. A root-anchored grant
294
+ * (no embedded parent) is not due on this axis. The document is consulted
295
+ * for the parent's signer only, since an annex VM that signs the leaf never
296
+ * appears in the account document.
297
+ *
298
+ * @param options {object}
299
+ * @param options.zcap {ConnectionZcap}
300
+ * @param [options.pointedDelegationId] {string} the current generation
301
+ * delegation's id, read from the account pointer's generation log head;
302
+ * undefined when the document points at no generation
303
+ * @param options.doc {PublishedKeyDocument} the locally verified account
304
+ * document
305
+ * @param [options.renewalWindowMs] {number}
306
+ * @param [options.now] {number} epoch milliseconds
307
+ * @returns {boolean}
308
+ */
309
+ export declare function agentGrantDue({ zcap, pointedDelegationId, doc, renewalWindowMs, now }: {
310
+ zcap: ConnectionZcap;
311
+ pointedDelegationId?: string;
312
+ doc: PublishedKeyDocument;
313
+ renewalWindowMs?: number;
314
+ now?: number;
315
+ }): boolean;
316
+ /**
317
+ * The unretired agent entries holding at least one grant (through
318
+ * {@link connectionGrants}) a key signed. A root-anchored grant (no embedded
319
+ * parent) counts when its own proof names the key. A grant with an embedded
320
+ * parent counts when the parent's proof names the key, the parent's minter.
321
+ *
322
+ * @param options {object}
323
+ * @param options.entries {ConnectionEntry[]}
324
+ * @param options.keyId {string} a verification-method id in either DID
325
+ * form, or a bare multibase
326
+ * @param options.spaceUrl {string} this Space's container URL
327
+ * @returns {ConnectionEntry[]}
328
+ */
329
+ export declare function agentConnectionsSignedBy({ entries, keyId, spaceUrl }: {
330
+ entries: ConnectionEntry[];
331
+ keyId: string;
332
+ spaceUrl: string;
333
+ }): ConnectionEntry[];
112
334
  //# sourceMappingURL=grants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"grants.d.ts","sourceRoot":"","sources":["../../src/connections/grants.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE5E;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACjC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,SAAS,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,IAAI,EAAE,cAAc,CAAA;CACrB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,QAAQ,EACT,EAAE;IACD,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EA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G,OAAO,CAeV;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,OAAO,EACP,KAAK,EACL,QAAQ,EACT,EAAE;IACD,OAAO,EAAE,eAAe,EAAE,CAAA;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACjB,GAAG,eAAe,EAAE,CAmBpB"}
@@ -12,9 +12,25 @@
12
12
  * one party's id cannot steer a revocation at another party's capabilities.
13
13
  * A grant whose `zcap.invocationTarget` is not under this Space's container
14
14
  * URL is dropped, so no reader acts on a capability over another Space.
15
+ *
16
+ * The agent-connection readers sit beside them: the received list (the
17
+ * capabilities an agent handed the wallet, over targets outside this Space),
18
+ * the live inbox channel, the latest grant per scope, the grants one
19
+ * connection request's consent produced, the agent grant renewal predicate,
20
+ * and the agent entries one key signed grants for.
15
21
  */
22
+ import { vmFragmentOf } from '@interop/vh-resource-log';
16
23
  import { connectionRecipientKid } from './didKey.js';
17
24
  import { grantKindOf } from './entry.js';
25
+ import { INBOX_COLLECTION } from '../space/collections.js';
26
+ import { delegationProofKeyId, delegationSignerGone, embeddedParentCapability, zcapExpiring } from '../webvh/index.js';
27
+ /**
28
+ * The agent grant renewal window: ninety days before its `expires`, a grant
29
+ * to an agent is due for renewal. Distinct from the thirty-day window the
30
+ * standing recorded zcaps share, since an agent cannot ask the owner for a
31
+ * fresh grant on its own.
32
+ */
33
+ export const AGENT_GRANT_RENEWAL_WINDOW_MS = 90 * 24 * 60 * 60 * 1000;
18
34
  /**
19
35
  * Whether a capability target sits under a Space's container URL. The target
20
36
  * is normalized by URL parsing first, so a dot segment cannot climb out of
@@ -62,10 +78,8 @@ export function connectionGrants({ entry, spaceUrl }) {
62
78
  zcapId: zcap.id,
63
79
  controller: zcap.controller,
64
80
  target: zcap.invocationTarget,
65
- ...(zcap.allowedAction !== undefined && {
66
- allowedAction: zcap.allowedAction
67
- }),
68
- ...(zcap.expires !== undefined && { expires: zcap.expires }),
81
+ allowedAction: zcap.allowedAction,
82
+ expires: zcap.expires,
69
83
  grantKind: grantKindOf(grant),
70
84
  grantedAt: grant.grantedAt,
71
85
  zcap
@@ -114,8 +128,8 @@ export function grantTargets({ grants }) {
114
128
  return [...new Set(grants.map(grant => grant.target))];
115
129
  }
116
130
  /**
117
- * Splits grants into the live and the expired. A grant with no `expires` is
118
- * live. One whose `expires` is at or before `now` is expired.
131
+ * Splits grants into the live and the expired. A grant whose `expires` is at
132
+ * or before `now` is expired.
119
133
  *
120
134
  * @param options {object}
121
135
  * @param options.grants {ConnectionGrant[]}
@@ -126,8 +140,7 @@ export function splitGrantsByExpiry({ grants, now = new Date() }) {
126
140
  const live = [];
127
141
  const expired = [];
128
142
  for (const grant of grants) {
129
- if (grant.expires !== undefined &&
130
- Date.parse(grant.expires) <= now.getTime()) {
143
+ if (Date.parse(grant.expires) <= now.getTime()) {
131
144
  expired.push(grant);
132
145
  }
133
146
  else {
@@ -147,4 +160,276 @@ export function splitGrantsByExpiry({ grants, now = new Date() }) {
147
160
  export function grantRecipientKid({ grant }) {
148
161
  return connectionRecipientKid({ did: grant.controller });
149
162
  }
163
+ /**
164
+ * Whether a capability's action set names a verb. A string action is a
165
+ * one-member set.
166
+ *
167
+ * @param options {object}
168
+ * @param [options.allowedAction] {string | string[]}
169
+ * @param options.action {string}
170
+ * @returns {boolean}
171
+ */
172
+ export function allowsAction({ allowedAction, action }) {
173
+ return normalizedActions({ allowedAction }).includes(action);
174
+ }
175
+ /**
176
+ * A capability's action set as a sorted array: a string is a one-member
177
+ * set, and an absent member is the empty set.
178
+ *
179
+ * @param options {object}
180
+ * @param [options.allowedAction] {string | string[]}
181
+ * @returns {string[]}
182
+ */
183
+ export function normalizedActions({ allowedAction }) {
184
+ if (allowedAction === undefined) {
185
+ return [];
186
+ }
187
+ if (typeof allowedAction === 'string') {
188
+ return [allowedAction];
189
+ }
190
+ return [...allowedAction].sort();
191
+ }
192
+ /**
193
+ * The scope key two capabilities share when one renews the other: the
194
+ * `controller`, the `invocationTarget` compared verbatim (a trailing `*`
195
+ * marker counts), and the normalized `allowedAction`. The renewal pivot and
196
+ * {@link latestGrantsPerScope} key on the same string.
197
+ *
198
+ * @param options {object}
199
+ * @param options.zcap {ConnectionZcap}
200
+ * @returns {string}
201
+ */
202
+ export function grantScopeKey({ zcap }) {
203
+ return JSON.stringify([
204
+ zcap.controller,
205
+ zcap.invocationTarget,
206
+ normalizedActions({ allowedAction: zcap.allowedAction })
207
+ ]);
208
+ }
209
+ /**
210
+ * The received grants of one entry that pass the received-list checks, in
211
+ * stored order: the opposite rule to {@link connectionGrants}. A record is
212
+ * kept only when its `zcap.controller` is the wallet's pairwise DID toward
213
+ * the party and its `invocationTarget` is outside this Space. An `'inbox'`
214
+ * record must also allow `POST`. A retired entry yields none, since readers
215
+ * ignore the received list on a retired entry.
216
+ *
217
+ * @param options {object}
218
+ * @param options.entry {ConnectionEntry}
219
+ * @param options.pairwiseDid {string} the wallet's pairwise DID toward the
220
+ * party
221
+ * @param options.spaceUrl {string} this Space's container URL
222
+ * @returns {ConnectionReceivedGrant[]}
223
+ */
224
+ export function receivedGrants({ entry, pairwiseDid, spaceUrl }) {
225
+ if (entry.retired !== undefined) {
226
+ return [];
227
+ }
228
+ const grants = [];
229
+ for (const record of entry.grantsReceived) {
230
+ const { zcap } = record;
231
+ if (zcap.controller !== pairwiseDid ||
232
+ isTargetInSpace({ target: zcap.invocationTarget, spaceUrl })) {
233
+ continue;
234
+ }
235
+ if (record.grantKind === 'inbox' &&
236
+ !allowsAction({ allowedAction: zcap.allowedAction, action: 'POST' })) {
237
+ continue;
238
+ }
239
+ grants.push({
240
+ zcapId: zcap.id,
241
+ controller: zcap.controller,
242
+ target: zcap.invocationTarget,
243
+ allowedAction: zcap.allowedAction,
244
+ expires: zcap.expires,
245
+ grantKind: record.grantKind,
246
+ receivedAt: record.receivedAt,
247
+ zcap
248
+ });
249
+ }
250
+ return grants;
251
+ }
252
+ /**
253
+ * Whether a received grant has lapsed as of `now`: it lapses at the earlier
254
+ * of its `expires` and `receivedAt + maxLifetimeMs`. A record with an
255
+ * unparseable `receivedAt` reads as lapsed.
256
+ *
257
+ * @param options {object}
258
+ * @param options.grant {object} the grant's `expires` and `receivedAt`: a
259
+ * `ConnectionReceivedGrant`, or a stored record's members
260
+ * @param options.now {Date}
261
+ * @param options.maxLifetimeMs {number} the longest a received grant is
262
+ * used after it was stored
263
+ * @returns {boolean}
264
+ */
265
+ export function receivedGrantLapsed({ grant, now, maxLifetimeMs }) {
266
+ const receivedAt = Date.parse(grant.receivedAt);
267
+ if (Number.isNaN(receivedAt)) {
268
+ return true;
269
+ }
270
+ const lapsesAt = Math.min(receivedAt + maxLifetimeMs, Date.parse(grant.expires));
271
+ return lapsesAt <= now.getTime();
272
+ }
273
+ /**
274
+ * The live inbox channel: of the `'inbox'` received grants not lapsed
275
+ * ({@link receivedGrantLapsed}), the one with the greatest `expires`. A tie
276
+ * keeps the later record in stored order.
277
+ *
278
+ * @param options {object}
279
+ * @param options.grants {ConnectionReceivedGrant[]} the received list, as
280
+ * {@link receivedGrants} returns it
281
+ * @param options.now {Date}
282
+ * @param options.maxLifetimeMs {number}
283
+ * @returns {ConnectionReceivedGrant | undefined}
284
+ */
285
+ export function liveInboxChannel({ grants, now, maxLifetimeMs }) {
286
+ let best;
287
+ let bestExpires = Number.NEGATIVE_INFINITY;
288
+ for (const grant of grants) {
289
+ if (grant.grantKind !== 'inbox' ||
290
+ receivedGrantLapsed({ grant, now, maxLifetimeMs })) {
291
+ continue;
292
+ }
293
+ const expiresAt = Date.parse(grant.expires);
294
+ if (best === undefined || expiresAt >= bestExpires) {
295
+ best = grant;
296
+ bestExpires = expiresAt;
297
+ }
298
+ }
299
+ return best;
300
+ }
301
+ /**
302
+ * The latest grant per scope. A scope is the grant's `controller`, its
303
+ * `target` compared verbatim (a trailing `*` marker included), and its
304
+ * action set (a string is a one-member set, and order does not matter). The
305
+ * latest is the one with the greatest `expires`, and a tie keeps the later
306
+ * record in stored order. One grant per scope, in first-seen scope order.
307
+ *
308
+ * @param options {object}
309
+ * @param options.grants {ConnectionGrant[]}
310
+ * @returns {ConnectionGrant[]}
311
+ */
312
+ export function latestGrantsPerScope({ grants }) {
313
+ const latest = latestIndexPerScope({ zcaps: grants.map(grant => grant.zcap) });
314
+ return [...latest.values()].map(index => grants[index]);
315
+ }
316
+ /**
317
+ * The index of the latest capability in each scope ({@link grantScopeKey})
318
+ * of a list: the greatest `expires`, a tie going to the later one. Scopes
319
+ * come out in first-seen order.
320
+ *
321
+ * @param options {object}
322
+ * @param options.zcaps {ConnectionZcap[]}
323
+ * @returns {Map<string, number>} scope key to the latest capability's index
324
+ */
325
+ export function latestIndexPerScope({ zcaps }) {
326
+ const latest = new Map();
327
+ zcaps.forEach((zcap, index) => {
328
+ const scope = grantScopeKey({ zcap });
329
+ const held = latest.get(scope);
330
+ if (held === undefined ||
331
+ Date.parse(zcap.expires) >= Date.parse(zcaps[held].expires)) {
332
+ // Map.set on an existing key keeps the key's first-seen position.
333
+ latest.set(scope, index);
334
+ }
335
+ });
336
+ return latest;
337
+ }
338
+ /**
339
+ * The grants one connection request's consent produced: those sharing their
340
+ * `grantedAt` with an inbox grant on the same list (one targeting exactly
341
+ * this Space's inbox collection container and allowing `POST`), whose action
342
+ * set is exactly `GET` and `HEAD` on a Collection container, or exactly
343
+ * `POST` on the inbox. A write grant, and a read grant from another consent,
344
+ * are out of scope.
345
+ *
346
+ * @param options {object}
347
+ * @param options.grants {ConnectionGrant[]}
348
+ * @param options.spaceUrl {string} this Space's container URL
349
+ * @returns {ConnectionGrant[]}
350
+ */
351
+ export function renewalScopeGrants({ grants, spaceUrl }) {
352
+ const actionsOf = (grant) => normalizedActions({ allowedAction: grant.allowedAction }).join(' ');
353
+ const isInboxPostTarget = (grant) => collectionIdInSpace({ target: grant.target, spaceUrl }) === INBOX_COLLECTION;
354
+ const consentStamps = new Set(grants
355
+ .filter(grant => isInboxPostTarget(grant) &&
356
+ allowsAction({ allowedAction: grant.allowedAction, action: 'POST' }))
357
+ .map(grant => grant.grantedAt));
358
+ return grants.filter(grant => {
359
+ if (!consentStamps.has(grant.grantedAt)) {
360
+ return false;
361
+ }
362
+ const actions = actionsOf(grant);
363
+ if (actions === 'GET HEAD') {
364
+ return (collectionIdInSpace({ target: grant.target, spaceUrl }) !== undefined);
365
+ }
366
+ return actions === 'POST' && isInboxPostTarget(grant);
367
+ });
368
+ }
369
+ /**
370
+ * Whether a grant to an agent is due for renewal. A grant already past its
371
+ * `expires` is not due: it is gone, and a fresh consent replaces it. One
372
+ * inside the renewal window is due (`zcapExpiring`'s polarity). Past that, a
373
+ * grant whose embedded parent is
374
+ * not the generation delegation the account currently points at is dead by
375
+ * replacement and due, while its parent's own signer still stands under
376
+ * `capabilityDelegation`. When that signer has left the document the grant
377
+ * fails its proof check instead and is not due here. A root-anchored grant
378
+ * (no embedded parent) is not due on this axis. The document is consulted
379
+ * for the parent's signer only, since an annex VM that signs the leaf never
380
+ * appears in the account document.
381
+ *
382
+ * @param options {object}
383
+ * @param options.zcap {ConnectionZcap}
384
+ * @param [options.pointedDelegationId] {string} the current generation
385
+ * delegation's id, read from the account pointer's generation log head;
386
+ * undefined when the document points at no generation
387
+ * @param options.doc {PublishedKeyDocument} the locally verified account
388
+ * document
389
+ * @param [options.renewalWindowMs] {number}
390
+ * @param [options.now] {number} epoch milliseconds
391
+ * @returns {boolean}
392
+ */
393
+ export function agentGrantDue({ zcap, pointedDelegationId, doc, renewalWindowMs = AGENT_GRANT_RENEWAL_WINDOW_MS, now = Date.now() }) {
394
+ if (Date.parse(zcap.expires) <= now) {
395
+ return false;
396
+ }
397
+ if (zcapExpiring({ expires: zcap.expires, windowMs: renewalWindowMs, now })) {
398
+ return true;
399
+ }
400
+ const parent = embeddedParentCapability(zcap);
401
+ if (parent === undefined) {
402
+ return false;
403
+ }
404
+ return (parent.id !== pointedDelegationId &&
405
+ !delegationSignerGone({ zcap: parent, doc }));
406
+ }
407
+ /**
408
+ * The unretired agent entries holding at least one grant (through
409
+ * {@link connectionGrants}) a key signed. A root-anchored grant (no embedded
410
+ * parent) counts when its own proof names the key. A grant with an embedded
411
+ * parent counts when the parent's proof names the key, the parent's minter.
412
+ *
413
+ * @param options {object}
414
+ * @param options.entries {ConnectionEntry[]}
415
+ * @param options.keyId {string} a verification-method id in either DID
416
+ * form, or a bare multibase
417
+ * @param options.spaceUrl {string} this Space's container URL
418
+ * @returns {ConnectionEntry[]}
419
+ */
420
+ export function agentConnectionsSignedBy({ entries, keyId, spaceUrl }) {
421
+ const key = vmFragmentOf(keyId) ?? keyId;
422
+ const signedBy = (zcap) => {
423
+ const proofKeyId = delegationProofKeyId(zcap);
424
+ return (proofKeyId !== undefined &&
425
+ (vmFragmentOf(proofKeyId) ?? proofKeyId) === key);
426
+ };
427
+ return entries.filter(entry => entry.kind === 'agent' &&
428
+ entry.retired === undefined &&
429
+ connectionGrants({ entry, spaceUrl }).some(grant => {
430
+ const zcap = grant.zcap;
431
+ const parent = embeddedParentCapability(zcap);
432
+ return signedBy(parent ?? zcap);
433
+ }));
434
+ }
150
435
  //# sourceMappingURL=grants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"grants.js","sourceRoot":"","sources":["../../src/connections/grants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AA8BxC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAAC,EAC9B,MAAM,EACN,QAAQ,EAIT;IACC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,SAAS,CACjB,iDAAiD,QAAQ,IAAI,CAC9D,CAAA;IACH,CAAC;IACD,IAAI,UAAkB,CAAA;IACtB,IAAI,CAAC;QACH,UAAU,GAAG,IAAI,GAAG,CAAC,MAA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MAAM,CACnB,KAAK,CAAC,EAAE,CACN,KAAK,CAAC,IAAI,KAAK,OAAO;QACtB,KAAK,CAAC,OAAO,KAAK,SAAS;QAC3B,gBAAgB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YACjD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAwB,CAAA;YAC3C,MAAM,MAAM,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAA;YAC7C,OAAO,QAAQ,CAAC,MAAM,IAAI,IAAI,CAAC,CAAA;QACjC,CAAC,CAAC,CACL,CAAA;AACH,CAAC"}
@@ -16,9 +16,16 @@
16
16
  * - The grant index the revocation orchestrators share
17
17
  * (`connectionGrants`, `grantTargets`, `splitGrantsByExpiry`,
18
18
  * `grantRecipientKid`), with the reader checks every reader applies.
19
+ * - The agent-connection readers: the received list (`receivedGrants`,
20
+ * `receivedGrantLapsed`, `liveInboxChannel`), the latest grant per scope
21
+ * (`latestGrantsPerScope`), a consent's renewal scope
22
+ * (`renewalScopeGrants`), the renewal predicate (`agentGrantDue`,
23
+ * `AGENT_GRANT_RENEWAL_WINDOW_MS`), and `agentConnectionsSignedBy`.
19
24
  * - The upsert helpers (`recordGrants`, `removeGrants`, `retireConnection`,
20
25
  * `unretireConnection`, `setConnectionLabel`) and their kind refusal
21
- * (`ConnectionKindMismatchError`).
26
+ * (`ConnectionKindMismatchError`), and the agent-connection helpers
27
+ * (`recordReceivedGrants`, `recordRenewedGrants`, `settleOutboxItem`,
28
+ * `pruneSupersededGrants`, `clearReceivedGrants`, `markDeclined`).
22
29
  * - The writer arm: lazy registration (`registerConnectionWriter`), the
23
30
  * pull-path touch (`touchConnectionWriter`), the per-entry sweep
24
31
  * (`sweepConnectionWriters`), and `resolveWriter` for history views.
@@ -26,19 +33,19 @@
26
33
  * and the account document, and `normalizeDisplayName`, the one name rule
27
34
  * every producer writes `name` through.
28
35
  */
29
- export { CONNECTION_ENTRY_VERSION, CONNECTION_KINDS, CONNECTION_WRITER_POLICY, GRANT_KINDS, connectionKindOf, connectionWriterPolicy, grantKindOf, isWritableConnectionEntry, parseConnectionEntry } from './entry.js';
30
- export type { ConnectionEntry, ConnectionGrantRecord, ConnectionKind, ConnectionWriter, ConnectionWriterPolicy, ConnectionZcap, GrantKind } from './entry.js';
31
- export { CONNECTIONS_ID_PREFIX, connectionResourceId } from './resourceId.js';
36
+ export { CONNECTION_ENTRY_VERSION, CONNECTION_KINDS, CONNECTION_SEED_BYTES, CONNECTION_WRITER_POLICY, GRANT_KINDS, RECEIVED_GRANT_KINDS, connectionKindOf, decodeConnectionSeed, connectionWriterPolicy, grantKindOf, isWritableConnectionEntry, parseConnectionEntry } from './entry.js';
37
+ export type { ConnectionEntry, ConnectionGrantRecord, ConnectionKind, ConnectionOutboxItem, ConnectionReceivedGrantRecord, ConnectionWriter, ConnectionWriterPolicy, ConnectionZcap, GrantKind, ReceivedGrantKind } from './entry.js';
38
+ export { CONNECTIONS_ID_PREFIX, connectionResourceId, connectionSeedTag, verifyConnectionSeedTag } from './resourceId.js';
32
39
  export type { ConnectionIdKey } from './resourceId.js';
33
40
  export { wasConnectionsStore } from './store.js';
34
41
  export type { ConnectionsStore, StoredConnection } from './store.js';
35
42
  export { findConnection, readConnections } from './read.js';
36
43
  export type { ConnectionsListing, ReadConnection } from './read.js';
37
- export { collectionIdInSpace, connectionGrants, grantRecipientKid, grantTargets, isTargetInSpace, splitGrantsByExpiry } from './grants.js';
38
- export type { ConnectionGrant } from './grants.js';
39
- export { connectionRecipientKid, signingKeyMultibaseOfDid } from './didKey.js';
44
+ export { AGENT_GRANT_RENEWAL_WINDOW_MS, agentConnectionsSignedBy, agentGrantDue, collectionIdInSpace, connectionGrants, grantRecipientKid, grantTargets, isTargetInSpace, grantScopeKey, latestGrantsPerScope, latestIndexPerScope, liveInboxChannel, receivedGrantLapsed, receivedGrants, renewalScopeGrants, splitGrantsByExpiry } from './grants.js';
45
+ export type { ConnectionGrant, ConnectionReceivedGrant } from './grants.js';
46
+ export { connectionDidKey, connectionRecipientKid, signingKeyMultibaseOfDid } from './didKey.js';
40
47
  export { ConnectionKindMismatchError } from './errors.js';
41
- export { recordGrants, removeGrants, retireConnection, setConnectionLabel, unretireConnection } from './upsert.js';
48
+ export { clearReceivedGrants, markDeclined, pruneSupersededGrants, recordGrants, recordReceivedGrants, recordRenewedGrants, removeGrants, retireConnection, setConnectionLabel, settleOutboxItem, unretireConnection } from './upsert.js';
42
49
  export type { ConnectionWriteOutcome, ConnectionWriteResult } from './upsert.js';
43
50
  export { registerConnectionWriter, resolveWriter, sweepConnectionWriters, touchConnectionWriter } from './writers.js';
44
51
  export type { ConnectionWritersSweep, ResolvedWriter, WriterFirstSeenRecord, WriterFirstSeenStore, WriterRegistrationOutcome, WriterTouchOutcome } from './writers.js';