@interop/wallet-core 0.93.0 → 0.95.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 +21 -20
- package/dist/clientAnnex/mend.js +4 -1
- package/dist/clientAnnex/mend.js.map +1 -1
- package/dist/clients/index.d.ts +3 -2
- package/dist/clients/index.d.ts.map +1 -1
- package/dist/clients/index.js +3 -2
- package/dist/clients/index.js.map +1 -1
- package/dist/clients/listing.d.ts +19 -12
- package/dist/clients/listing.d.ts.map +1 -1
- package/dist/clients/listing.js +69 -22
- package/dist/clients/listing.js.map +1 -1
- package/dist/connections/didKey.d.ts +25 -0
- package/dist/connections/didKey.d.ts.map +1 -0
- package/dist/connections/didKey.js +49 -0
- package/dist/connections/didKey.js.map +1 -0
- package/dist/connections/entry.d.ts +226 -0
- package/dist/connections/entry.d.ts.map +1 -0
- package/dist/connections/entry.js +287 -0
- package/dist/connections/entry.js.map +1 -0
- package/dist/connections/errors.d.ts +33 -0
- package/dist/connections/errors.d.ts.map +1 -0
- package/dist/connections/errors.js +36 -0
- package/dist/connections/errors.js.map +1 -0
- package/dist/connections/grants.d.ts +94 -0
- package/dist/connections/grants.d.ts.map +1 -0
- package/dist/connections/grants.js +120 -0
- package/dist/connections/grants.js.map +1 -0
- package/dist/connections/index.d.ts +47 -0
- package/dist/connections/index.d.ts.map +1 -0
- package/dist/connections/index.js +40 -0
- package/dist/connections/index.js.map +1 -0
- package/dist/connections/read.d.ts +82 -0
- package/dist/connections/read.d.ts.map +1 -0
- package/dist/connections/read.js +100 -0
- package/dist/connections/read.js.map +1 -0
- package/dist/connections/resourceId.d.ts +36 -0
- package/dist/connections/resourceId.d.ts.map +1 -0
- package/dist/connections/resourceId.js +49 -0
- package/dist/connections/resourceId.js.map +1 -0
- package/dist/connections/store.d.ts +103 -0
- package/dist/connections/store.d.ts.map +1 -0
- package/dist/connections/store.js +67 -0
- package/dist/connections/store.js.map +1 -0
- package/dist/connections/upsert.d.ts +214 -0
- package/dist/connections/upsert.d.ts.map +1 -0
- package/dist/connections/upsert.js +468 -0
- package/dist/connections/upsert.js.map +1 -0
- package/dist/connections/writers.d.ts +217 -0
- package/dist/connections/writers.d.ts.map +1 -0
- package/dist/connections/writers.js +485 -0
- package/dist/connections/writers.js.map +1 -0
- package/dist/enrollment/onboardingResponse.d.ts +3 -3
- package/dist/enrollment/onboardingResponse.d.ts.map +1 -1
- package/dist/enrollment/onboardingResponse.js +17 -13
- package/dist/enrollment/onboardingResponse.js.map +1 -1
- package/dist/keys/index.d.ts +0 -7
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +0 -6
- package/dist/keys/index.js.map +1 -1
- package/dist/labelText.d.ts +30 -3
- package/dist/labelText.d.ts.map +1 -1
- package/dist/labelText.js +35 -3
- package/dist/labelText.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 +7 -2
- package/dist/menders/ids.js.map +1 -1
- package/dist/space/collections.d.ts +28 -25
- package/dist/space/collections.d.ts.map +1 -1
- package/dist/space/collections.js +46 -40
- package/dist/space/collections.js.map +1 -1
- package/dist/space/index.d.ts +4 -3
- package/dist/space/index.d.ts.map +1 -1
- package/dist/space/index.js +4 -3
- package/dist/space/index.js.map +1 -1
- package/package.json +8 -8
- package/dist/keys/clientLabels.d.ts +0 -85
- package/dist/keys/clientLabels.d.ts.map +0 -1
- package/dist/keys/clientLabels.js +0 -96
- package/dist/keys/clientLabels.js.map +0 -1
- package/dist/keys/wasLabelsStore.d.ts +0 -33
- package/dist/keys/wasLabelsStore.d.ts.map +0 -1
- package/dist/keys/wasLabelsStore.js +0 -35
- package/dist/keys/wasLabelsStore.js.map +0 -1
- package/dist/writers/entry.d.ts +0 -95
- package/dist/writers/entry.d.ts.map +0 -1
- package/dist/writers/entry.js +0 -90
- package/dist/writers/entry.js.map +0 -1
- package/dist/writers/index.d.ts +0 -17
- package/dist/writers/index.d.ts.map +0 -1
- package/dist/writers/index.js +0 -14
- package/dist/writers/index.js.map +0 -1
- package/dist/writers/roster.d.ts +0 -152
- package/dist/writers/roster.d.ts.map +0 -1
- package/dist/writers/roster.js +0 -365
- package/dist/writers/roster.js.map +0 -1
- package/dist/writers/store.d.ts +0 -71
- package/dist/writers/store.d.ts.map +0 -1
- package/dist/writers/store.js +0 -55
- package/dist/writers/store.js.map +0 -1
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The directory's writer arm: the `writers` list on a wallet client's entry,
|
|
6
|
+
* one member per `writerId` the client has written under. Lazy registration
|
|
7
|
+
* with its throttled liveness touch, the pull-path touch, the per-entry sweep
|
|
8
|
+
* with its two-phase expiry, and the join a history view resolves a
|
|
9
|
+
* revision's `writerId` through.
|
|
10
|
+
*
|
|
11
|
+
* Orphaning is a writer's normal end: a cleared browser profile cannot
|
|
12
|
+
* deregister. So no cleanup here depends on the dying writer. Any replica
|
|
13
|
+
* that reads the directory sweeps it, every sweep write is conditional on the
|
|
14
|
+
* ETag it read, and a lost race is skipped, so concurrent sweepers converge.
|
|
15
|
+
* Registration waits until the writer is encountered in a second session
|
|
16
|
+
* under the same account, which keeps one-shot writers (an incognito window,
|
|
17
|
+
* a cleared profile) off the entry altogether.
|
|
18
|
+
*
|
|
19
|
+
* Every field is advisory display data. A pulled revision's `writerId` is
|
|
20
|
+
* not verified, so a host can replay a registered one and keep its member
|
|
21
|
+
* active. Nothing here is an input to an authorization decision.
|
|
22
|
+
*/
|
|
23
|
+
import { normalizeDisplayName } from '../labelText.js';
|
|
24
|
+
import { signingKeyMultibaseOfDid } from './didKey.js';
|
|
25
|
+
import { connectionWriterPolicy, isJsonObject, isWritableConnectionEntry, newConnectionEntry } from './entry.js';
|
|
26
|
+
import { connectionResourceId } from './resourceId.js';
|
|
27
|
+
import { isLostConnectionRace, writeConnection } from './upsert.js';
|
|
28
|
+
/**
|
|
29
|
+
* A writer member's `lastSeen` as a time no later than `now`. A writer whose
|
|
30
|
+
* clock runs fast would otherwise keep its member newest, ahead of every
|
|
31
|
+
* eviction.
|
|
32
|
+
*
|
|
33
|
+
* @param options {object}
|
|
34
|
+
* @param options.writer {ConnectionWriter}
|
|
35
|
+
* @param options.now {Date}
|
|
36
|
+
* @returns {number}
|
|
37
|
+
*/
|
|
38
|
+
function effectiveLastSeen({ writer, now }) {
|
|
39
|
+
return Math.min(Date.parse(writer.lastSeen), now.getTime());
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Writer members ordered newest-`lastSeen` first, ties broken by `writerId`,
|
|
43
|
+
* so every sweeper drops the same ones.
|
|
44
|
+
*
|
|
45
|
+
* @param options {object}
|
|
46
|
+
* @param options.writers {ConnectionWriter[]}
|
|
47
|
+
* @param options.now {Date}
|
|
48
|
+
* @returns {ConnectionWriter[]}
|
|
49
|
+
*/
|
|
50
|
+
function newestFirst({ writers, now }) {
|
|
51
|
+
return [...writers].sort((left, right) => effectiveLastSeen({ writer: right, now }) -
|
|
52
|
+
effectiveLastSeen({ writer: left, now }) ||
|
|
53
|
+
(left.writerId < right.writerId ? -1 : 1));
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Reads the writer first-seen record, or `undefined` when it is missing or
|
|
57
|
+
* malformed.
|
|
58
|
+
*
|
|
59
|
+
* @param body {unknown}
|
|
60
|
+
* @returns {WriterFirstSeenRecord | undefined}
|
|
61
|
+
*/
|
|
62
|
+
function parseFirstSeenRecord(body) {
|
|
63
|
+
if (!isJsonObject(body)) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
const { accountDid, writerId, firstSessionAt, lastTouchedAt } = body;
|
|
67
|
+
if (typeof accountDid !== 'string' ||
|
|
68
|
+
typeof writerId !== 'string' ||
|
|
69
|
+
typeof firstSessionAt !== 'string' ||
|
|
70
|
+
Number.isNaN(Date.parse(firstSessionAt)) ||
|
|
71
|
+
(lastTouchedAt !== undefined &&
|
|
72
|
+
(typeof lastTouchedAt !== 'string' ||
|
|
73
|
+
Number.isNaN(Date.parse(lastTouchedAt))))) {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
accountDid,
|
|
78
|
+
writerId,
|
|
79
|
+
firstSessionAt,
|
|
80
|
+
...(lastTouchedAt !== undefined && { lastTouchedAt })
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The entry's writers with one member's `lastSeen` moved to `now` and the
|
|
85
|
+
* member marked active.
|
|
86
|
+
*
|
|
87
|
+
* @param options {object}
|
|
88
|
+
* @param options.writers {ConnectionWriter[]}
|
|
89
|
+
* @param options.member {ConnectionWriter} one of `writers`
|
|
90
|
+
* @param options.now {Date}
|
|
91
|
+
* @returns {ConnectionWriter[]}
|
|
92
|
+
*/
|
|
93
|
+
function touchedWriters({ writers, member, now }) {
|
|
94
|
+
const lastSeen = now.toISOString();
|
|
95
|
+
return writers.map(writer => writer === member ? { ...writer, lastSeen, active: true } : writer);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The change {@link registerConnectionWriter} applies: create the entry, or
|
|
99
|
+
* add or touch this client's member, or stop with the outcome that forbids
|
|
100
|
+
* the write. A new member first makes room under the cap, dropping the
|
|
101
|
+
* oldest-`lastSeen` members. `added` says whether the body carries a new
|
|
102
|
+
* member rather than a touched one.
|
|
103
|
+
*
|
|
104
|
+
* @param options {object}
|
|
105
|
+
* @param [options.current] {WritableConnection}
|
|
106
|
+
* @param options.did {string}
|
|
107
|
+
* @param options.writerId {string}
|
|
108
|
+
* @param options.label {string}
|
|
109
|
+
* @param options.listedInDocument {boolean}
|
|
110
|
+
* @param options.now {Date}
|
|
111
|
+
* @param options.policy {ConnectionWriterPolicy}
|
|
112
|
+
* @returns {object}
|
|
113
|
+
*/
|
|
114
|
+
function withOwnWriter({ current, did, writerId, label, listedInDocument, now, policy }) {
|
|
115
|
+
const lastSeen = now.toISOString();
|
|
116
|
+
const ownMember = { writerId, label, lastSeen, active: true };
|
|
117
|
+
if (current === undefined) {
|
|
118
|
+
if (!listedInDocument) {
|
|
119
|
+
return { stop: 'unlisted' };
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
body: {
|
|
123
|
+
...newConnectionEntry({ kind: 'wallet-client', did, now }),
|
|
124
|
+
name: label,
|
|
125
|
+
writers: [ownMember]
|
|
126
|
+
},
|
|
127
|
+
added: true
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
const { entry } = current;
|
|
131
|
+
if (entry.kind !== 'wallet-client') {
|
|
132
|
+
return { stop: 'kind-mismatch' };
|
|
133
|
+
}
|
|
134
|
+
if (entry.retired !== undefined && !listedInDocument) {
|
|
135
|
+
return { stop: 'retired' };
|
|
136
|
+
}
|
|
137
|
+
const existing = entry.writers.find(writer => writer.writerId === writerId);
|
|
138
|
+
let writers;
|
|
139
|
+
if (existing !== undefined) {
|
|
140
|
+
writers = touchedWriters({ writers: entry.writers, member: existing, now });
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
const kept = newestFirst({ writers: entry.writers, now }).slice(0, Math.max(policy.maxWriters - 1, 0));
|
|
144
|
+
writers = [
|
|
145
|
+
...entry.writers.filter(writer => kept.includes(writer)),
|
|
146
|
+
ownMember
|
|
147
|
+
];
|
|
148
|
+
}
|
|
149
|
+
const body = {
|
|
150
|
+
...current.body,
|
|
151
|
+
lastSeen,
|
|
152
|
+
writers
|
|
153
|
+
};
|
|
154
|
+
// A retired entry this client still stands in the document for is a
|
|
155
|
+
// forget torn after its retirement: un-retire it.
|
|
156
|
+
delete body.retired;
|
|
157
|
+
return { body, added: existing === undefined };
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Registers this client's writer on its own `wallet-client` entry once the
|
|
161
|
+
* writer is encountered in a second session under the account, and touches
|
|
162
|
+
* the member's `lastSeen` at most once per touch interval after that. Call it
|
|
163
|
+
* on the wallet's connect or sync path; calls within the interval cost no
|
|
164
|
+
* I/O. The interval runs from the last settled call, whatever its outcome,
|
|
165
|
+
* so an entry this client cannot write (`unlisted`, `retired`,
|
|
166
|
+
* `kind-mismatch`, `refused`) is re-read once per interval and not on every
|
|
167
|
+
* call. Only `raced` leaves the next call to try again at once.
|
|
168
|
+
*
|
|
169
|
+
* An absent entry is created (`kind: 'wallet-client'`, `id` this client's
|
|
170
|
+
* did:key, `name` the platform label), which converges a lost
|
|
171
|
+
* enrollment-time write, but only while the verified account document lists
|
|
172
|
+
* this client. A retired entry is un-retired while the document lists this
|
|
173
|
+
* client (a forget torn after its retirement) and left alone otherwise. A
|
|
174
|
+
* new member first makes room under the per-entry writer cap.
|
|
175
|
+
*
|
|
176
|
+
* @param options {object}
|
|
177
|
+
* @param options.store {ConnectionsStore}
|
|
178
|
+
* @param options.hmacKey {ConnectionIdKey} the collection's blinded-index
|
|
179
|
+
* key
|
|
180
|
+
* @param options.local {WriterFirstSeenStore}
|
|
181
|
+
* @param options.accountDid {string} the account the first-seen record is
|
|
182
|
+
* kept under
|
|
183
|
+
* @param options.did {string} this client's did:key
|
|
184
|
+
* @param options.writerId {string} this client's writer
|
|
185
|
+
* @param options.label {string} the coarse platform self-description a new
|
|
186
|
+
* member (and a new entry's `name`) takes; held to the display-name rule,
|
|
187
|
+
* and refused with a `TypeError` outside it
|
|
188
|
+
* @param options.listedInDocument {boolean} whether the verified account
|
|
189
|
+
* document lists this client
|
|
190
|
+
* @param options.sessionStartedAt {Date} when the current session began; a
|
|
191
|
+
* first-seen record written at or after it is this session's own
|
|
192
|
+
* @param [options.now] {Date}
|
|
193
|
+
* @param [options.policy] {Partial<ConnectionWriterPolicy>}
|
|
194
|
+
* @returns {Promise<WriterRegistrationOutcome>}
|
|
195
|
+
*/
|
|
196
|
+
export async function registerConnectionWriter({ store, hmacKey, local, accountDid, did, writerId, label, listedInDocument, sessionStartedAt, now = new Date(), policy }) {
|
|
197
|
+
const resolved = connectionWriterPolicy(policy);
|
|
198
|
+
const name = normalizeDisplayName({ value: label });
|
|
199
|
+
if (name === undefined) {
|
|
200
|
+
throw new TypeError('A writer label is 1 to 64 code points once control and bidi ' +
|
|
201
|
+
'characters are stripped.');
|
|
202
|
+
}
|
|
203
|
+
const firstSeen = parseFirstSeenRecord(await local.get());
|
|
204
|
+
if (firstSeen === undefined ||
|
|
205
|
+
firstSeen.accountDid !== accountDid ||
|
|
206
|
+
firstSeen.writerId !== writerId) {
|
|
207
|
+
await local.put({
|
|
208
|
+
accountDid,
|
|
209
|
+
writerId,
|
|
210
|
+
firstSessionAt: sessionStartedAt.toISOString()
|
|
211
|
+
});
|
|
212
|
+
return 'deferred';
|
|
213
|
+
}
|
|
214
|
+
if (Date.parse(firstSeen.firstSessionAt) >= sessionStartedAt.getTime()) {
|
|
215
|
+
return 'deferred';
|
|
216
|
+
}
|
|
217
|
+
if (firstSeen.lastTouchedAt !== undefined &&
|
|
218
|
+
now.getTime() - Date.parse(firstSeen.lastTouchedAt) <
|
|
219
|
+
resolved.touchIntervalMs) {
|
|
220
|
+
return 'fresh';
|
|
221
|
+
}
|
|
222
|
+
let written = 'touched';
|
|
223
|
+
const outcome = await racedAs('raced', async () => writeConnection({
|
|
224
|
+
store,
|
|
225
|
+
hmacKey,
|
|
226
|
+
resourceId: await connectionResourceId({ hmacKey, did }),
|
|
227
|
+
unwritable: 'refused',
|
|
228
|
+
change(current) {
|
|
229
|
+
const next = withOwnWriter({
|
|
230
|
+
current,
|
|
231
|
+
did,
|
|
232
|
+
writerId,
|
|
233
|
+
label: name,
|
|
234
|
+
listedInDocument,
|
|
235
|
+
now,
|
|
236
|
+
policy: resolved
|
|
237
|
+
});
|
|
238
|
+
written = next.added === true ? 'registered' : 'touched';
|
|
239
|
+
return next;
|
|
240
|
+
}
|
|
241
|
+
}));
|
|
242
|
+
if (outcome !== 'raced') {
|
|
243
|
+
await local.put({ ...firstSeen, lastTouchedAt: now.toISOString() });
|
|
244
|
+
}
|
|
245
|
+
return outcome === 'created' || outcome === 'updated' ? written : outcome;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Runs one {@link writeConnection} and turns the lost race it throws after
|
|
249
|
+
* its last attempt into `raced`. Every other throw propagates.
|
|
250
|
+
*
|
|
251
|
+
* @param raced {Raced} the outcome a lost race resolves to
|
|
252
|
+
* @param write {Function}
|
|
253
|
+
* @returns {Promise<object>} the write's outcome, or `raced`
|
|
254
|
+
*/
|
|
255
|
+
async function racedAs(raced, write) {
|
|
256
|
+
try {
|
|
257
|
+
return (await write()).outcome;
|
|
258
|
+
}
|
|
259
|
+
catch (err) {
|
|
260
|
+
if (isLostConnectionRace(err)) {
|
|
261
|
+
return raced;
|
|
262
|
+
}
|
|
263
|
+
throw err;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Touches a registered writer's member from a pulled revision's `writerId`:
|
|
268
|
+
* the remembered session's pull path, throttled like the client's own touch.
|
|
269
|
+
* The writer is found in a listing already read, so the call costs no extra
|
|
270
|
+
* listing read, and a member the listing shows as fresh costs no I/O at all.
|
|
271
|
+
* An unregistered `writerId` is ignored, and so is a writer on a retired
|
|
272
|
+
* entry, so a replayed revision cannot keep a departed client's writer
|
|
273
|
+
* alive.
|
|
274
|
+
*
|
|
275
|
+
* @param options {object}
|
|
276
|
+
* @param options.store {ConnectionsStore}
|
|
277
|
+
* @param options.hmacKey {ConnectionIdKey}
|
|
278
|
+
* @param options.listing {ConnectionsListing} the latest listing read
|
|
279
|
+
* @param options.writerId {string} the pulled revision's `writerId`
|
|
280
|
+
* @param [options.now] {Date}
|
|
281
|
+
* @param [options.policy] {Partial<ConnectionWriterPolicy>}
|
|
282
|
+
* @returns {Promise<WriterTouchOutcome>}
|
|
283
|
+
*/
|
|
284
|
+
export async function touchConnectionWriter({ store, hmacKey, listing, writerId, now = new Date(), policy }) {
|
|
285
|
+
const resolved = connectionWriterPolicy(policy);
|
|
286
|
+
const found = listing.entries.find(item => item.entry.writers.some(writer => writer.writerId === writerId));
|
|
287
|
+
if (found === undefined) {
|
|
288
|
+
return 'unregistered';
|
|
289
|
+
}
|
|
290
|
+
// Decided from the listing first, so the common fresh member costs no read.
|
|
291
|
+
const listed = memberToTouch({
|
|
292
|
+
entry: found.entry,
|
|
293
|
+
writerId,
|
|
294
|
+
now,
|
|
295
|
+
policy: resolved
|
|
296
|
+
});
|
|
297
|
+
if ('stop' in listed) {
|
|
298
|
+
return listed.stop;
|
|
299
|
+
}
|
|
300
|
+
const outcome = await racedAs('raced', () => writeConnection({
|
|
301
|
+
store,
|
|
302
|
+
hmacKey,
|
|
303
|
+
resourceId: found.resourceId,
|
|
304
|
+
unwritable: 'refused',
|
|
305
|
+
change(current) {
|
|
306
|
+
if (current === undefined) {
|
|
307
|
+
return { stop: 'unregistered' };
|
|
308
|
+
}
|
|
309
|
+
const next = memberToTouch({
|
|
310
|
+
entry: current.entry,
|
|
311
|
+
writerId,
|
|
312
|
+
now,
|
|
313
|
+
policy: resolved
|
|
314
|
+
});
|
|
315
|
+
if ('stop' in next) {
|
|
316
|
+
return next;
|
|
317
|
+
}
|
|
318
|
+
return {
|
|
319
|
+
body: {
|
|
320
|
+
...current.body,
|
|
321
|
+
writers: touchedWriters({
|
|
322
|
+
writers: current.entry.writers,
|
|
323
|
+
member: next.member,
|
|
324
|
+
now
|
|
325
|
+
})
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
}));
|
|
330
|
+
return outcome === 'created' || outcome === 'updated' ? 'touched' : outcome;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* The member a touch advances on an entry, or the outcome that stops the
|
|
334
|
+
* touch: a retired entry, a `writerId` the entry does not carry, or a member
|
|
335
|
+
* touched within the interval.
|
|
336
|
+
*
|
|
337
|
+
* @param options {object}
|
|
338
|
+
* @param options.entry {ConnectionEntry}
|
|
339
|
+
* @param options.writerId {string}
|
|
340
|
+
* @param options.now {Date}
|
|
341
|
+
* @param options.policy {ConnectionWriterPolicy}
|
|
342
|
+
* @returns {object}
|
|
343
|
+
*/
|
|
344
|
+
function memberToTouch({ entry, writerId, now, policy }) {
|
|
345
|
+
if (entry.retired !== undefined) {
|
|
346
|
+
return { stop: 'retired' };
|
|
347
|
+
}
|
|
348
|
+
const member = entry.writers.find(writer => writer.writerId === writerId);
|
|
349
|
+
if (member === undefined) {
|
|
350
|
+
return { stop: 'unregistered' };
|
|
351
|
+
}
|
|
352
|
+
if (now.getTime() - effectiveLastSeen({ writer: member, now }) <
|
|
353
|
+
policy.touchIntervalMs) {
|
|
354
|
+
return { stop: 'fresh' };
|
|
355
|
+
}
|
|
356
|
+
return { member };
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* The two-phase expiry over one entry's writers, or `undefined` when it
|
|
360
|
+
* changes nothing. Past the cap, the oldest-`lastSeen` members are dropped.
|
|
361
|
+
* Among the members kept, an active one past the inactivity window is marked
|
|
362
|
+
* inactive.
|
|
363
|
+
*
|
|
364
|
+
* @param options {object}
|
|
365
|
+
* @param options.entry {ConnectionEntry}
|
|
366
|
+
* @param options.now {Date}
|
|
367
|
+
* @param options.policy {ConnectionWriterPolicy}
|
|
368
|
+
* @returns {object | undefined}
|
|
369
|
+
*/
|
|
370
|
+
function sweptWriters({ entry, now, policy }) {
|
|
371
|
+
const kept = new Set(newestFirst({ writers: entry.writers, now }).slice(0, Math.max(policy.maxWriters, 0)));
|
|
372
|
+
const markedInactive = [];
|
|
373
|
+
const dropped = [];
|
|
374
|
+
const writers = [];
|
|
375
|
+
for (const writer of entry.writers) {
|
|
376
|
+
if (!kept.has(writer)) {
|
|
377
|
+
dropped.push(writer.writerId);
|
|
378
|
+
continue;
|
|
379
|
+
}
|
|
380
|
+
const expired = now.getTime() - effectiveLastSeen({ writer, now }) >
|
|
381
|
+
policy.inactiveAfterMs;
|
|
382
|
+
if (writer.active && expired) {
|
|
383
|
+
markedInactive.push(writer.writerId);
|
|
384
|
+
writers.push({ ...writer, active: false });
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
387
|
+
writers.push(writer);
|
|
388
|
+
}
|
|
389
|
+
if (markedInactive.length === 0 && dropped.length === 0) {
|
|
390
|
+
return undefined;
|
|
391
|
+
}
|
|
392
|
+
return { writers, markedInactive, dropped };
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Sweeps every entry of a listing already read: the per-entry two-phase
|
|
396
|
+
* expiry of `writers`, run at the directory listing read on both session
|
|
397
|
+
* kinds. Safe to run from any replica, and concurrently. Every write is
|
|
398
|
+
* conditional on the ETag the listing read, and a lost race is skipped: the
|
|
399
|
+
* entry as read still labels its revisions. Any other failed write is skipped
|
|
400
|
+
* the same way and reported in `failed`, so one unreachable entry does not
|
|
401
|
+
* fail the listing read the sweep rides on; the next sweep converges it. An
|
|
402
|
+
* entry this build cannot write (a newer `version`), or one read without an
|
|
403
|
+
* ETag, is left alone.
|
|
404
|
+
*
|
|
405
|
+
* @param options {object}
|
|
406
|
+
* @param options.store {ConnectionsStore}
|
|
407
|
+
* @param options.listing {ConnectionsListing}
|
|
408
|
+
* @param [options.now] {Date}
|
|
409
|
+
* @param [options.policy] {Partial<ConnectionWriterPolicy>}
|
|
410
|
+
* @returns {Promise<ConnectionWritersSweep>}
|
|
411
|
+
*/
|
|
412
|
+
export async function sweepConnectionWriters({ store, listing, now = new Date(), policy }) {
|
|
413
|
+
const resolved = connectionWriterPolicy(policy);
|
|
414
|
+
const markedInactive = [];
|
|
415
|
+
const dropped = [];
|
|
416
|
+
const failed = [];
|
|
417
|
+
const entries = [];
|
|
418
|
+
for (const item of listing.entries) {
|
|
419
|
+
const swept = isWritableConnectionEntry(item.entry)
|
|
420
|
+
? sweptWriters({ entry: item.entry, now, policy: resolved })
|
|
421
|
+
: undefined;
|
|
422
|
+
if (swept === undefined || item.etag === undefined) {
|
|
423
|
+
entries.push(item);
|
|
424
|
+
continue;
|
|
425
|
+
}
|
|
426
|
+
const body = { ...item.body, writers: swept.writers };
|
|
427
|
+
try {
|
|
428
|
+
const { etag } = await store.put({
|
|
429
|
+
resourceId: item.resourceId,
|
|
430
|
+
body,
|
|
431
|
+
ifMatch: item.etag
|
|
432
|
+
});
|
|
433
|
+
markedInactive.push(...swept.markedInactive);
|
|
434
|
+
dropped.push(...swept.dropped);
|
|
435
|
+
entries.push({
|
|
436
|
+
resourceId: item.resourceId,
|
|
437
|
+
...(etag !== undefined && { etag }),
|
|
438
|
+
entry: { ...item.entry, writers: swept.writers },
|
|
439
|
+
body
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
catch (err) {
|
|
443
|
+
if (!isLostConnectionRace(err)) {
|
|
444
|
+
failed.push({ resourceId: item.resourceId, err });
|
|
445
|
+
}
|
|
446
|
+
entries.push(item);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
return {
|
|
450
|
+
listing: { ...listing, entries },
|
|
451
|
+
markedInactive,
|
|
452
|
+
dropped,
|
|
453
|
+
failed
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Resolves a revision's `writerId` against the directory's entries.
|
|
458
|
+
*
|
|
459
|
+
* @param options {object}
|
|
460
|
+
* @param options.writerId {string}
|
|
461
|
+
* @param options.entries {ConnectionEntry[]} the listed entries
|
|
462
|
+
* @param options.enrolledSigningKeys {ReadonlySet<string>} the signing-key
|
|
463
|
+
* multibases of the enrolled clients in the verified account document
|
|
464
|
+
* @returns {ResolvedWriter | undefined}
|
|
465
|
+
*/
|
|
466
|
+
export function resolveWriter({ writerId, entries, enrolledSigningKeys }) {
|
|
467
|
+
for (const entry of entries) {
|
|
468
|
+
const member = entry.writers.find(writer => writer.writerId === writerId);
|
|
469
|
+
if (member === undefined) {
|
|
470
|
+
continue;
|
|
471
|
+
}
|
|
472
|
+
const multibase = entry.id === undefined
|
|
473
|
+
? undefined
|
|
474
|
+
: signingKeyMultibaseOfDid({ did: entry.id });
|
|
475
|
+
const linked = multibase !== undefined && enrolledSigningKeys.has(multibase);
|
|
476
|
+
return {
|
|
477
|
+
label: entry.label ?? entry.name ?? member.label,
|
|
478
|
+
active: member.active,
|
|
479
|
+
retired: entry.retired !== undefined,
|
|
480
|
+
...(linked && { clientSigningKeyMultibase: multibase })
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
return undefined;
|
|
484
|
+
}
|
|
485
|
+
//# sourceMappingURL=writers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writers.js","sourceRoot":"","sources":["../../src/connections/writers.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,YAAY,CAAA;AAOnB,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAGtD,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AA+DnE;;;;;;;;;GASG;AACH,SAAS,iBAAiB,CAAC,EACzB,MAAM,EACN,GAAG,EAIJ;IACC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAA;AAC7D,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,WAAW,CAAC,EACnB,OAAO,EACP,GAAG,EAIJ;IACC,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CACtB,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CACd,iBAAiB,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;QACvC,iBAAiB,CAAC,EAAE,MAAM,EAAE,IAAI,EAA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O,EACP,mBAAmB,EAKpB;IACC,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAA;QACzE,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,SAAQ;QACV,CAAC;QACD,MAAM,SAAS,GACb,KAAK,CAAC,EAAE,KAAK,SAAS;YACpB,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,wBAAwB,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAA;QACjD,MAAM,MAAM,GAAG,SAAS,KAAK,SAAS,IAAI,mBAAmB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;QAC5E,OAAO;YACL,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,IAAI,MAAM,CAAC,KAAK;YAChD,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,OAAO,EAAE,KAAK,CAAC,OAAO,KAAK,SAAS;YACpC,GAAG,CAAC,MAAM,IAAI,EAAE,yBAAyB,EAAE,SAAS,EAAE,CAAC;SACxD,CAAA;IACH,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC"}
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* string it receives straight to `approveEnrollment`; the connect-code payload
|
|
13
13
|
* version is deliberately NOT bumped by this transport. Beside it rides an
|
|
14
14
|
* optional display label the enrollee suggests for itself. The label lives in
|
|
15
|
-
* the envelope rather than in the code because its durable home is the
|
|
16
|
-
*
|
|
17
|
-
* code stays the ceremony's own artifact.
|
|
15
|
+
* the envelope rather than in the code because its durable home is the new
|
|
16
|
+
* client's `connections` directory entry, whose `name` the approving client
|
|
17
|
+
* writes -- the code stays the ceremony's own artifact.
|
|
18
18
|
*
|
|
19
19
|
* The label is attacker-adjacent free text that renders on the approver's
|
|
20
20
|
* consent screen, so it is stripped of control characters, trimmed, and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onboardingResponse.d.ts","sourceRoot":"","sources":["../../src/enrollment/onboardingResponse.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAEL,2BAA2B,
|
|
1
|
+
{"version":3,"file":"onboardingResponse.d.ts","sourceRoot":"","sources":["../../src/enrollment/onboardingResponse.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAEL,2BAA2B,EAE5B,MAAM,iBAAiB,CAAA;AAExB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAExD;;GAEG;AACH,eAAO,MAAM,2BAA2B,IAAI,CAAA;AAE5C,OAAO,EAAE,2BAA2B,EAAE,CAAA;AAEtC;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,gBAAgB,EAAE;QAChB,CAAC,EAAE,MAAM,CAAA;QACT,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;CACF,CAAA;AAwCD;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,IAAI,EACJ,KAAK,EACN,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,wBAAwB,CAU3B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IACpE,OAAO,EAAE,iBAAiB,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAsBA"}
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* string it receives straight to `approveEnrollment`; the connect-code payload
|
|
13
13
|
* version is deliberately NOT bumped by this transport. Beside it rides an
|
|
14
14
|
* optional display label the enrollee suggests for itself. The label lives in
|
|
15
|
-
* the envelope rather than in the code because its durable home is the
|
|
16
|
-
*
|
|
17
|
-
* code stays the ceremony's own artifact.
|
|
15
|
+
* the envelope rather than in the code because its durable home is the new
|
|
16
|
+
* client's `connections` directory entry, whose `name` the approving client
|
|
17
|
+
* writes -- the code stays the ceremony's own artifact.
|
|
18
18
|
*
|
|
19
19
|
* The label is attacker-adjacent free text that renders on the approver's
|
|
20
20
|
* consent screen, so it is stripped of control characters, trimmed, and
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* truncated: a truncated label would be a silently different name for a client
|
|
23
23
|
* the person is about to authorize, where a refusal costs only a fresh code.
|
|
24
24
|
*/
|
|
25
|
-
import {
|
|
25
|
+
import { normalizeDisplayName, ONBOARDING_LABEL_MAX_LENGTH, strippedDisplayText } from '../labelText.js';
|
|
26
26
|
import { parseEnrollmentRequest } from './enrollment.js';
|
|
27
27
|
/**
|
|
28
28
|
* The onboarding-response envelope version this build mints and accepts.
|
|
@@ -30,10 +30,13 @@ import { parseEnrollmentRequest } from './enrollment.js';
|
|
|
30
30
|
export const ONBOARDING_RESPONSE_VERSION = 1;
|
|
31
31
|
export { ONBOARDING_LABEL_MAX_LENGTH };
|
|
32
32
|
/**
|
|
33
|
-
* Sanitizes a suggested display label
|
|
34
|
-
*
|
|
33
|
+
* Sanitizes a suggested display label by the shared display-name rule
|
|
34
|
+
* (`normalizeDisplayName`): strips the control and bidi characters above,
|
|
35
|
+
* trims surrounding whitespace, and refuses anything still longer than
|
|
35
36
|
* {@link ONBOARDING_LABEL_MAX_LENGTH}. A label that sanitizes to nothing at
|
|
36
37
|
* all is absent rather than empty, so no consent screen renders a blank name.
|
|
38
|
+
* The directory codec bounds a stored `name` by the same rule, so a label
|
|
39
|
+
* this accepts is one the approver can store.
|
|
37
40
|
*
|
|
38
41
|
* @param options {object}
|
|
39
42
|
* @param options.label {unknown} the envelope's `label` member, if any
|
|
@@ -46,15 +49,16 @@ function sanitizedOnboardingLabel({ label }) {
|
|
|
46
49
|
if (typeof label !== 'string') {
|
|
47
50
|
throw new Error('An onboarding response label must be a string.');
|
|
48
51
|
}
|
|
49
|
-
const sanitized =
|
|
50
|
-
if (sanitized
|
|
51
|
-
return
|
|
52
|
+
const sanitized = normalizeDisplayName({ value: label });
|
|
53
|
+
if (sanitized !== undefined) {
|
|
54
|
+
return sanitized;
|
|
52
55
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
// Refused: a blank label is absent, and only a too-long one is an error.
|
|
57
|
+
if (strippedDisplayText({ value: label }).length === 0) {
|
|
58
|
+
return undefined;
|
|
56
59
|
}
|
|
57
|
-
|
|
60
|
+
throw new Error(`An onboarding response label may be at most ` +
|
|
61
|
+
`${ONBOARDING_LABEL_MAX_LENGTH} characters.`);
|
|
58
62
|
}
|
|
59
63
|
/**
|
|
60
64
|
* ENROLLEE: builds the response envelope for a connect code it just minted.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onboardingResponse.js","sourceRoot":"","sources":["../../src/enrollment/onboardingResponse.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"onboardingResponse.js","sourceRoot":"","sources":["../../src/enrollment/onboardingResponse.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,mBAAmB,EACpB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AAGxD;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAA;AAE5C,OAAO,EAAE,2BAA2B,EAAE,CAAA;AActC;;;;;;;;;;;;GAYG;AACH,SA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D,CAAC;IACD,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAA+B,CAAA;IAC5D,IAAI,gBAAgB,KAAK,IAAI,IAAI,OAAO,gBAAgB,KAAK,QAAQ,EAAE,CAAC;QACtE,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;IACzE,CAAC;IACD,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,gBAA2C,CAAA;IACtE,IAAI,CAAC,KAAK,2BAA2B,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,4CAA4C,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IAC5E,CAAC;IACD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;IACrE,CAAC;IACD,MAAM,OAAO,GAAG,sBAAsB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;IAChD,MAAM,SAAS,GAAG,wBAAwB,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;IACrD,OAAO;QACL,OAAO;QACP,IAAI;QACJ,GAAG,CAAC,SAAS,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;KACrD,CAAA;AACH,CAAC"}
|
package/dist/keys/index.d.ts
CHANGED
|
@@ -62,10 +62,6 @@
|
|
|
62
62
|
* escrowed into every epoch.
|
|
63
63
|
* - `enrolledClientRosterRecipients` -- the enrolled clients a document keys,
|
|
64
64
|
* as roster recipients; the escrow direction's candidate list.
|
|
65
|
-
* - `readClientLabels` / `setClientLabel` / `removeClientLabel` /
|
|
66
|
-
* `wasClientLabelsStore` -- the enrolled-client display labels
|
|
67
|
-
* (`key-map/client-labels.json`), the record a "your wallets" surface names
|
|
68
|
-
* clients from, and the WAS-backed store they run through.
|
|
69
65
|
* - `rotateUserKeyRoster` / `unwrapUserKeyGenerations` /
|
|
70
66
|
* `rotateCollectionEpochsToUserKey`
|
|
71
67
|
* / `cascadeCollectionsToUserKey` / `userKeyAsRecipient` -- the user key rotation
|
|
@@ -116,7 +112,4 @@ export { isSealableDescriptorStore } from './rosterLogStore.js';
|
|
|
116
112
|
export type { SealableEncryptionDescriptorStore } from './rosterLogStore.js';
|
|
117
113
|
export { ensureIndexedFirstEpoch, ensureWalletSpaceEpochs, WalletSpaceProvisioningError, walletSpaceProvisioner } from './spaceEpochs.js';
|
|
118
114
|
export type { WalletSpaceEpochsResult } from './spaceEpochs.js';
|
|
119
|
-
export { readClientLabels, removeClientLabel, setClientLabel } from './clientLabels.js';
|
|
120
|
-
export type { ClientLabelsRecord, ClientLabelsStore } from './clientLabels.js';
|
|
121
|
-
export { wasClientLabelsStore } from './wasLabelsStore.js';
|
|
122
115
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/keys/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/keys/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/keys/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyFG;AACH,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC3E,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,kBAAkB,EACnB,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3C,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,EACzB,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,sBAAsB,CAAA;AAC7B,YAAY,EACV,eAAe,EACf,mBAAm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AA4B,EAC5B,sBAAsB,EACvB,MAAM,kBAAkB,CAAA;AACzB,YAAY,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA"}
|
package/dist/keys/index.js
CHANGED
|
@@ -62,10 +62,6 @@
|
|
|
62
62
|
* escrowed into every epoch.
|
|
63
63
|
* - `enrolledClientRosterRecipients` -- the enrolled clients a document keys,
|
|
64
64
|
* as roster recipients; the escrow direction's candidate list.
|
|
65
|
-
* - `readClientLabels` / `setClientLabel` / `removeClientLabel` /
|
|
66
|
-
* `wasClientLabelsStore` -- the enrolled-client display labels
|
|
67
|
-
* (`key-map/client-labels.json`), the record a "your wallets" surface names
|
|
68
|
-
* clients from, and the WAS-backed store they run through.
|
|
69
65
|
* - `rotateUserKeyRoster` / `unwrapUserKeyGenerations` /
|
|
70
66
|
* `rotateCollectionEpochsToUserKey`
|
|
71
67
|
* / `cascadeCollectionsToUserKey` / `userKeyAsRecipient` -- the user key rotation
|
|
@@ -107,6 +103,4 @@ export { accountCollectionStores, collectionDescriptorLogStore, collectionDescri
|
|
|
107
103
|
export { userKeyRosterDescriptorStore, userKeyRosterPinId } from './rosterStore.js';
|
|
108
104
|
export { isSealableDescriptorStore } from './rosterLogStore.js';
|
|
109
105
|
export { ensureIndexedFirstEpoch, ensureWalletSpaceEpochs, WalletSpaceProvisioningError, walletSpaceProvisioner } from './spaceEpochs.js';
|
|
110
|
-
export { readClientLabels, removeClientLabel, setClientLabel } from './clientLabels.js';
|
|
111
|
-
export { wasClientLabelsStore } from './wasLabelsStore.js';
|
|
112
106
|
//# sourceMappingURL=index.js.map
|
package/dist/keys/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/keys/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/keys/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;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