@interop/wallet-core 0.67.0 → 0.68.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/dist/clientAnnex/credentialAnchoredGenesis.d.ts +1 -6
- package/dist/clientAnnex/credentialAnchoredGenesis.d.ts.map +1 -1
- package/dist/clientAnnex/credentialAnchoredGenesis.js +2 -6
- package/dist/clientAnnex/credentialAnchoredGenesis.js.map +1 -1
- package/dist/clientAnnex/establish.d.ts +1 -12
- package/dist/clientAnnex/establish.d.ts.map +1 -1
- package/dist/clientAnnex/establish.js +7 -29
- package/dist/clientAnnex/establish.js.map +1 -1
- package/dist/clientAnnex/forget.d.ts +7 -16
- package/dist/clientAnnex/forget.d.ts.map +1 -1
- package/dist/clientAnnex/forget.js +8 -18
- package/dist/clientAnnex/forget.js.map +1 -1
- package/dist/clientAnnex/forgetLast.d.ts +8 -17
- package/dist/clientAnnex/forgetLast.d.ts.map +1 -1
- package/dist/clientAnnex/forgetLast.js +19 -34
- package/dist/clientAnnex/forgetLast.js.map +1 -1
- package/dist/clientAnnex/gc.d.ts +26 -12
- package/dist/clientAnnex/gc.d.ts.map +1 -1
- package/dist/clientAnnex/gc.js +60 -57
- package/dist/clientAnnex/gc.js.map +1 -1
- package/dist/clientAnnex/heal.d.ts +3 -12
- package/dist/clientAnnex/heal.d.ts.map +1 -1
- package/dist/clientAnnex/heal.js +19 -32
- 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 +1 -1
- package/dist/clientAnnex/index.js.map +1 -1
- package/dist/clientAnnex/ladderAnchored.d.ts +25 -70
- package/dist/clientAnnex/ladderAnchored.d.ts.map +1 -1
- package/dist/clientAnnex/ladderAnchored.js +34 -83
- package/dist/clientAnnex/ladderAnchored.js.map +1 -1
- package/dist/clientAnnex/log.d.ts +55 -68
- package/dist/clientAnnex/log.d.ts.map +1 -1
- package/dist/clientAnnex/log.js +82 -111
- package/dist/clientAnnex/log.js.map +1 -1
- package/dist/clientAnnex/mend.d.ts +0 -4
- package/dist/clientAnnex/mend.d.ts.map +1 -1
- package/dist/clientAnnex/mend.js +6 -31
- package/dist/clientAnnex/mend.js.map +1 -1
- package/dist/clientAnnex/recoveryLadderAnchored.d.ts +5 -12
- package/dist/clientAnnex/recoveryLadderAnchored.d.ts.map +1 -1
- package/dist/clientAnnex/recoveryLadderAnchored.js +7 -13
- package/dist/clientAnnex/recoveryLadderAnchored.js.map +1 -1
- package/dist/clientAnnex/selfEnroll.d.ts +6 -10
- package/dist/clientAnnex/selfEnroll.d.ts.map +1 -1
- package/dist/clientAnnex/selfEnroll.js +12 -17
- package/dist/clientAnnex/selfEnroll.js.map +1 -1
- package/dist/genesis/accountGenesis.d.ts +3 -6
- package/dist/genesis/accountGenesis.d.ts.map +1 -1
- package/dist/genesis/accountGenesis.js +4 -6
- package/dist/genesis/accountGenesis.js.map +1 -1
- package/dist/recovery/continuation.d.ts +2 -7
- package/dist/recovery/continuation.d.ts.map +1 -1
- package/dist/recovery/continuation.js +2 -6
- package/dist/recovery/continuation.js.map +1 -1
- package/dist/recovery/recoveryWebvh.d.ts +11 -25
- package/dist/recovery/recoveryWebvh.d.ts.map +1 -1
- package/dist/recovery/recoveryWebvh.js +13 -26
- package/dist/recovery/recoveryWebvh.js.map +1 -1
- package/dist/resourceLog/index.d.ts +2 -2
- package/dist/resourceLog/index.js +2 -2
- package/dist/unlock/retire.d.ts +4 -12
- package/dist/unlock/retire.d.ts.map +1 -1
- package/dist/unlock/retire.js +4 -14
- package/dist/unlock/retire.js.map +1 -1
- package/dist/unlock/standingWebvh.d.ts +8 -22
- package/dist/unlock/standingWebvh.d.ts.map +1 -1
- package/dist/unlock/standingWebvh.js +7 -18
- package/dist/unlock/standingWebvh.js.map +1 -1
- package/dist/webvh/accountEntry.d.ts +5 -12
- package/dist/webvh/accountEntry.d.ts.map +1 -1
- package/dist/webvh/accountEntry.js +11 -22
- package/dist/webvh/accountEntry.js.map +1 -1
- package/dist/webvh/delegatedLogStore.d.ts +7 -2
- package/dist/webvh/delegatedLogStore.d.ts.map +1 -1
- package/dist/webvh/delegatedLogStore.js +9 -1
- package/dist/webvh/delegatedLogStore.js.map +1 -1
- package/dist/webvh/didWebvh.d.ts +69 -80
- package/dist/webvh/didWebvh.d.ts.map +1 -1
- package/dist/webvh/didWebvh.js +74 -117
- package/dist/webvh/didWebvh.js.map +1 -1
- package/dist/webvh/enrollClient.d.ts +2 -8
- package/dist/webvh/enrollClient.d.ts.map +1 -1
- package/dist/webvh/enrollClient.js +3 -8
- package/dist/webvh/enrollClient.js.map +1 -1
- package/dist/webvh/index.d.ts +1 -1
- package/dist/webvh/index.d.ts.map +1 -1
- package/dist/webvh/index.js +1 -1
- package/dist/webvh/index.js.map +1 -1
- package/dist/webvh/revokeClient.d.ts +3 -9
- package/dist/webvh/revokeClient.d.ts.map +1 -1
- package/dist/webvh/revokeClient.js +4 -9
- package/dist/webvh/revokeClient.js.map +1 -1
- package/dist/webvh/verifyLog.d.ts +24 -4
- package/dist/webvh/verifyLog.d.ts.map +1 -1
- package/dist/webvh/verifyLog.js +26 -7
- package/dist/webvh/verifyLog.js.map +1 -1
- package/dist/webvh/wasIdStore.d.ts +16 -3
- package/dist/webvh/wasIdStore.d.ts.map +1 -1
- package/dist/webvh/wasIdStore.js +18 -3
- package/dist/webvh/wasIdStore.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forgetLast.d.ts","sourceRoot":"","sources":["../../src/clientAnnex/forgetLast.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqHG;AACH,OAAO,KAAK,EAAE,MAAM,EAA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;QAC3B,MAAM,EAAE,CAAC,UAAU,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;QACrD,YAAY,EAAE,MAAM,CAAA;QACpB,cAAc,EAAE,MAAM,CAAA;KACvB,CAAA;IACD,eAAe,EAAE,CAAC,SAAS,EAAE;QAC3B,GAAG,EAAE,MAAM,CAAA;QACX,GAAG,EAAE,MAAM,CAAA;QACX,GAAG,EAAE,MAAM,CAAA;KACZ,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACnB,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAAC,8BAA8B,CAAC,CA2N1C;AAyJD;;;;;;;;;;;;GAYG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,EAAE;IACnD,KAAK,EAAE,cAAc,CAAA;IACrB,eAAe,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,kBAAkB,GAAG,eAAe,CAAC,CAAA;IAC1E,UAAU,EAAE,UAAU,CAAA;IACtB,eAAe,EAAE,iBAAiB,CAAA;IAClC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,GAAG,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAWrD"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { accountLogPinId } from '../webvh/verifyLog.js';
|
|
1
|
+
import { readPublishedLogOrThrow, withLogConflictRetry } from '../webvh/didWebvh.js';
|
|
3
2
|
import { clientRemovalTarget } from '../webvh/revokeClient.js';
|
|
4
3
|
import { delegationProofKeyId } from '../webvh/standingZcap.js';
|
|
5
4
|
import { vmFragmentOf } from '@interop/vh-resource-log';
|
|
@@ -8,7 +7,7 @@ import { ladderVmKeyMultibase } from './ladder.js';
|
|
|
8
7
|
import { ladderVmIds, relationIds } from '../resourceLog/document.js';
|
|
9
8
|
import { ladderVmZcapClient } from './zcap.js';
|
|
10
9
|
import { clientForgetEntryOnce, installLadderVmWebvh, strikeLadderVmWebvh } from './ladderAnchored.js';
|
|
11
|
-
import { clientAnnexDidParts,
|
|
10
|
+
import { clientAnnexDidParts, delegatedClientsPointer, ensureGenerationDelegationCurrent, generationDelegationHistory, mintGenerationDelegation, readClientAnnexLogOrAbsent, revokeTreatingAlreadyRevokedAsSuccess } from './log.js';
|
|
12
11
|
/**
|
|
13
12
|
* Forgets the account's LAST enrolled client -- this browser's own
|
|
14
13
|
* -- transitioning the account to the client-less, ladder-anchored state.
|
|
@@ -20,7 +19,13 @@ import { clientAnnexDidParts, clientAnnexLogPinId, delegatedClientsPointer, ensu
|
|
|
20
19
|
*
|
|
21
20
|
* @param options {object}
|
|
22
21
|
* @param options.logStore {UnlockLogStore} the credential's delegated
|
|
23
|
-
* `did.jsonl` bridge store; also serves the ceremony's public reads
|
|
22
|
+
* `did.jsonl` bridge store; also serves the ceremony's public reads. Every
|
|
23
|
+
* account-log read the ceremony makes -- the opening read, and the strike,
|
|
24
|
+
* reinstall, and removal entries' own reads inside their conflict-retry
|
|
25
|
+
* loops -- is checked against the chain-head pin its store carries, so a
|
|
26
|
+
* served truncated prefix is refused (`ResourceLogContinuityError`,
|
|
27
|
+
* `rollback`) before any roster append or log publish, and each entry
|
|
28
|
+
* advances the pin to the head it publishes
|
|
24
29
|
* @param options.clientLogStore {UnlockLogStore} the account-log store
|
|
25
30
|
* invoked under the STILL-STANDING enrolled client's root authority (an
|
|
26
31
|
* app's `wasWebvhIdStore` satisfies the narrower shape). The
|
|
@@ -31,14 +36,6 @@ import { clientAnnexDidParts, clientAnnexLogPinId, delegatedClientsPointer, ensu
|
|
|
31
36
|
* carries the removal entry's pre-entry `did:web` projection PUT (stage 6),
|
|
32
37
|
* the one write the bridge store cannot make. Required: a call without it
|
|
33
38
|
* throws a `TypeError` before any read
|
|
34
|
-
* @param [options.pinStore] {ResourceLogPinStore} this client's chain-head
|
|
35
|
-
* pins, the account log's slot derived from `annex.accountSpaceId`. Every
|
|
36
|
-
* account-log read the ceremony makes -- the opening read, and the strike,
|
|
37
|
-
* reinstall, and removal entries' own reads inside their conflict-retry
|
|
38
|
-
* loops -- is checked against the pinned head, so a served truncated
|
|
39
|
-
* prefix is refused (`ResourceLogContinuityError`, `rollback`) before any
|
|
40
|
-
* roster append or log publish, and each entry advances the pin to the
|
|
41
|
-
* head it publishes. Without it the ceremony checks `expectedDid` only
|
|
42
39
|
* @param options.ladderSeed {Uint8Array} the login credential's ladder seed
|
|
43
40
|
* @param options.forgottenClient {RevokedClientKeys} this client's public
|
|
44
41
|
* halves; an `updateKeyMultibase` the log does not authorize (stale, or the
|
|
@@ -86,8 +83,6 @@ import { clientAnnexDidParts, clientAnnexLogPinId, delegatedClientsPointer, ensu
|
|
|
86
83
|
* server (the fresh generation delegation's target host)
|
|
87
84
|
* @param options.annex.accountSpaceId {string} the ACCOUNT Space's id (the
|
|
88
85
|
* fresh delegation's target subtree)
|
|
89
|
-
* @param [options.annex.pinStore] {ResourceLogPinStore} chain-head pins
|
|
90
|
-
* for the pointed generation's read
|
|
91
86
|
* @param options.onBeforeRemoval {Function}
|
|
92
87
|
* `({ did, doc, log }) => Promise<void>` -- the record re-bind seam: runs
|
|
93
88
|
* immediately before the removal entry, with the post-reinstall published
|
|
@@ -99,7 +94,7 @@ import { clientAnnexDidParts, clientAnnexLogPinId, delegatedClientsPointer, ensu
|
|
|
99
94
|
* @param [options.now] {number} epoch milliseconds, for tests
|
|
100
95
|
* @returns {Promise<LastEnrolledClientForgetResult>}
|
|
101
96
|
*/
|
|
102
|
-
export async function forgetLastEnrolledClient({ logStore, clientLogStore,
|
|
97
|
+
export async function forgetLastEnrolledClient({ logStore, clientLogStore, ladderSeed, forgottenClient, forgottenKeyAgreementKeyMultibase, knownLatentHashes, expectedDid, rosterStore, credentialKeyAgreementKey, userKey, pinnedEpochId, onUserKeyAdopted, collections, annex, onBeforeRemoval, now = Date.now() }) {
|
|
103
98
|
// The seam is the only stage that re-signs the login credential's bridge
|
|
104
99
|
// with the ladder VM; a run without it would land the removal entry over
|
|
105
100
|
// a record the struck key signed, on an account nothing could then write
|
|
@@ -132,14 +127,9 @@ export async function forgetLastEnrolledClient({ logStore, clientLogStore, pinSt
|
|
|
132
127
|
// state the app's next login maps -- nothing here can still invoke), and
|
|
133
128
|
// an account with another enrolled client belongs to the ordinary
|
|
134
129
|
// forget ceremony.
|
|
135
|
-
// The account log's pin slot, shared by every read and entry below.
|
|
136
|
-
const pinned = pinStore
|
|
137
|
-
? { pinStore, logId: accountLogPinId({ spaceId: annex.accountSpaceId }) }
|
|
138
|
-
: {};
|
|
139
130
|
const before = await readPublishedLogOrThrow({
|
|
140
131
|
idStore: logStore,
|
|
141
132
|
expectedDid,
|
|
142
|
-
...pinned,
|
|
143
133
|
missingMessage: 'did:webvh: did.jsonl is missing; nothing to enroll into.'
|
|
144
134
|
});
|
|
145
135
|
const preTarget = await clientRemovalTarget({
|
|
@@ -226,14 +216,12 @@ export async function forgetLastEnrolledClient({ logStore, clientLogStore, pinSt
|
|
|
226
216
|
await strikeLadderVmWebvh({
|
|
227
217
|
store: clientLogStore,
|
|
228
218
|
ladderSeed,
|
|
229
|
-
expectedDid
|
|
230
|
-
...pinned
|
|
219
|
+
expectedDid
|
|
231
220
|
});
|
|
232
221
|
const install = await installLadderVmWebvh({
|
|
233
222
|
store: clientLogStore,
|
|
234
223
|
ladderSeed,
|
|
235
|
-
expectedDid
|
|
236
|
-
...pinned
|
|
224
|
+
expectedDid
|
|
237
225
|
});
|
|
238
226
|
reinstalled = install.installed;
|
|
239
227
|
anchor = { did: install.did, doc: install.doc, log: install.log };
|
|
@@ -291,8 +279,7 @@ export async function forgetLastEnrolledClient({ logStore, clientLogStore, pinSt
|
|
|
291
279
|
ladderSeed,
|
|
292
280
|
forgottenClient,
|
|
293
281
|
...(knownLatentHashes ? { knownLatentHashes } : {}),
|
|
294
|
-
expectedDid
|
|
295
|
-
...pinned
|
|
282
|
+
expectedDid
|
|
296
283
|
});
|
|
297
284
|
return {
|
|
298
285
|
reinstalled,
|
|
@@ -342,11 +329,12 @@ async function retireLadderGenerationDelegations({ doc, accountDid, ladderSeed,
|
|
|
342
329
|
}
|
|
343
330
|
const parts = clientAnnexDidParts({ did: pointedDid });
|
|
344
331
|
const store = annex.storeFor(parts);
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
332
|
+
// Absence is read as absence even under a pin this client holds from an
|
|
333
|
+
// earlier read: a generation that is gone is the `log-unreadable` escape,
|
|
334
|
+
// and a refusal here would wedge the transition after the roster rotation.
|
|
335
|
+
const published = await readClientAnnexLogOrAbsent({
|
|
336
|
+
store,
|
|
337
|
+
expectedDid: pointedDid
|
|
350
338
|
});
|
|
351
339
|
if (published === undefined) {
|
|
352
340
|
return { revoked: [], replaced: false, skipped: 'log-unreadable' };
|
|
@@ -389,9 +377,6 @@ async function retireLadderGenerationDelegations({ doc, accountDid, ladderSeed,
|
|
|
389
377
|
expectedDid: pointedDid,
|
|
390
378
|
accountDoc: doc,
|
|
391
379
|
retiringKeyMultibases: [ladderVmKey, retiringSigningKeyMultibase],
|
|
392
|
-
...(annex.pinStore !== undefined
|
|
393
|
-
? { pinStore: annex.pinStore, logId }
|
|
394
|
-
: {}),
|
|
395
380
|
now
|
|
396
381
|
});
|
|
397
382
|
// `replaced` reports what the stage actually wrote. A delegation the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forgetLast.js","sourceRoot":"","sources":["../../src/clientAnnex/forgetLast.ts"],"names":[],"mappings":"AA4HA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"forgetLast.js","sourceRoot":"","sources":["../../src/clientAnnex/forgetLast.ts"],"names":[],"mappings":"AA4HA,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EACL,mBAAmB,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AChE,UAAU;KACX,CAAC,EAAE,CAAA;IACJ,IAAI,CAAC,WAAW,CAAC,EAAE,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9D,MAAM,IAAI,KAAK,CACb,iEAAiE;YAC/D,kEAAkE;YAClE,oBAAoB,CACvB,CAAA;IACH,CAAC;AACH,CAAC"}
|
package/dist/clientAnnex/gc.d.ts
CHANGED
|
@@ -53,7 +53,6 @@
|
|
|
53
53
|
import type { DIDLog } from '@interop/did-method-webvh';
|
|
54
54
|
import type { ZcapClient } from '@interop/ezcap';
|
|
55
55
|
import type { WasClient } from '@interop/was-client';
|
|
56
|
-
import type { ResourceLogPinStore } from '@interop/vh-resource-log';
|
|
57
56
|
import type { AccountLogSigner } from '../webvh/accountEntry.js';
|
|
58
57
|
import type { ClientWebvhUpdateKeys, PublishedWebvhLog, WebvhIdStore } from '../webvh/didWebvh.js';
|
|
59
58
|
/**
|
|
@@ -156,6 +155,20 @@ export interface ClientAnnexGcReport {
|
|
|
156
155
|
error: unknown;
|
|
157
156
|
}>;
|
|
158
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* One generation swap's outcome: the fresh annex DID the account now points
|
|
160
|
+
* at, and what the revoke stage did with the old generation's embedded
|
|
161
|
+
* delegation -- `revoked` (the POST landed, or the server answered
|
|
162
|
+
* already-revoked), `no-delegation` (the old log stands and embeds none),
|
|
163
|
+
* or `log-absent` (the pointed log does not exist, so there were no bytes to
|
|
164
|
+
* revoke; pointer equality retires the delegation on a conforming server).
|
|
165
|
+
* Reported rather than folded into the DID so a caller can tell a swap that
|
|
166
|
+
* revoked from one that could not.
|
|
167
|
+
*/
|
|
168
|
+
export interface ClientAnnexGenerationSwap {
|
|
169
|
+
clientAnnexDid: string;
|
|
170
|
+
revoke: 'revoked' | 'no-delegation' | 'log-absent';
|
|
171
|
+
}
|
|
159
172
|
/**
|
|
160
173
|
* One annex GC pass: the quarterly swap when due and quiet, then the
|
|
161
174
|
* predicate-driven collect fan-out over every non-pointed `gen-` collection.
|
|
@@ -193,12 +206,10 @@ export interface ClientAnnexGcReport {
|
|
|
193
206
|
* `({ generationId }) => Promise<void>` -- local cleanup after a
|
|
194
207
|
* generation's delete (the caller's annex pin-slot drop); a throw is
|
|
195
208
|
* reported but cannot be retried (the collection is already gone)
|
|
196
|
-
* @param [options.pinStore] {ResourceLogPinStore} chain-head pins for the
|
|
197
|
-
* account-log re-point and the pointed generation's read
|
|
198
209
|
* @param [options.now] {number} epoch milliseconds, for tests
|
|
199
210
|
* @returns {Promise<ClientAnnexGcReport>}
|
|
200
211
|
*/
|
|
201
|
-
export declare function runClientAnnexGc({ was, wasServerUrl, accountSpaceId, account, idStore, updateKeys, zcapClient, ladderSeed, recordDigest, onCollected,
|
|
212
|
+
export declare function runClientAnnexGc({ was, wasServerUrl, accountSpaceId, account, idStore, updateKeys, zcapClient, ladderSeed, recordDigest, onCollected, now }: {
|
|
202
213
|
was: WasClient;
|
|
203
214
|
wasServerUrl: string;
|
|
204
215
|
accountSpaceId: string;
|
|
@@ -216,7 +227,6 @@ export declare function runClientAnnexGc({ was, wasServerUrl, accountSpaceId, ac
|
|
|
216
227
|
onCollected?: (options: {
|
|
217
228
|
generationId: string;
|
|
218
229
|
}) => Promise<void>;
|
|
219
|
-
pinStore?: ResourceLogPinStore;
|
|
220
230
|
now?: number;
|
|
221
231
|
}): Promise<ClientAnnexGcReport>;
|
|
222
232
|
/**
|
|
@@ -233,16 +243,21 @@ export declare function runClientAnnexGc({ was, wasServerUrl, accountSpaceId, ac
|
|
|
233
243
|
* Same four swap stages and ordering as the quarterly GC swap, minus the
|
|
234
244
|
* cadence and quiet gates (the caller's reason for swapping is authority
|
|
235
245
|
* removal, not hygiene). The pointed generation's log is read for the revoke
|
|
236
|
-
* stage's delegation bytes
|
|
237
|
-
*
|
|
246
|
+
* stage's delegation bytes. A pointed log that does not exist (a collected
|
|
247
|
+
* generation the pointer still names) carries no delegation to revoke, so
|
|
248
|
+
* the revoke is skipped and reported as `log-absent`, and pointer equality
|
|
249
|
+
* retires the old delegation on a conforming server; a served log that fails
|
|
250
|
+
* verification or falls behind this client's pin throws, since a swap over a
|
|
251
|
+
* log this client cannot trust would skip a revoke it may owe.
|
|
238
252
|
*
|
|
239
253
|
* @param options {object} see {@link runClientAnnexGc} for the shared
|
|
240
254
|
* members ({ was, wasServerUrl, accountSpaceId, account, idStore,
|
|
241
|
-
* updateKeys, zcapClient
|
|
255
|
+
* updateKeys, zcapClient }); `ladderSeed` here is the SURVIVING
|
|
242
256
|
* credential's seed the fresh generation is minted from
|
|
243
|
-
* @returns {Promise<
|
|
257
|
+
* @returns {Promise<ClientAnnexGenerationSwap>} the fresh annex DID and
|
|
258
|
+
* what the revoke stage did
|
|
244
259
|
*/
|
|
245
|
-
export declare function swapClientAnnexGeneration({ was, wasServerUrl, accountSpaceId, account, idStore, signer, zcapClient, ladderSeed
|
|
260
|
+
export declare function swapClientAnnexGeneration({ was, wasServerUrl, accountSpaceId, account, idStore, signer, zcapClient, ladderSeed }: {
|
|
246
261
|
was: WasClient;
|
|
247
262
|
wasServerUrl: string;
|
|
248
263
|
accountSpaceId: string;
|
|
@@ -251,6 +266,5 @@ export declare function swapClientAnnexGeneration({ was, wasServerUrl, accountSp
|
|
|
251
266
|
signer: AccountLogSigner;
|
|
252
267
|
zcapClient: ZcapClient;
|
|
253
268
|
ladderSeed: Uint8Array;
|
|
254
|
-
|
|
255
|
-
}): Promise<string>;
|
|
269
|
+
}): Promise<ClientAnnexGenerationSwap>;
|
|
256
270
|
//# sourceMappingURL=gc.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gc.d.ts","sourceRoot":"","sources":["../../src/clientAnnex/gc.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,OAAO,KAAK,EAAE,MAAM,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AA;QAClB,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACnB,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAClE,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAwG/B;AA6JD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,yBAAyB,CAAC,EAC9C,GAAG,EACH,YAAY,EACZ,cAAc,EACd,OAAO,EACP,OAAO,EACP,MAAM,EACN,UAAU,EACV,UAAU,EACX,EAAE;IACD,GAAG,EAAE,SAAS,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,MAAM,CAAA;IACtB,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAAE,KAAK,GAAG,KAAK,CAAC,CAAA;IAC/C,OAAO,EAAE,YAAY,CAAA;IACrB,MAAM,EAAE,gBAAgB,CAAA;IACxB,UAAU,EAAE,UAAU,CAAA;IACtB,UAAU,EAAE,UAAU,CAAA;CACvB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CA4BrC"}
|
package/dist/clientAnnex/gc.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { clientAnnexDidParts,
|
|
2
|
-
import { readPublishedLog } from '../webvh/didWebvh.js';
|
|
3
|
-
import { accountLogPinId } from '../webvh/verifyLog.js';
|
|
1
|
+
import { clientAnnexDidParts, clientAnnexLogStore, delegatedClientsPointer, embeddedGenerationDelegation, ensureGenerationDelegationCurrent, GENERATION_ID_PREFIX, mintCredentialClientAnnexGeneration, mintGenerationDelegation, readClientAnnexLogOrAbsent, revokeTreatingAlreadyRevokedAsSuccess, setDelegatedClientsPointer } from './log.js';
|
|
4
2
|
/**
|
|
5
3
|
* The fixed GC cadence: a generation is replaced at the first remembered login
|
|
6
4
|
* 90 days after the current pointer value was established. Wallet GC policy
|
|
@@ -135,16 +133,17 @@ export function generationQuiet({ log, now = Date.now() }) {
|
|
|
135
133
|
* `({ generationId }) => Promise<void>` -- local cleanup after a
|
|
136
134
|
* generation's delete (the caller's annex pin-slot drop); a throw is
|
|
137
135
|
* reported but cannot be retried (the collection is already gone)
|
|
138
|
-
* @param [options.pinStore] {ResourceLogPinStore} chain-head pins for the
|
|
139
|
-
* account-log re-point and the pointed generation's read
|
|
140
136
|
* @param [options.now] {number} epoch milliseconds, for tests
|
|
141
137
|
* @returns {Promise<ClientAnnexGcReport>}
|
|
142
138
|
*/
|
|
143
|
-
export async function runClientAnnexGc({ was, wasServerUrl, accountSpaceId, account, idStore, updateKeys, zcapClient, ladderSeed, recordDigest, onCollected,
|
|
139
|
+
export async function runClientAnnexGc({ was, wasServerUrl, accountSpaceId, account, idStore, updateKeys, zcapClient, ladderSeed, recordDigest, onCollected, now = Date.now() }) {
|
|
144
140
|
const pointedDid = delegatedClientsPointer({ doc: account.doc });
|
|
145
141
|
if (pointedDid === undefined) {
|
|
146
142
|
return { swap: 'no-pointer', collected: [], failed: [] };
|
|
147
143
|
}
|
|
144
|
+
// The annex logs pin in the same store the account log does: one pin
|
|
145
|
+
// store per client, every slot derived by the store that serves it.
|
|
146
|
+
const pinStore = idStore.pin.store;
|
|
148
147
|
const { spaceId } = clientAnnexDidParts({ did: pointedDid });
|
|
149
148
|
const failed = [];
|
|
150
149
|
// 1. The swap, when the quarterly cadence is due. Its own failure is
|
|
@@ -164,8 +163,8 @@ export async function runClientAnnexGc({ was, wasServerUrl, accountSpaceId, acco
|
|
|
164
163
|
was,
|
|
165
164
|
spaceId,
|
|
166
165
|
generationId: oldParts.generationId,
|
|
167
|
-
|
|
168
|
-
|
|
166
|
+
pinStore,
|
|
167
|
+
expectedDid: pointedDid
|
|
169
168
|
});
|
|
170
169
|
if (old === undefined ||
|
|
171
170
|
!generationQuiet({ log: old.log, now })) {
|
|
@@ -175,7 +174,7 @@ export async function runClientAnnexGc({ was, wasServerUrl, accountSpaceId, acco
|
|
|
175
174
|
// read as quiet.
|
|
176
175
|
return old === undefined ? 'failed' : 'deferred-live';
|
|
177
176
|
}
|
|
178
|
-
currentDid = await replaceClientAnnexGeneration({
|
|
177
|
+
currentDid = (await replaceClientAnnexGeneration({
|
|
179
178
|
was,
|
|
180
179
|
wasServerUrl,
|
|
181
180
|
accountSpaceId,
|
|
@@ -185,9 +184,8 @@ export async function runClientAnnexGc({ was, wasServerUrl, accountSpaceId, acco
|
|
|
185
184
|
zcapClient,
|
|
186
185
|
ladderSeed,
|
|
187
186
|
clientAnnexSpaceId: spaceId,
|
|
188
|
-
oldGeneration: old
|
|
189
|
-
|
|
190
|
-
});
|
|
187
|
+
oldGeneration: old
|
|
188
|
+
})).clientAnnexDid;
|
|
191
189
|
return 'replaced';
|
|
192
190
|
}
|
|
193
191
|
catch (err) {
|
|
@@ -221,6 +219,7 @@ export async function runClientAnnexGc({ was, wasServerUrl, accountSpaceId, acco
|
|
|
221
219
|
was,
|
|
222
220
|
spaceId,
|
|
223
221
|
generationId,
|
|
222
|
+
pinStore,
|
|
224
223
|
recordDigest,
|
|
225
224
|
onCollected
|
|
226
225
|
});
|
|
@@ -235,24 +234,24 @@ export async function runClientAnnexGc({ was, wasServerUrl, accountSpaceId, acco
|
|
|
235
234
|
/**
|
|
236
235
|
* Reads and verifies one generation's published annex log, or resolves
|
|
237
236
|
* undefined when its `did.jsonl` does not exist (a generation that never
|
|
238
|
-
* finished minting, or whose collection outlived a torn delete).
|
|
237
|
+
* finished minting, or whose collection outlived a torn delete). Absence is
|
|
238
|
+
* read as absence even under a held pin ({@link readClientAnnexLogOrAbsent}):
|
|
239
|
+
* a torn collect whose slot drop never ran must still collect.
|
|
239
240
|
*
|
|
240
241
|
* @param options {object}
|
|
241
242
|
* @param options.was {WasClient}
|
|
242
243
|
* @param options.spaceId {string} the auxiliary annex Space's id
|
|
243
244
|
* @param options.generationId {string}
|
|
245
|
+
* @param options.pinStore {ResourceLogPinStore} this client's chain-head
|
|
246
|
+
* pins (the account-log store's); the store derives the generation log's
|
|
247
|
+
* slot
|
|
244
248
|
* @param [options.expectedDid] {string}
|
|
245
|
-
* @param [options.pinStore] {ResourceLogPinStore}
|
|
246
249
|
* @returns {Promise<PublishedWebvhLog | undefined>}
|
|
247
250
|
*/
|
|
248
|
-
async function readClientAnnexGeneration({ was, spaceId, generationId,
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
...(expectedDid !== undefined ? { expectedDid } : {}),
|
|
253
|
-
...(pinStore !== undefined
|
|
254
|
-
? { pinStore, logId: clientAnnexLogPinId({ spaceId, generationId }) }
|
|
255
|
-
: {})
|
|
251
|
+
async function readClientAnnexGeneration({ was, spaceId, generationId, pinStore, expectedDid }) {
|
|
252
|
+
return readClientAnnexLogOrAbsent({
|
|
253
|
+
store: clientAnnexLogStore({ was, spaceId, generationId, pinStore }),
|
|
254
|
+
...(expectedDid !== undefined ? { expectedDid } : {})
|
|
256
255
|
});
|
|
257
256
|
}
|
|
258
257
|
/**
|
|
@@ -268,12 +267,14 @@ async function readClientAnnexGeneration({ was, spaceId, generationId, expectedD
|
|
|
268
267
|
* @param options.clientAnnexSpaceId {string} the auxiliary Space's id
|
|
269
268
|
* @param [options.oldGeneration] {PublishedWebvhLog} the pointed
|
|
270
269
|
* generation's verified log, read by the quiet check; absent (an
|
|
271
|
-
* off-cadence swap whose pointed log
|
|
270
|
+
* off-cadence swap whose pointed log does not exist), the revoke stage is
|
|
272
271
|
* skipped and the old generation's delegation dies with the re-point on a
|
|
273
272
|
* conforming server
|
|
274
|
-
* @returns {Promise<
|
|
273
|
+
* @returns {Promise<ClientAnnexGenerationSwap>} the fresh annex DID and
|
|
274
|
+
* what the revoke stage did
|
|
275
275
|
*/
|
|
276
|
-
async function replaceClientAnnexGeneration({ was, wasServerUrl, accountSpaceId, account, idStore, signer, zcapClient, ladderSeed, clientAnnexSpaceId, oldGeneration
|
|
276
|
+
async function replaceClientAnnexGeneration({ was, wasServerUrl, accountSpaceId, account, idStore, signer, zcapClient, ladderSeed, clientAnnexSpaceId, oldGeneration }) {
|
|
277
|
+
const pinStore = idStore.pin.store;
|
|
277
278
|
// 1. Mint + genesis: a fresh generation in the existing auxiliary Space
|
|
278
279
|
// (the typed-Space ensure no-ops on it; the controller argument is only
|
|
279
280
|
// read when the Space does not exist). The genesis commits the minting
|
|
@@ -283,7 +284,8 @@ async function replaceClientAnnexGeneration({ was, wasServerUrl, accountSpaceId,
|
|
|
283
284
|
wasServerUrl,
|
|
284
285
|
spaceId: clientAnnexSpaceId,
|
|
285
286
|
controller: account.did,
|
|
286
|
-
ladderSeed
|
|
287
|
+
ladderSeed,
|
|
288
|
+
pinStore
|
|
287
289
|
});
|
|
288
290
|
// 2. Install the fresh generation's delegation service entry (the
|
|
289
291
|
// install-when-absent half of the renew-precedes-mint helper), the
|
|
@@ -301,7 +303,8 @@ async function replaceClientAnnexGeneration({ was, wasServerUrl, accountSpaceId,
|
|
|
301
303
|
store: clientAnnexLogStore({
|
|
302
304
|
was,
|
|
303
305
|
spaceId: clientAnnexSpaceId,
|
|
304
|
-
generationId: minted.generationId
|
|
306
|
+
generationId: minted.generationId,
|
|
307
|
+
pinStore
|
|
305
308
|
}),
|
|
306
309
|
ladderSeed,
|
|
307
310
|
generationId: minted.generationId,
|
|
@@ -312,16 +315,7 @@ async function replaceClientAnnexGeneration({ was, wasServerUrl, accountSpaceId,
|
|
|
312
315
|
clientAnnexDid
|
|
313
316
|
}),
|
|
314
317
|
expectedDid: minted.did,
|
|
315
|
-
...(minted.etag !== undefined ? { published: minted } : {})
|
|
316
|
-
...(pinStore !== undefined
|
|
317
|
-
? {
|
|
318
|
-
pinStore,
|
|
319
|
-
logId: clientAnnexLogPinId({
|
|
320
|
-
spaceId: clientAnnexSpaceId,
|
|
321
|
-
generationId: minted.generationId
|
|
322
|
-
})
|
|
323
|
-
}
|
|
324
|
-
: {})
|
|
318
|
+
...(minted.etag !== undefined ? { published: minted } : {})
|
|
325
319
|
});
|
|
326
320
|
// 3. Revoke the old generation's delegation, before the re-point (the
|
|
327
321
|
// revocation POST verifies against the currently resolved document, so it
|
|
@@ -330,12 +324,16 @@ async function replaceClientAnnexGeneration({ was, wasServerUrl, accountSpaceId,
|
|
|
330
324
|
const oldDelegation = oldGeneration === undefined
|
|
331
325
|
? undefined
|
|
332
326
|
: embeddedGenerationDelegation({ doc: oldGeneration.doc });
|
|
327
|
+
let revoke = 'revoked';
|
|
333
328
|
if (oldDelegation !== undefined) {
|
|
334
329
|
await revokeTreatingAlreadyRevokedAsSuccess({
|
|
335
330
|
revoke: zcap => was.revoke(zcap),
|
|
336
331
|
delegation: oldDelegation
|
|
337
332
|
});
|
|
338
333
|
}
|
|
334
|
+
else {
|
|
335
|
+
revoke = oldGeneration === undefined ? 'log-absent' : 'no-delegation';
|
|
336
|
+
}
|
|
339
337
|
// 4. Re-point the account document at the fresh generation. On a
|
|
340
338
|
// conforming server the pointer equality itself kills the old
|
|
341
339
|
// generation's delegations; the explicit revoke above covered the
|
|
@@ -344,12 +342,9 @@ async function replaceClientAnnexGeneration({ was, wasServerUrl, accountSpaceId,
|
|
|
344
342
|
idStore,
|
|
345
343
|
signer,
|
|
346
344
|
clientAnnexDid: minted.did,
|
|
347
|
-
expectedDid: account.did
|
|
348
|
-
...(pinStore !== undefined
|
|
349
|
-
? { pinStore, logId: accountLogPinId({ spaceId: accountSpaceId }) }
|
|
350
|
-
: {})
|
|
345
|
+
expectedDid: account.did
|
|
351
346
|
});
|
|
352
|
-
return minted.did;
|
|
347
|
+
return { clientAnnexDid: minted.did, revoke };
|
|
353
348
|
}
|
|
354
349
|
/**
|
|
355
350
|
* AN OFF-CADENCE GENERATION SWAP: replaces the pointed annex generation
|
|
@@ -365,16 +360,21 @@ async function replaceClientAnnexGeneration({ was, wasServerUrl, accountSpaceId,
|
|
|
365
360
|
* Same four swap stages and ordering as the quarterly GC swap, minus the
|
|
366
361
|
* cadence and quiet gates (the caller's reason for swapping is authority
|
|
367
362
|
* removal, not hygiene). The pointed generation's log is read for the revoke
|
|
368
|
-
* stage's delegation bytes
|
|
369
|
-
*
|
|
363
|
+
* stage's delegation bytes. A pointed log that does not exist (a collected
|
|
364
|
+
* generation the pointer still names) carries no delegation to revoke, so
|
|
365
|
+
* the revoke is skipped and reported as `log-absent`, and pointer equality
|
|
366
|
+
* retires the old delegation on a conforming server; a served log that fails
|
|
367
|
+
* verification or falls behind this client's pin throws, since a swap over a
|
|
368
|
+
* log this client cannot trust would skip a revoke it may owe.
|
|
370
369
|
*
|
|
371
370
|
* @param options {object} see {@link runClientAnnexGc} for the shared
|
|
372
371
|
* members ({ was, wasServerUrl, accountSpaceId, account, idStore,
|
|
373
|
-
* updateKeys, zcapClient
|
|
372
|
+
* updateKeys, zcapClient }); `ladderSeed` here is the SURVIVING
|
|
374
373
|
* credential's seed the fresh generation is minted from
|
|
375
|
-
* @returns {Promise<
|
|
374
|
+
* @returns {Promise<ClientAnnexGenerationSwap>} the fresh annex DID and
|
|
375
|
+
* what the revoke stage did
|
|
376
376
|
*/
|
|
377
|
-
export async function swapClientAnnexGeneration({ was, wasServerUrl, accountSpaceId, account, idStore, signer, zcapClient, ladderSeed
|
|
377
|
+
export async function swapClientAnnexGeneration({ was, wasServerUrl, accountSpaceId, account, idStore, signer, zcapClient, ladderSeed }) {
|
|
378
378
|
const pointedDid = delegatedClientsPointer({ doc: account.doc });
|
|
379
379
|
if (pointedDid === undefined) {
|
|
380
380
|
throw new Error('clientAnnex: the account document carries no delegated-clients ' +
|
|
@@ -385,8 +385,8 @@ export async function swapClientAnnexGeneration({ was, wasServerUrl, accountSpac
|
|
|
385
385
|
was,
|
|
386
386
|
spaceId,
|
|
387
387
|
generationId,
|
|
388
|
-
|
|
389
|
-
|
|
388
|
+
pinStore: idStore.pin.store,
|
|
389
|
+
expectedDid: pointedDid
|
|
390
390
|
});
|
|
391
391
|
return replaceClientAnnexGeneration({
|
|
392
392
|
was,
|
|
@@ -398,8 +398,7 @@ export async function swapClientAnnexGeneration({ was, wasServerUrl, accountSpac
|
|
|
398
398
|
zcapClient,
|
|
399
399
|
ladderSeed,
|
|
400
400
|
clientAnnexSpaceId: spaceId,
|
|
401
|
-
...(oldGeneration !== undefined ? { oldGeneration } : {})
|
|
402
|
-
...(pinStore !== undefined ? { pinStore } : {})
|
|
401
|
+
...(oldGeneration !== undefined ? { oldGeneration } : {})
|
|
403
402
|
});
|
|
404
403
|
}
|
|
405
404
|
/**
|
|
@@ -415,19 +414,23 @@ export async function swapClientAnnexGeneration({ was, wasServerUrl, accountSpac
|
|
|
415
414
|
* @param options.was {WasClient}
|
|
416
415
|
* @param options.spaceId {string}
|
|
417
416
|
* @param options.generationId {string}
|
|
417
|
+
* @param options.pinStore {ResourceLogPinStore} the account-log store's
|
|
418
|
+
* pin store
|
|
418
419
|
* @param options.recordDigest {Function} see {@link runClientAnnexGc}
|
|
419
420
|
* @param [options.onCollected] {Function} see {@link runClientAnnexGc}
|
|
420
421
|
* @returns {Promise<void>}
|
|
421
422
|
*/
|
|
422
|
-
async function collectOneGeneration({ was, spaceId, generationId, recordDigest, onCollected }) {
|
|
423
|
-
// No
|
|
424
|
-
//
|
|
425
|
-
//
|
|
426
|
-
//
|
|
423
|
+
async function collectOneGeneration({ was, spaceId, generationId, pinStore, recordDigest, onCollected }) {
|
|
424
|
+
// No expectedDid: an orphan was possibly never pointed from this client.
|
|
425
|
+
// The read runs under the store's own chain-head pin; the slot it
|
|
426
|
+
// establishes is the caller's to drop (`onCollected`) with the generation.
|
|
427
|
+
// The log still fully verifies (hash chain, prerotation, rung signatures)
|
|
428
|
+
// -- the digest quotes only a log that resolves.
|
|
427
429
|
const published = await readClientAnnexGeneration({
|
|
428
430
|
was,
|
|
429
431
|
spaceId,
|
|
430
|
-
generationId
|
|
432
|
+
generationId,
|
|
433
|
+
pinStore
|
|
431
434
|
});
|
|
432
435
|
if (published !== undefined) {
|
|
433
436
|
const oldDelegation = embeddedGenerationDelegation({ doc: published.doc });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gc.js","sourceRoot":"","sources":["../../src/clientAnnex/gc.ts"],"names":[],"mappings":"AAwDA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,
|
|
1
|
+
{"version":3,"file":"gc.js","sourceRoot":"","sources":["../../src/clientAnnex/gc.ts"],"names":[],"mappings":"AAwDA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,4BAA4B,EAC5B,iCAAiC,EACjC,oBAAoB,EACpB,mCAAmC,EACnC,wBAAwB,EACxB,0BAA0B,EAC1B,qCAAqC,EACrC,0BAA0B,EAC3B,MAAM,UAAU,CAAA;AAQjB;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;AAE/D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;AAE5D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;AAEvD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,oCAAoC,CAAC,EACnD,GAAG,EAGJ;IACC,IAAI,aAAiC,CAAA;IACrC,IAAI,QAA4B,CAAA;IAChC,KAAK,MAAM,KAAK,IAAI,GAAG,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,uBAAuB,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAA;QAC7D,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;YAClD,aAAa,GAAG,KAAK,CAAC,WAAW,CAAA;QACnC,CAAC;QACD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,mEAAmE;YACnE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