@interop/wallet-core 0.101.0 → 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.
- package/README.md +35 -19
- package/dist/audiences/audienceGrant.d.ts +49 -0
- package/dist/audiences/audienceGrant.d.ts.map +1 -0
- package/dist/audiences/audienceGrant.js +46 -0
- package/dist/audiences/audienceGrant.js.map +1 -0
- package/dist/audiences/index.d.ts +10 -0
- package/dist/audiences/index.d.ts.map +1 -0
- package/dist/audiences/index.js +10 -0
- package/dist/audiences/index.js.map +1 -0
- package/dist/clientAnnex/gc.d.ts +107 -25
- package/dist/clientAnnex/gc.d.ts.map +1 -1
- package/dist/clientAnnex/gc.js +258 -89
- package/dist/clientAnnex/gc.js.map +1 -1
- package/dist/clientAnnex/grantRevocation.d.ts +0 -10
- package/dist/clientAnnex/grantRevocation.d.ts.map +1 -1
- package/dist/clientAnnex/grantRevocation.js +1 -23
- package/dist/clientAnnex/grantRevocation.js.map +1 -1
- package/dist/clientAnnex/heal.d.ts +32 -0
- package/dist/clientAnnex/heal.d.ts.map +1 -1
- package/dist/clientAnnex/heal.js +52 -50
- package/dist/clientAnnex/heal.js.map +1 -1
- package/dist/clientAnnex/index.d.ts +2 -2
- package/dist/clientAnnex/index.d.ts.map +1 -1
- package/dist/clientAnnex/index.js +2 -2
- package/dist/clientAnnex/index.js.map +1 -1
- package/dist/clientAnnex/log.d.ts +20 -2
- package/dist/clientAnnex/log.d.ts.map +1 -1
- package/dist/clientAnnex/log.js +30 -4
- package/dist/clientAnnex/log.js.map +1 -1
- package/dist/clients/rosterPolicy.d.ts.map +1 -1
- package/dist/clients/rosterPolicy.js +3 -1
- package/dist/clients/rosterPolicy.js.map +1 -1
- package/dist/connections/didKey.d.ts +27 -0
- package/dist/connections/didKey.d.ts.map +1 -1
- package/dist/connections/didKey.js +42 -6
- package/dist/connections/didKey.js.map +1 -1
- package/dist/connections/entry.d.ts +95 -13
- package/dist/connections/entry.d.ts.map +1 -1
- package/dist/connections/entry.js +102 -16
- package/dist/connections/entry.js.map +1 -1
- package/dist/connections/grants.d.ts +225 -3
- package/dist/connections/grants.d.ts.map +1 -1
- package/dist/connections/grants.js +293 -8
- package/dist/connections/grants.js.map +1 -1
- package/dist/connections/index.d.ts +15 -8
- package/dist/connections/index.d.ts.map +1 -1
- package/dist/connections/index.js +13 -6
- package/dist/connections/index.js.map +1 -1
- package/dist/connections/read.d.ts.map +1 -1
- package/dist/connections/read.js +2 -1
- package/dist/connections/read.js.map +1 -1
- package/dist/connections/resourceId.d.ts +33 -0
- package/dist/connections/resourceId.d.ts.map +1 -1
- package/dist/connections/resourceId.js +88 -8
- package/dist/connections/resourceId.js.map +1 -1
- package/dist/connections/upsert.d.ts +219 -7
- package/dist/connections/upsert.d.ts.map +1 -1
- package/dist/connections/upsert.js +628 -41
- package/dist/connections/upsert.js.map +1 -1
- package/dist/connections/writers.js +2 -1
- package/dist/connections/writers.js.map +1 -1
- package/dist/descriptors/index.d.ts +5 -0
- package/dist/descriptors/index.d.ts.map +1 -1
- package/dist/descriptors/index.js +5 -0
- package/dist/descriptors/index.js.map +1 -1
- package/dist/descriptors/logSource.d.ts +9 -4
- package/dist/descriptors/logSource.d.ts.map +1 -1
- package/dist/descriptors/logSource.js +13 -6
- package/dist/descriptors/logSource.js.map +1 -1
- package/dist/jsonObject.d.ts +16 -0
- package/dist/jsonObject.d.ts.map +1 -0
- package/dist/jsonObject.js +18 -0
- package/dist/jsonObject.js.map +1 -0
- package/dist/keys/index.d.ts +13 -9
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +11 -7
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/userKeyCascade.d.ts +46 -0
- package/dist/keys/userKeyCascade.d.ts.map +1 -1
- package/dist/keys/userKeyCascade.js +153 -65
- package/dist/keys/userKeyCascade.js.map +1 -1
- package/dist/keys/userKeyRoster.d.ts +60 -7
- package/dist/keys/userKeyRoster.d.ts.map +1 -1
- package/dist/keys/userKeyRoster.js +165 -47
- package/dist/keys/userKeyRoster.js.map +1 -1
- package/dist/keys/userKeyRosterCascade.d.ts.map +1 -1
- package/dist/keys/userKeyRosterCascade.js +1 -0
- package/dist/keys/userKeyRosterCascade.js.map +1 -1
- package/dist/menders/ids.d.ts +1 -1
- package/dist/menders/ids.d.ts.map +1 -1
- package/dist/menders/ids.js +20 -4
- package/dist/menders/ids.js.map +1 -1
- package/dist/space/collections.d.ts +26 -6
- package/dist/space/collections.d.ts.map +1 -1
- package/dist/space/collections.js +31 -7
- package/dist/space/collections.js.map +1 -1
- package/dist/space/inboxMessage.d.ts +47 -0
- package/dist/space/inboxMessage.d.ts.map +1 -0
- package/dist/space/inboxMessage.js +86 -0
- package/dist/space/inboxMessage.js.map +1 -0
- package/dist/space/index.d.ts +7 -2
- package/dist/space/index.d.ts.map +1 -1
- package/dist/space/index.js +6 -2
- package/dist/space/index.js.map +1 -1
- package/dist/sync/contactsConflict.d.ts +23 -10
- package/dist/sync/contactsConflict.d.ts.map +1 -1
- package/dist/sync/contactsConflict.js +40 -21
- package/dist/sync/contactsConflict.js.map +1 -1
- package/dist/sync/index.d.ts +2 -2
- package/dist/sync/index.js +2 -2
- package/dist/webvh/didWebProjection.d.ts +38 -5
- package/dist/webvh/didWebProjection.d.ts.map +1 -1
- package/dist/webvh/didWebProjection.js +35 -22
- package/dist/webvh/didWebProjection.js.map +1 -1
- package/dist/webvh/index.d.ts +4 -3
- package/dist/webvh/index.d.ts.map +1 -1
- package/dist/webvh/index.js +4 -3
- package/dist/webvh/index.js.map +1 -1
- package/dist/webvh/standingZcap.d.ts +19 -2
- package/dist/webvh/standingZcap.d.ts.map +1 -1
- package/dist/webvh/standingZcap.js +31 -3
- package/dist/webvh/standingZcap.js.map +1 -1
- package/package.json +12 -6
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
* its writer, so the storage host can plant one. The grant checks in
|
|
20
20
|
* `grants.ts` bound what a planted grant can steer.
|
|
21
21
|
*/
|
|
22
|
+
import { base64urlnopad } from '@scure/base';
|
|
23
|
+
import { isJsonObject } from '../jsonObject.js';
|
|
22
24
|
import { normalizeDisplayName } from '../labelText.js';
|
|
23
25
|
/**
|
|
24
26
|
* The entry version this build reads for writing and writes.
|
|
@@ -40,6 +42,19 @@ export const CONNECTION_KINDS = [
|
|
|
40
42
|
* capability. A reader treats any other stored value as a plain grant.
|
|
41
43
|
*/
|
|
42
44
|
export const GRANT_KINDS = ['grant', 'share'];
|
|
45
|
+
/**
|
|
46
|
+
* The `grantKind` vocabulary of `grantsReceived`, the capabilities a party
|
|
47
|
+
* handed the wallet: `'inbox'` is the party's POST capability on its own
|
|
48
|
+
* inbox, the channel a push goes through. An unknown stored value is kept as
|
|
49
|
+
* stored.
|
|
50
|
+
*/
|
|
51
|
+
export const RECEIVED_GRANT_KINDS = ['inbox'];
|
|
52
|
+
/**
|
|
53
|
+
* The byte length of the pairwise seed, and the length of its base64url
|
|
54
|
+
* no-pad text.
|
|
55
|
+
*/
|
|
56
|
+
export const CONNECTION_SEED_BYTES = 32;
|
|
57
|
+
const CONNECTION_SEED_TEXT_LENGTH = 43;
|
|
43
58
|
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
44
59
|
/**
|
|
45
60
|
* The writer policy: inactive after 90 days, at most 8 writers per entry,
|
|
@@ -103,6 +118,8 @@ export function newConnectionEntry({ kind, did, now }) {
|
|
|
103
118
|
firstSeen: stamp,
|
|
104
119
|
lastSeen: stamp,
|
|
105
120
|
grants: [],
|
|
121
|
+
grantsReceived: [],
|
|
122
|
+
outbox: [],
|
|
106
123
|
writers: []
|
|
107
124
|
};
|
|
108
125
|
}
|
|
@@ -116,15 +133,6 @@ export function newConnectionEntry({ kind, did, now }) {
|
|
|
116
133
|
export function isWritableConnectionEntry(entry) {
|
|
117
134
|
return entry.version === CONNECTION_ENTRY_VERSION;
|
|
118
135
|
}
|
|
119
|
-
/**
|
|
120
|
-
* Whether a value is a plain JSON object (not null, not an array).
|
|
121
|
-
*
|
|
122
|
-
* @param value {unknown}
|
|
123
|
-
* @returns {boolean}
|
|
124
|
-
*/
|
|
125
|
-
export function isJsonObject(value) {
|
|
126
|
-
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
127
|
-
}
|
|
128
136
|
/**
|
|
129
137
|
* Whether a value is a string `Date.parse` reads as a time.
|
|
130
138
|
*
|
|
@@ -145,7 +153,8 @@ function isOptionalString(value) {
|
|
|
145
153
|
}
|
|
146
154
|
/**
|
|
147
155
|
* Reads a stored capability's known members, or `undefined` when one of them
|
|
148
|
-
* has the wrong shape. The capability itself is
|
|
156
|
+
* has the wrong shape or `expires` is absent. The capability itself is
|
|
157
|
+
* returned verbatim.
|
|
149
158
|
*
|
|
150
159
|
* @param value {unknown}
|
|
151
160
|
* @returns {ConnectionZcap | undefined}
|
|
@@ -163,7 +172,7 @@ export function parseConnectionZcap(value) {
|
|
|
163
172
|
typeof allowedAction !== 'string' &&
|
|
164
173
|
!(Array.isArray(allowedAction) &&
|
|
165
174
|
allowedAction.every(action => typeof action === 'string'))) ||
|
|
166
|
-
|
|
175
|
+
!isTimestamp(expires)) {
|
|
167
176
|
return undefined;
|
|
168
177
|
}
|
|
169
178
|
return value;
|
|
@@ -181,11 +190,70 @@ function parseGrantRecord(value) {
|
|
|
181
190
|
}
|
|
182
191
|
if (parseConnectionZcap(value.zcap) === undefined ||
|
|
183
192
|
typeof value.grantKind !== 'string' ||
|
|
184
|
-
!isTimestamp(value.grantedAt)
|
|
193
|
+
!isTimestamp(value.grantedAt) ||
|
|
194
|
+
(value.renewedAt !== undefined && !isTimestamp(value.renewedAt))) {
|
|
195
|
+
return undefined;
|
|
196
|
+
}
|
|
197
|
+
return value;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Reads one stored received-grant wrapper, or `undefined` when a known
|
|
201
|
+
* member has the wrong shape. The wrapper is returned verbatim, unknown
|
|
202
|
+
* members included.
|
|
203
|
+
*
|
|
204
|
+
* @param value {unknown}
|
|
205
|
+
* @returns {ConnectionReceivedGrantRecord | undefined}
|
|
206
|
+
*/
|
|
207
|
+
function parseReceivedGrantRecord(value) {
|
|
208
|
+
if (!isJsonObject(value)) {
|
|
209
|
+
return undefined;
|
|
210
|
+
}
|
|
211
|
+
if (parseConnectionZcap(value.zcap) === undefined ||
|
|
212
|
+
typeof value.grantKind !== 'string' ||
|
|
213
|
+
!isTimestamp(value.receivedAt)) {
|
|
214
|
+
return undefined;
|
|
215
|
+
}
|
|
216
|
+
return value;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Reads one stored outbox item, or `undefined` when a known member has the
|
|
220
|
+
* wrong shape: `message` must be a JSON object and `createdAt` a timestamp.
|
|
221
|
+
* The item is returned verbatim.
|
|
222
|
+
*
|
|
223
|
+
* @param value {unknown}
|
|
224
|
+
* @returns {ConnectionOutboxItem | undefined}
|
|
225
|
+
*/
|
|
226
|
+
function parseOutboxItem(value) {
|
|
227
|
+
if (!isJsonObject(value)) {
|
|
228
|
+
return undefined;
|
|
229
|
+
}
|
|
230
|
+
if (!isJsonObject(value.message) || !isTimestamp(value.createdAt)) {
|
|
185
231
|
return undefined;
|
|
186
232
|
}
|
|
187
233
|
return value;
|
|
188
234
|
}
|
|
235
|
+
/**
|
|
236
|
+
* The seed bytes a stored `seed` member decodes to, or `undefined` when it
|
|
237
|
+
* is not 43 characters of base64url with no padding decoding to 32 bytes.
|
|
238
|
+
* The same rule reads a stored `seedTag`, which has the same length.
|
|
239
|
+
*
|
|
240
|
+
* @param value {unknown}
|
|
241
|
+
* @returns {Uint8Array | undefined}
|
|
242
|
+
*/
|
|
243
|
+
export function decodeConnectionSeed(value) {
|
|
244
|
+
if (typeof value !== 'string' ||
|
|
245
|
+
value.length !== CONNECTION_SEED_TEXT_LENGTH) {
|
|
246
|
+
return undefined;
|
|
247
|
+
}
|
|
248
|
+
let bytes;
|
|
249
|
+
try {
|
|
250
|
+
bytes = base64urlnopad.decode(value);
|
|
251
|
+
}
|
|
252
|
+
catch {
|
|
253
|
+
return undefined;
|
|
254
|
+
}
|
|
255
|
+
return bytes.length === CONNECTION_SEED_BYTES ? bytes : undefined;
|
|
256
|
+
}
|
|
189
257
|
/**
|
|
190
258
|
* Reads one stored writer member, or `undefined` when a known member has the
|
|
191
259
|
* wrong shape. The member is returned verbatim, unknown members included.
|
|
@@ -217,9 +285,12 @@ function parseWriter(value) {
|
|
|
217
285
|
* is not a DID, a `name`, `label`, or writer `label` outside the display-name
|
|
218
286
|
* rule (1 to 64 code points once the control and bidi characters are stripped
|
|
219
287
|
* and the result trimmed), a timestamp `Date.parse` cannot read, a malformed
|
|
220
|
-
* grant wrapper
|
|
221
|
-
*
|
|
222
|
-
*
|
|
288
|
+
* grant wrapper, received-grant wrapper, outbox item, or writer member, a
|
|
289
|
+
* `seed` or `seedTag` that is not 43 characters of base64url decoding to 32
|
|
290
|
+
* bytes, a `seed` with no `seedTag` (or the reverse), or no `id` beside
|
|
291
|
+
* anything but exactly one writer. Every display string a view renders is
|
|
292
|
+
* held to that one rule. An absent `grantsReceived` or `outbox` (a body an
|
|
293
|
+
* older build wrote) reads as empty. Unknown members are ignored. A body with a `version` above this build's
|
|
223
294
|
* that passes every check is returned for display;
|
|
224
295
|
* {@link isWritableConnectionEntry} says it cannot be written.
|
|
225
296
|
*
|
|
@@ -234,7 +305,7 @@ export function parseConnectionEntry(body) {
|
|
|
234
305
|
if (!isJsonObject(body)) {
|
|
235
306
|
return undefined;
|
|
236
307
|
}
|
|
237
|
-
const { version, kind, id, name, label, origin, url, appKey, firstSeen, lastSeen, retired, grants, writers } = body;
|
|
308
|
+
const { version, kind, id, name, label, origin, url, appKey, firstSeen, lastSeen, retired, declined, seed, seedTag, grants, grantsReceived, outbox, writers } = body;
|
|
238
309
|
if (typeof version !== 'number' ||
|
|
239
310
|
!Number.isInteger(version) ||
|
|
240
311
|
version < 1 ||
|
|
@@ -249,7 +320,13 @@ export function parseConnectionEntry(body) {
|
|
|
249
320
|
!isTimestamp(firstSeen) ||
|
|
250
321
|
!isTimestamp(lastSeen) ||
|
|
251
322
|
(retired !== undefined && !isTimestamp(retired)) ||
|
|
323
|
+
(declined !== undefined && !isTimestamp(declined)) ||
|
|
324
|
+
(seed !== undefined && decodeConnectionSeed(seed) === undefined) ||
|
|
325
|
+
(seedTag !== undefined && decodeConnectionSeed(seedTag) === undefined) ||
|
|
326
|
+
(seed === undefined) !== (seedTag === undefined) ||
|
|
252
327
|
!Array.isArray(grants) ||
|
|
328
|
+
(grantsReceived !== undefined && !Array.isArray(grantsReceived)) ||
|
|
329
|
+
(outbox !== undefined && !Array.isArray(outbox)) ||
|
|
253
330
|
!Array.isArray(writers)) {
|
|
254
331
|
return undefined;
|
|
255
332
|
}
|
|
@@ -260,8 +337,12 @@ export function parseConnectionEntry(body) {
|
|
|
260
337
|
return undefined;
|
|
261
338
|
}
|
|
262
339
|
const parsedGrants = grants.map(parseGrantRecord);
|
|
340
|
+
const parsedReceived = (grantsReceived ?? []).map(parseReceivedGrantRecord);
|
|
341
|
+
const parsedOutbox = (outbox ?? []).map(parseOutboxItem);
|
|
263
342
|
const parsedWriters = writers.map(parseWriter);
|
|
264
343
|
if (parsedGrants.some(grant => grant === undefined) ||
|
|
344
|
+
parsedReceived.some(grant => grant === undefined) ||
|
|
345
|
+
parsedOutbox.some(item => item === undefined) ||
|
|
265
346
|
parsedWriters.some(writer => writer === undefined)) {
|
|
266
347
|
return undefined;
|
|
267
348
|
}
|
|
@@ -280,7 +361,12 @@ export function parseConnectionEntry(body) {
|
|
|
280
361
|
firstSeen,
|
|
281
362
|
lastSeen,
|
|
282
363
|
...(retired !== undefined && { retired }),
|
|
364
|
+
...(declined !== undefined && { declined }),
|
|
365
|
+
...(seed !== undefined && { seed: seed }),
|
|
366
|
+
...(seedTag !== undefined && { seedTag: seedTag }),
|
|
283
367
|
grants: parsedGrants,
|
|
368
|
+
grantsReceived: parsedReceived,
|
|
369
|
+
outbox: parsedOutbox,
|
|
284
370
|
writers: parsedWriters
|
|
285
371
|
};
|
|
286
372
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.js","sourceRoot":"","sources":["../../src/connections/entry.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAEtD;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAA;AAEzC;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,KAAK;IACL,OAAO;IACP,eAAe;IACf,SAAS;CACD,CAAA;AAOV;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,OAAO,CAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"entry.js","sourceRoot":"","sources":["../../src/connections/entry.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAEtD;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAA;AAEzC;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,KAAK;IACL,OAAO;IACP,eAAe;IACf,SAAS;CACD,CAAA;AAOV;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,OAAO,CAAU,CAAA;AAOtD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAO,CAAU,CAAA;AAOtD;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAA;AACvC,MAAM,2BAA2B,GAAG,EAAE,CAAA;AAgKtC,MAAM,MAAM,GAAG,EAAE,GAAG,E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C;QACnD,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,OAAO;QACL,OAAO;QACP,IAAI;QACJ,GAAG,CAAC,EAAE,KAAK,SAAS,IAAI,EAAE,EAAE,EAAE,CAAC;QAC/B,GAAG,CAAC,cAAc,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;QAC7D,GAAG,CAAC,eAAe,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC;QAChE,GAAG,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,CAAC;QACvC,GAAG,CAAC,GAAG,KAAK,SAAS,IAAI,EAAE,GAAG,EAAE,CAAC;QACjC,GAAG,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,CAAC;QACvC,SAAS;QACT,QAAQ;QACR,GAAG,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,CAAC;QACzC,GAAG,CAAC,QAAQ,KAAK,SAAS,IAAI,EAAE,QAAQ,EAAE,CAAC;QAC3C,GAAG,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,IAAc,EAAE,CAAC;QACnD,GAAG,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,OAAiB,EAAE,CAAC;QAC5D,MAAM,EAAE,YAAuC;QAC/C,cAAc,EAAE,cAAiD;QACjE,MAAM,EAAE,YAAsC;QAC9C,OAAO,EAAE,aAAmC;KAC7C,CAAA;AACH,CAAC"}
|
|
@@ -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
|
|
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
|
|
87
|
-
*
|
|
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":"
|
|
1
|
+
{"version":3,"file":"grants.d.ts","sourceRoot":"","sources":["../../src/connections/grants.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;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