@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
|
@@ -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
|
-
|
|
66
|
-
|
|
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
|
|
118
|
-
*
|
|
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
|
|
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
|
|
1
|
+
{"version":3,"file":"grants.js","sourceRoot":"","sources":["../../src/connections/grants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EACxB,YAAY,EACb,MAAM,mBAAmB,CAAA;AAG1B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;AA6BrE;;;;;;;;;;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,MAAM,CAAC,CAAC,IAAI,CAAA;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,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KAAK,GAAG,CACjD,CAAA;IACH,CAAC,CAAA;IACD,OAAO,OAAO,CAAC,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';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/connections/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/connections/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,qBAAqB,EACrB,wBAAwB,EACxB,WAAW,E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EAChB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,aAAa,CAAA;AACpB,YAAY,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAChF,OAAO,EACL,wBAAwB,EACxB,aAAa,EACb,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,cAAc,CAAA;AACrB,YAAY,EACV,sBAAsB,EACtB,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA"}
|
|
@@ -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,14 +33,14 @@
|
|
|
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 { 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 { CONNECTIONS_ID_PREFIX, connectionResourceId, connectionSeedTag, verifyConnectionSeedTag } from './resourceId.js';
|
|
31
38
|
export { wasConnectionsStore } from './store.js';
|
|
32
39
|
export { findConnection, readConnections } from './read.js';
|
|
33
|
-
export { collectionIdInSpace, connectionGrants, grantRecipientKid, grantTargets, isTargetInSpace, splitGrantsByExpiry } from './grants.js';
|
|
34
|
-
export { connectionRecipientKid, signingKeyMultibaseOfDid } from './didKey.js';
|
|
40
|
+
export { AGENT_GRANT_RENEWAL_WINDOW_MS, agentConnectionsSignedBy, agentGrantDue, collectionIdInSpace, connectionGrants, grantRecipientKid, grantTargets, isTargetInSpace, grantScopeKey, latestGrantsPerScope, latestIndexPerScope, liveInboxChannel, receivedGrantLapsed, receivedGrants, renewalScopeGrants, splitGrantsByExpiry } from './grants.js';
|
|
41
|
+
export { connectionDidKey, connectionRecipientKid, signingKeyMultibaseOfDid } from './didKey.js';
|
|
35
42
|
export { ConnectionKindMismatchError } from './errors.js';
|
|
36
|
-
export { recordGrants, removeGrants, retireConnection, setConnectionLabel, unretireConnection } from './upsert.js';
|
|
43
|
+
export { clearReceivedGrants, markDeclined, pruneSupersededGrants, recordGrants, recordReceivedGrants, recordRenewedGrants, removeGrants, retireConnection, setConnectionLabel, settleOutboxItem, unretireConnection } from './upsert.js';
|
|
37
44
|
export { registerConnectionWriter, resolveWriter, sweepConnectionWriters, touchConnectionWriter } from './writers.js';
|
|
38
45
|
export { normalizeDisplayName } from '../labelText.js';
|
|
39
46
|
export { CONNECTIONS_COLLECTION } from '../space/collections.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/connections/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/connections/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,qBAAqB,EACrB,wBAAwB,EACxB,WAAW,EACX,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,WAAW,EACX,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,YAAY,CAAA;AAanB,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACxB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAEhD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAE3D,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,EACxB,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,wBAAwB,EACzB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,qBAAqB,EACrB,YAAY,EACZ,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,wBAAwB,EACxB,aAAa,EACb,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,cAAc,CAAA;AASrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/connections/read.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/connections/read.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,KAAK,EAAE,eAAe,CAAA;IACtB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC9B;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,OAAO,EAAE,cAAc,EAAE,CAAA;IACzB;;;OAGG;IACH,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB;;;OAGG;IACH,WAAW,EAAE,MAAM,EAAE,CAAA;CACtB;AAED;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,IAAI,EACJ,OAAO,EACR,EAAE;IACD,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,eAAe,CAAA;CACzB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAe9B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CAAC,EACpC,KAAK,EACL,OAAO,EACR,EAAE;IACD,KAAK,EAAE,gBAAgB,CAAA;IACvB,OAAO,EAAE,eAAe,CAAA;CACzB,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAwCrC;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,GAAG,EACJ,EAAE;IACD,OAAO,EAAE,kBAAkB,CAAA;IAC3B,GAAG,EAAE,MAAM,CAAA;CACZ,GAAG,cAAc,GAAG,SAAS,CAE7B"}
|
package/dist/connections/read.js
CHANGED
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* derives to just to look the party up, since the host would then learn which
|
|
11
11
|
* id belongs to which DID and whether that DID has an entry.
|
|
12
12
|
*/
|
|
13
|
-
import { isJsonObject
|
|
13
|
+
import { isJsonObject } from '../jsonObject.js';
|
|
14
|
+
import { parseConnectionEntry } from './entry.js';
|
|
14
15
|
import { connectionResourceId } from './resourceId.js';
|
|
15
16
|
/**
|
|
16
17
|
* The resource id a stored body claims by its own members: its `id`, or its
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../src/connections/read.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;GAQG;AACH,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../src/connections/read.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH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;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,EAC7B,OAAO,EACP,GAAG,EAIJ;IACC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,CAAC,CAAA;AAC5D,CAAC"}
|
|
@@ -33,4 +33,37 @@ export declare function connectionResourceId(options: {
|
|
|
33
33
|
writerId: string;
|
|
34
34
|
did?: undefined;
|
|
35
35
|
}): Promise<string>;
|
|
36
|
+
/**
|
|
37
|
+
* The tag an entry stores beside its pairwise `seed`: {@link seedTagBytes}
|
|
38
|
+
* in the seed's own encoding. A seed that is not 32 bytes of base64url is
|
|
39
|
+
* refused with a `TypeError`.
|
|
40
|
+
*
|
|
41
|
+
* @param options {object}
|
|
42
|
+
* @param options.hmacKey {ConnectionIdKey} the collection's blinded-index
|
|
43
|
+
* key
|
|
44
|
+
* @param options.seed {string} the seed, base64url with no padding
|
|
45
|
+
* @returns {Promise<string>}
|
|
46
|
+
*/
|
|
47
|
+
export declare function connectionSeedTag({ hmacKey, seed }: {
|
|
48
|
+
hmacKey: ConnectionIdKey;
|
|
49
|
+
seed: string;
|
|
50
|
+
}): Promise<string>;
|
|
51
|
+
/**
|
|
52
|
+
* Whether a stored `seedTag` is the tag of a stored `seed` under this
|
|
53
|
+
* directory's blinded-index key. A malformed seed or tag reads as `false`.
|
|
54
|
+
* Every site that turns a seed into a key asks this first and fails closed
|
|
55
|
+
* on `false`.
|
|
56
|
+
*
|
|
57
|
+
* @param options {object}
|
|
58
|
+
* @param options.hmacKey {ConnectionIdKey} the collection's blinded-index
|
|
59
|
+
* key
|
|
60
|
+
* @param options.seed {string} the stored seed
|
|
61
|
+
* @param options.seedTag {string} the stored tag
|
|
62
|
+
* @returns {Promise<boolean>}
|
|
63
|
+
*/
|
|
64
|
+
export declare function verifyConnectionSeedTag({ hmacKey, seed, seedTag }: {
|
|
65
|
+
hmacKey: ConnectionIdKey;
|
|
66
|
+
seed: string;
|
|
67
|
+
seedTag: string;
|
|
68
|
+
}): Promise<boolean>;
|
|
36
69
|
//# sourceMappingURL=resourceId.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resourceId.d.ts","sourceRoot":"","sources":["../../src/connections/resourceId.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resourceId.d.ts","sourceRoot":"","sources":["../../src/connections/resourceId.ts"],"names":[],"mappings":"AAmCA;;GAEG;AACH,eAAO,MAAM,qBAAqB,mBAAmB,CAAA;AAErD;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GACzB,UAAU,GAAG;IAAE,IAAI,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;CAAE,CAAA;AAsB3E;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EACH;IAAE,OAAO,EAAE,eAAe,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,GAC/D;IAAE,OAAO,EAAE,eAAe,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,SAAS,CAAA;CAAE,GAClE,OAAO,CAAC,MAAM,CAAC,CAWjB;AAyBD;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,IAAI,EACL,EAAE;IACD,OAAO,EAAE,eAAe,CAAA;IACxB,IAAI,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAAC,MAAM,CAAC,CASlB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,uBAAuB,CAAC,EAC5C,OAAO,EACP,IAAI,EACJ,OAAO,EACR,EAAE;IACD,OAAO,EAAE,eAAe,CAAA;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB,GAAG,OAAO,CAAC,OAAO,CAAC,CAOnB"}
|