@interop/wallet-core 0.66.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/README.md +12 -8
- package/dist/clientAnnex/credentialAnchoredGenesis.d.ts +6 -10
- package/dist/clientAnnex/credentialAnchoredGenesis.d.ts.map +1 -1
- package/dist/clientAnnex/credentialAnchoredGenesis.js +34 -56
- package/dist/clientAnnex/credentialAnchoredGenesis.js.map +1 -1
- package/dist/clientAnnex/establish.d.ts +46 -29
- package/dist/clientAnnex/establish.d.ts.map +1 -1
- package/dist/clientAnnex/establish.js +111 -86
- 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 +13 -24
- package/dist/clientAnnex/forget.js.map +1 -1
- package/dist/clientAnnex/forgetLast.d.ts +33 -129
- package/dist/clientAnnex/forgetLast.d.ts.map +1 -1
- package/dist/clientAnnex/forgetLast.js +43 -182
- 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 +75 -18
- package/dist/clientAnnex/heal.d.ts.map +1 -1
- package/dist/clientAnnex/heal.js +79 -147
- package/dist/clientAnnex/heal.js.map +1 -1
- package/dist/clientAnnex/index.d.ts +8 -8
- package/dist/clientAnnex/index.d.ts.map +1 -1
- package/dist/clientAnnex/index.js +5 -5
- package/dist/clientAnnex/index.js.map +1 -1
- package/dist/clientAnnex/ladder.d.ts +51 -4
- package/dist/clientAnnex/ladder.d.ts.map +1 -1
- package/dist/clientAnnex/ladder.js +283 -47
- package/dist/clientAnnex/ladder.js.map +1 -1
- package/dist/clientAnnex/ladderAnchored.d.ts +62 -73
- package/dist/clientAnnex/ladderAnchored.d.ts.map +1 -1
- package/dist/clientAnnex/ladderAnchored.js +103 -117
- package/dist/clientAnnex/ladderAnchored.js.map +1 -1
- package/dist/clientAnnex/log.d.ts +123 -125
- package/dist/clientAnnex/log.d.ts.map +1 -1
- package/dist/clientAnnex/log.js +174 -233
- 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 +50 -51
- package/dist/clientAnnex/mend.js.map +1 -1
- package/dist/clientAnnex/recoveryLadderAnchored.d.ts +25 -13
- package/dist/clientAnnex/recoveryLadderAnchored.d.ts.map +1 -1
- package/dist/clientAnnex/recoveryLadderAnchored.js +80 -303
- package/dist/clientAnnex/recoveryLadderAnchored.js.map +1 -1
- package/dist/clientAnnex/rosterDeliveredEpochs.d.ts +13 -5
- package/dist/clientAnnex/rosterDeliveredEpochs.d.ts.map +1 -1
- package/dist/clientAnnex/rosterDeliveredEpochs.js +18 -9
- package/dist/clientAnnex/rosterDeliveredEpochs.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 +13 -18
- package/dist/clientAnnex/selfEnroll.js.map +1 -1
- package/dist/clientAnnex/zcap.d.ts +19 -0
- package/dist/clientAnnex/zcap.d.ts.map +1 -1
- package/dist/clientAnnex/zcap.js +80 -12
- package/dist/clientAnnex/zcap.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.map +1 -1
- package/dist/clients/listing.js +33 -15
- package/dist/clients/listing.js.map +1 -1
- package/dist/clients/policy.d.ts +18 -0
- package/dist/clients/policy.d.ts.map +1 -1
- package/dist/clients/policy.js +22 -8
- package/dist/clients/policy.js.map +1 -1
- package/dist/clients/revocation.d.ts +18 -30
- package/dist/clients/revocation.d.ts.map +1 -1
- package/dist/clients/revocation.js +12 -27
- package/dist/clients/revocation.js.map +1 -1
- package/dist/clients/rosterPolicy.d.ts +6 -1
- package/dist/clients/rosterPolicy.d.ts.map +1 -1
- package/dist/clients/rosterPolicy.js +27 -30
- package/dist/clients/rosterPolicy.js.map +1 -1
- package/dist/descriptors/errors.d.ts +6 -5
- package/dist/descriptors/errors.d.ts.map +1 -1
- package/dist/descriptors/errors.js +6 -5
- package/dist/descriptors/errors.js.map +1 -1
- package/dist/descriptors/index.d.ts +7 -3
- package/dist/descriptors/index.d.ts.map +1 -1
- package/dist/descriptors/index.js +7 -3
- package/dist/descriptors/index.js.map +1 -1
- package/dist/descriptors/logSource.d.ts +28 -6
- package/dist/descriptors/logSource.d.ts.map +1 -1
- package/dist/descriptors/logSource.js +33 -7
- package/dist/descriptors/logSource.js.map +1 -1
- package/dist/enrollment/enrollment.d.ts.map +1 -1
- package/dist/enrollment/enrollment.js +3 -7
- package/dist/enrollment/enrollment.js.map +1 -1
- package/dist/genesis/accountGenesis.d.ts +11 -16
- package/dist/genesis/accountGenesis.d.ts.map +1 -1
- package/dist/genesis/accountGenesis.js +43 -47
- package/dist/genesis/accountGenesis.js.map +1 -1
- package/dist/genesis/kmsAuthentication.d.ts +50 -0
- package/dist/genesis/kmsAuthentication.d.ts.map +1 -0
- package/dist/genesis/kmsAuthentication.js +49 -0
- package/dist/genesis/kmsAuthentication.js.map +1 -0
- package/dist/keyring/kdf.d.ts +16 -20
- package/dist/keyring/kdf.d.ts.map +1 -1
- package/dist/keyring/kdf.js +2 -2
- package/dist/keyring/kdf.js.map +1 -1
- package/dist/keyring/unlockSpace.d.ts +8 -30
- package/dist/keyring/unlockSpace.d.ts.map +1 -1
- package/dist/keyring/unlockSpace.js +8 -31
- package/dist/keyring/unlockSpace.js.map +1 -1
- package/dist/keys/clientKeyRecord.d.ts +2 -1
- package/dist/keys/clientKeyRecord.d.ts.map +1 -1
- package/dist/keys/clientKeyRecord.js +28 -11
- package/dist/keys/clientKeyRecord.js.map +1 -1
- package/dist/keys/index.d.ts +6 -2
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +5 -1
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/rosterLogStore.d.ts.map +1 -1
- package/dist/keys/rosterLogStore.js +14 -5
- package/dist/keys/rosterLogStore.js.map +1 -1
- package/dist/keys/spaceEpochs.d.ts +92 -3
- package/dist/keys/spaceEpochs.d.ts.map +1 -1
- package/dist/keys/spaceEpochs.js +110 -4
- package/dist/keys/spaceEpochs.js.map +1 -1
- package/dist/keys/userKeyRoster.d.ts +30 -3
- package/dist/keys/userKeyRoster.d.ts.map +1 -1
- package/dist/keys/userKeyRoster.js +90 -15
- package/dist/keys/userKeyRoster.js.map +1 -1
- package/dist/keys/userKeyRosterCascade.d.ts.map +1 -1
- package/dist/keys/userKeyRosterCascade.js +5 -1
- package/dist/keys/userKeyRosterCascade.js.map +1 -1
- package/dist/recovery/continuation.d.ts +250 -0
- package/dist/recovery/continuation.d.ts.map +1 -0
- package/dist/recovery/continuation.js +467 -0
- package/dist/recovery/continuation.js.map +1 -0
- package/dist/recovery/index.d.ts +12 -8
- package/dist/recovery/index.d.ts.map +1 -1
- package/dist/recovery/index.js +11 -7
- package/dist/recovery/index.js.map +1 -1
- package/dist/recovery/recoveryDelegation.d.ts +23 -126
- package/dist/recovery/recoveryDelegation.d.ts.map +1 -1
- package/dist/recovery/recoveryDelegation.js +1 -266
- package/dist/recovery/recoveryDelegation.js.map +1 -1
- package/dist/recovery/recoveryWebvh.d.ts +52 -107
- package/dist/recovery/recoveryWebvh.d.ts.map +1 -1
- package/dist/recovery/recoveryWebvh.js +54 -403
- package/dist/recovery/recoveryWebvh.js.map +1 -1
- package/dist/request/classify.d.ts +3 -14
- package/dist/request/classify.d.ts.map +1 -1
- package/dist/request/classify.js +19 -40
- package/dist/request/classify.js.map +1 -1
- package/dist/request/index.d.ts +1 -0
- package/dist/request/index.d.ts.map +1 -1
- package/dist/request/index.js +1 -0
- package/dist/request/index.js.map +1 -1
- package/dist/request/onboarding.d.ts.map +1 -1
- package/dist/request/onboarding.js +19 -27
- package/dist/request/onboarding.js.map +1 -1
- package/dist/request/parse.d.ts +5 -3
- package/dist/request/parse.d.ts.map +1 -1
- package/dist/request/parse.js +7 -6
- package/dist/request/parse.js.map +1 -1
- package/dist/request/processRequest.d.ts.map +1 -1
- package/dist/request/processRequest.js +2 -1
- package/dist/request/processRequest.js.map +1 -1
- package/dist/request/queryPredicates.d.ts +98 -0
- package/dist/request/queryPredicates.d.ts.map +1 -0
- package/dist/request/queryPredicates.js +107 -0
- package/dist/request/queryPredicates.js.map +1 -0
- package/dist/resourceLog/document.d.ts +39 -0
- package/dist/resourceLog/document.d.ts.map +1 -1
- package/dist/resourceLog/document.js +41 -0
- package/dist/resourceLog/document.js.map +1 -1
- package/dist/resourceLog/index.d.ts +2 -2
- package/dist/resourceLog/index.js +2 -2
- package/dist/resourceLog/ladderRungs.d.ts.map +1 -1
- package/dist/resourceLog/ladderRungs.js +3 -2
- package/dist/resourceLog/ladderRungs.js.map +1 -1
- package/dist/sync/contactsConflict.d.ts.map +1 -1
- package/dist/sync/contactsConflict.js +8 -2
- package/dist/sync/contactsConflict.js.map +1 -1
- package/dist/sync/engine.d.ts +38 -23
- package/dist/sync/engine.d.ts.map +1 -1
- package/dist/sync/engine.js +36 -5
- package/dist/sync/engine.js.map +1 -1
- package/dist/sync/index.d.ts +9 -12
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +8 -11
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/push.d.ts.map +1 -1
- package/dist/sync/push.js +1 -2
- package/dist/sync/push.js.map +1 -1
- package/dist/sync/remint.d.ts +0 -31
- package/dist/sync/remint.d.ts.map +1 -1
- package/dist/sync/remint.js +32 -1
- package/dist/sync/remint.js.map +1 -1
- package/dist/sync/types.d.ts +4 -41
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/sync/types.js +4 -47
- package/dist/sync/types.js.map +1 -1
- package/dist/unlock/index.d.ts +1 -1
- package/dist/unlock/index.d.ts.map +1 -1
- package/dist/unlock/index.js +1 -1
- package/dist/unlock/index.js.map +1 -1
- package/dist/unlock/retire.d.ts +16 -64
- package/dist/unlock/retire.d.ts.map +1 -1
- package/dist/unlock/retire.js +7 -86
- package/dist/unlock/retire.js.map +1 -1
- package/dist/unlock/standingWebvh.d.ts +27 -61
- package/dist/unlock/standingWebvh.d.ts.map +1 -1
- package/dist/unlock/standingWebvh.js +40 -92
- package/dist/unlock/standingWebvh.js.map +1 -1
- package/dist/unlock/unlockRecord.d.ts.map +1 -1
- package/dist/unlock/unlockRecord.js +69 -44
- package/dist/unlock/unlockRecord.js.map +1 -1
- package/dist/webvh/accountEntry.d.ts +68 -19
- package/dist/webvh/accountEntry.d.ts.map +1 -1
- package/dist/webvh/accountEntry.js +117 -37
- package/dist/webvh/accountEntry.js.map +1 -1
- package/dist/webvh/delegatedLogStore.d.ts +24 -13
- package/dist/webvh/delegatedLogStore.d.ts.map +1 -1
- package/dist/webvh/delegatedLogStore.js +40 -11
- package/dist/webvh/delegatedLogStore.js.map +1 -1
- package/dist/webvh/didWebvh.d.ts +91 -86
- package/dist/webvh/didWebvh.d.ts.map +1 -1
- package/dist/webvh/didWebvh.js +117 -142
- 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 +22 -31
- package/dist/webvh/enrollClient.js.map +1 -1
- package/dist/webvh/index.d.ts +12 -8
- package/dist/webvh/index.d.ts.map +1 -1
- package/dist/webvh/index.js +10 -7
- package/dist/webvh/index.js.map +1 -1
- package/dist/webvh/listClients.d.ts.map +1 -1
- package/dist/webvh/listClients.js +102 -65
- package/dist/webvh/listClients.js.map +1 -1
- package/dist/webvh/mergeMethods.d.ts +84 -0
- package/dist/webvh/mergeMethods.d.ts.map +1 -0
- package/dist/webvh/mergeMethods.js +46 -0
- package/dist/webvh/mergeMethods.js.map +1 -0
- package/dist/webvh/revokeClient.d.ts +15 -11
- package/dist/webvh/revokeClient.d.ts.map +1 -1
- package/dist/webvh/revokeClient.js +130 -57
- package/dist/webvh/revokeClient.js.map +1 -1
- package/dist/webvh/verifyLog.d.ts +45 -4
- package/dist/webvh/verifyLog.d.ts.map +1 -1
- package/dist/webvh/verifyLog.js +62 -21
- 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 +11 -11
|
@@ -1,22 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* The transient-recovery continuation -- the ladder-anchored variant of the
|
|
6
|
-
* recovery subpath's `recoverWebvhClient`, split out beside the rest of the
|
|
7
|
-
* annex-anchored ceremonies: a code spent on a non-remembered browser mints
|
|
8
|
-
* no enrolled client, and the ladder VM the fresh credential's own bind
|
|
9
|
-
* publishes is what anchors the account, so it lands client-less and
|
|
10
|
-
* ladder-anchored. The enrolled-client
|
|
11
|
-
* continuation and the recovery-key inventory edits stay in
|
|
12
|
-
* `recovery/recoveryWebvh.ts`.
|
|
13
|
-
*/
|
|
14
|
-
import { deriveNextKeyHash, updateDID } from '@interop/did-method-webvh';
|
|
15
|
-
import { assertCarryOverCommitments, ladderVerificationMethod, MULTIKEY_VM_TYPE, publishEntryPinned, readPublishedLogOrThrow, updateKeySigner, withLogConflictRetry } from '../webvh/didWebvh.js';
|
|
16
|
-
import { credentialKeyAgreementMethods, ladderVmIds, relationIds } from '../resourceLog/document.js';
|
|
1
|
+
import { ladderVerificationMethod, withLogConflictRetry } from '../webvh/didWebvh.js';
|
|
17
2
|
import { unlockKeyVerificationMethod, unlockKeyVmId } from '../unlock/standingWebvh.js';
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
3
|
+
import { recoveryContinuationOnce } from '../recovery/continuation.js';
|
|
4
|
+
import { ladderRung, ladderVmKeyMultibase } from './ladder.js';
|
|
20
5
|
import { clientAnnexDidParts, servicesPointedAtClientAnnex } from './log.js';
|
|
21
6
|
/**
|
|
22
7
|
* THE TRANSIENT-RECOVERY CONTINUATION (run by the code-derived client through
|
|
@@ -88,8 +73,18 @@ import { clientAnnexDidParts, servicesPointedAtClientAnnex } from './log.js';
|
|
|
88
73
|
* completed branch WITHOUT re-entering `onCommitted`, so it must be able to
|
|
89
74
|
* treat an already-complete continuation as success on its own.
|
|
90
75
|
*
|
|
76
|
+
* A fresh credential whose `keyAgreement` id already stands in the document
|
|
77
|
+
* (the same passphrase re-typed) is refused before the reveal entry with
|
|
78
|
+
* `RecoveryCredentialStandingError`: this entry retires every pre-recovery
|
|
79
|
+
* credential, and one it re-bound instead would keep its old rung
|
|
80
|
+
* commitments under a struck ladder VM.
|
|
81
|
+
*
|
|
91
82
|
* @param options {object}
|
|
92
|
-
* @param options.store {RecoveryLogStore} public log read + delegated PUT
|
|
83
|
+
* @param options.store {RecoveryLogStore} public log read + delegated PUT.
|
|
84
|
+
* Every read both entries are built on is checked against the store's
|
|
85
|
+
* chain-head pin (a served prefix is refused before the reveal entry lands,
|
|
86
|
+
* not only by a verify that follows both entries), and the pin advances to
|
|
87
|
+
* each entry as it publishes
|
|
93
88
|
* @param options.recovery {object} the spent code's update seed and public
|
|
94
89
|
* halves
|
|
95
90
|
* @param options.recovery.updateSeed {Uint8Array}
|
|
@@ -113,14 +108,6 @@ import { clientAnnexDidParts, servicesPointedAtClientAnnex } from './log.js';
|
|
|
113
108
|
* REQUIRED: the add entry points the `#DelegatedClients` service entry at
|
|
114
109
|
* it, and a caller that named no generation would republish the stranding
|
|
115
110
|
* this ordering exists to prevent
|
|
116
|
-
* @param [options.pinStore] {ResourceLogPinStore} this caller's chain-head
|
|
117
|
-
* pins; every read both entries are built on is checked against the pinned
|
|
118
|
-
* head (a served prefix is refused before the reveal entry lands, not only
|
|
119
|
-
* by a verify that follows both entries), and the pin advances to each
|
|
120
|
-
* entry as it publishes
|
|
121
|
-
* @param [options.logId] {string} the account log's pin slot
|
|
122
|
-
* (`accountLogPinId({ spaceId })`); required whenever a `pinStore` is
|
|
123
|
-
* supplied
|
|
124
111
|
* @returns {Promise<object>} the account DID, the post-continuation
|
|
125
112
|
* document and log (the rotation's recipient source and anchor), the
|
|
126
113
|
* `keyAgreement` verification-method ids this entry struck for
|
|
@@ -141,285 +128,75 @@ export async function recoverWebvhLadderAnchored(options) {
|
|
|
141
128
|
'code and the fresh credential record must be persisted before the ' +
|
|
142
129
|
'add entry publishes the ladder VM.');
|
|
143
130
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
expectedDid,
|
|
160
|
-
pinStore,
|
|
161
|
-
logId,
|
|
162
|
-
missingMessage: 'did:webvh: did.jsonl is missing; nothing to recover.'
|
|
163
|
-
});
|
|
164
|
-
const rung0 = await ladderRung({ ladderSeed, index: 0 });
|
|
165
|
-
const rung1 = await ladderRung({ ladderSeed, index: 1 });
|
|
166
|
-
const ladderVmKey = await ladderVmKeyMultibase({ ladderSeed });
|
|
167
|
-
// Derived before the completion check, because a resume recomputes the
|
|
168
|
-
// strike with the same protected sets the first run used.
|
|
169
|
-
const recoveryHash = await deriveNextKeyHash(recovery.updateKeyMultibase);
|
|
170
|
-
const rung0Hash = await deriveNextKeyHash(rung0.keyMultibase);
|
|
171
|
-
const rung1Hash = await deriveNextKeyHash(rung1.keyMultibase);
|
|
172
|
-
const replacementHash = await deriveNextKeyHash(replacement.updateKeyMultibase);
|
|
173
|
-
// Already complete (a torn earlier run finished the add entry): the fresh
|
|
174
|
-
// ladder's rung 0 is authorized, which only the add entry writes.
|
|
175
|
-
if (published.updateKeys.includes(rung0.keyMultibase)) {
|
|
176
|
-
// The add entry already struck the pre-recovery credentials, so the
|
|
177
|
-
// document names none of them any more. The report is derived from the
|
|
178
|
-
// log instead (`retiredCredentialVmIdsFromLog`), so a resume tells the
|
|
179
|
-
// caller exactly what the first run told it.
|
|
180
|
-
const retired = retiredCredentialVmIdsFromLog({
|
|
181
|
-
log: published.log,
|
|
182
|
-
did: published.did,
|
|
183
|
-
successorKeyMultibase: rung0.keyMultibase,
|
|
184
|
-
spentVmId: recoveryVmId({
|
|
185
|
-
did: published.did,
|
|
186
|
-
keyAgreementKeyMultibase: recovery.keyAgreementKeyMultibase
|
|
187
|
-
})
|
|
188
|
-
});
|
|
189
|
-
// The strike is recomputed by re-running it over the log as it stood just
|
|
190
|
-
// before the add entry, with the same protected sets, so a resume reports
|
|
191
|
-
// exactly what the first run reported rather than a second definition of
|
|
192
|
-
// the same question.
|
|
193
|
-
const strike = await retiredCredentialRungsBeforeKey({
|
|
194
|
-
log: published.log,
|
|
195
|
-
authorizedKeyMultibase: rung0.keyMultibase,
|
|
196
|
-
credentialVmIds: retired,
|
|
197
|
-
protectedHashes: [rung0Hash, rung1Hash, replacementHash],
|
|
198
|
-
protectedKeys: [rung0.keyMultibase]
|
|
199
|
-
});
|
|
200
|
-
return {
|
|
201
|
-
did: published.did,
|
|
202
|
-
doc: published.doc,
|
|
203
|
-
log: published.log,
|
|
204
|
-
retiredCredentialVmIds: retired,
|
|
205
|
-
struckRungHashes: strike.struckHashes,
|
|
206
|
-
unclaimedCredentialVmIds: strike.unclaimedCredentialVmIds
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
// The reveal-and-commit entry, skipped when a torn earlier run already
|
|
210
|
-
// published it (the revealed key authorized AND every needed hash
|
|
211
|
-
// committed).
|
|
212
|
-
const revealed = published.updateKeys.includes(recovery.updateKeyMultibase);
|
|
213
|
-
const committed = [rung0Hash, rung1Hash, replacementHash].every(hash => published.nextKeyHashes.includes(hash));
|
|
214
|
-
if (!revealed || !committed) {
|
|
215
|
-
if (!revealed && !published.nextKeyHashes.includes(recoveryHash)) {
|
|
216
|
-
throw new RecoveryKeyNotCommittedError();
|
|
217
|
-
}
|
|
218
|
-
await assertCarryOverCommitments({ published });
|
|
219
|
-
const signer = await updateKeySigner({ seed: recovery.updateSeed });
|
|
220
|
-
const updated = await updateDID({
|
|
221
|
-
log: published.log,
|
|
222
|
-
signer,
|
|
223
|
-
alsoKnownAsWeb: true,
|
|
224
|
-
updateKeys: [
|
|
225
|
-
...new Set([...published.updateKeys, recovery.updateKeyMultibase])
|
|
226
|
-
],
|
|
227
|
-
// The spent code's own hash is kept through this entry (so a resumed
|
|
228
|
-
// commit can re-state the revealed key); the add entry drops it.
|
|
229
|
-
nextKeyHashes: [
|
|
230
|
-
...new Set([
|
|
231
|
-
...published.nextKeyHashes,
|
|
232
|
-
recoveryHash,
|
|
233
|
-
rung0Hash,
|
|
234
|
-
rung1Hash,
|
|
235
|
-
replacementHash
|
|
236
|
-
])
|
|
237
|
-
]
|
|
238
|
-
});
|
|
239
|
-
// The publish advances the pin to what the reveal entry just published,
|
|
240
|
-
// so the re-read below (and any read after a tear here) refuses a host
|
|
241
|
-
// that rolls the log back behind it.
|
|
242
|
-
await publishEntryPinned({
|
|
243
|
-
store,
|
|
244
|
-
log: updated.log,
|
|
245
|
-
ifMatch: published.etag,
|
|
246
|
-
pinStore,
|
|
247
|
-
logId
|
|
248
|
-
});
|
|
249
|
-
// The same account the reveal entry just extended, under the same pin.
|
|
250
|
-
published = await readPublishedLogOrThrow({
|
|
251
|
-
idStore: store,
|
|
252
|
-
expectedDid: published.did,
|
|
253
|
-
pinStore,
|
|
254
|
-
logId,
|
|
255
|
-
missingMessage: 'did:webvh: did.jsonl is missing; nothing to recover.'
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
// The persist-before-publish seam: the replacement code's record and the
|
|
259
|
-
// fresh credential's unlock record (the ladder seed inside) become durable
|
|
260
|
-
// HERE, before the add entry publishes the ladder VM that seed backs.
|
|
261
|
-
const persisted = await onCommitted();
|
|
262
|
-
// Refuses a malformed pointer target before the entry is built.
|
|
263
|
-
clientAnnexDidParts({ did: persisted.clientAnnexDid });
|
|
264
|
-
// The add-and-retire entry: the ladder VM, the fresh credential's
|
|
265
|
-
// keyAgreement inventory, and the replacement code's inventory in; the spent
|
|
266
|
-
// code's VM, update key, and hash out; every pre-recovery standing
|
|
267
|
-
// credential fully retired -- its ladder VM and its keyAgreement member
|
|
268
|
-
// both. Signed by rung 0, whose hash the commit entry just committed.
|
|
269
|
-
const { did, doc } = published;
|
|
270
|
-
const spentVmId = recoveryVmId({
|
|
271
|
-
did,
|
|
272
|
-
keyAgreementKeyMultibase: recovery.keyAgreementKeyMultibase
|
|
273
|
-
});
|
|
274
|
-
const replacementVmId = recoveryVmId({
|
|
275
|
-
did,
|
|
276
|
-
keyAgreementKeyMultibase: replacement.keyAgreementKeyMultibase
|
|
277
|
-
});
|
|
278
|
-
const ladderVms = ladderVmIds({ doc });
|
|
279
|
-
const ladderVm = ladderVerificationMethod({
|
|
280
|
-
controller: did,
|
|
281
|
-
publicKeyMultibase: ladderVmKey
|
|
282
|
-
});
|
|
283
|
-
const ladderVmId = `${did}#${ladderVmKey}`;
|
|
284
|
-
const credentialVm = unlockKeyVerificationMethod({
|
|
285
|
-
did,
|
|
286
|
-
keyAgreement: credentialKeyAgreement
|
|
287
|
-
});
|
|
288
|
-
const credentialVmId = unlockKeyVmId({
|
|
289
|
-
did,
|
|
290
|
-
keyAgreement: credentialKeyAgreement
|
|
291
|
-
});
|
|
292
|
-
// Every pre-recovery credential's keyAgreement member, by the account-DID
|
|
293
|
-
// controller (an enrolled client's carries the client marker instead), less
|
|
294
|
-
// the ids this entry itself adds. The spent code's own id is reported
|
|
295
|
-
// separately: the caller already retires that one by name.
|
|
296
|
-
// The replacement code's ladder VM, published beside its key-agreement
|
|
297
|
-
// member: a code is a standing credential with a ladder, and its own bridge
|
|
298
|
-
// delegation is signed by this VM, so a replacement without it could never
|
|
299
|
-
// spend (`decisions/0019`, `decisions/0020`). Its rung-0 hash is already
|
|
300
|
-
// committed by the reveal-and-commit entry, which this entry carries
|
|
301
|
-
// through.
|
|
302
|
-
const replacementLadderVmId = `${did}#${replacement.ladderVmKeyMultibase}`;
|
|
303
|
-
const addedVmIds = [
|
|
304
|
-
ladderVmId,
|
|
305
|
-
credentialVmId,
|
|
306
|
-
replacementVmId,
|
|
307
|
-
replacementLadderVmId
|
|
308
|
-
];
|
|
309
|
-
const struckCredentialVmIds = credentialKeyAgreementMethods({ doc, did })
|
|
310
|
-
.map(method => method.id)
|
|
311
|
-
.filter((id) => typeof id === 'string')
|
|
312
|
-
.filter(id => !addedVmIds.includes(id));
|
|
313
|
-
const retiredCredentialVmIds = struckCredentialVmIds.filter(id => id !== spentVmId);
|
|
314
|
-
// Each retired credential's committed rungs and any revealed rung of its
|
|
315
|
-
// own go in the SAME entry. Striking the VM alone rots a ladder-signed
|
|
316
|
-
// bridge, but a bridge an enrolled client minted outlives the strike, and
|
|
317
|
-
// that client survives this entry -- so a committed rung left standing is a
|
|
318
|
-
// reveal the retired credential could still perform. The anchoring is
|
|
319
|
-
// log-only (this browser holds no registry), and an unanchorable credential
|
|
320
|
-
// is reported rather than struck.
|
|
321
|
-
const strike = await attributeRetiredCredentialRungs({
|
|
322
|
-
log: published.log,
|
|
323
|
-
credentialVmIds: retiredCredentialVmIds,
|
|
324
|
-
protectedHashes: [rung0Hash, rung1Hash, replacementHash],
|
|
325
|
-
protectedKeys: [rung0.keyMultibase]
|
|
326
|
-
});
|
|
327
|
-
const addedMethods = [
|
|
328
|
-
ladderVm,
|
|
329
|
-
credentialVm,
|
|
330
|
-
{
|
|
331
|
-
id: replacementVmId,
|
|
332
|
-
type: MULTIKEY_VM_TYPE,
|
|
333
|
-
controller: did,
|
|
334
|
-
publicKeyMultibase: replacement.keyAgreementKeyMultibase
|
|
131
|
+
const { ladderSeed, credentialKeyAgreement, onCommitted, expectedDid, ...shared } = options;
|
|
132
|
+
// The fresh ladder: rung 0 is the successor key the add entry authorizes
|
|
133
|
+
// and signs with, rung 1 its staged partner (the ladder-anchored genesis
|
|
134
|
+
// configuration), and the VM the stable sibling the entry installs.
|
|
135
|
+
const [rung0, rung1, ladderVmKey] = await Promise.all([
|
|
136
|
+
ladderRung({ ladderSeed, index: 0 }),
|
|
137
|
+
ladderRung({ ladderSeed, index: 1 }),
|
|
138
|
+
ladderVmKeyMultibase({ ladderSeed })
|
|
139
|
+
]);
|
|
140
|
+
const outcome = await withLogConflictRetry(() => recoveryContinuationOnce({
|
|
141
|
+
...shared,
|
|
142
|
+
successor: {
|
|
143
|
+
updateKeyMultibase: rung0.keyMultibase,
|
|
144
|
+
updateSeed: rung0.seed,
|
|
145
|
+
stagedKeyMultibase: rung1.keyMultibase
|
|
335
146
|
},
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
(
|
|
346
|
-
(!ladderVms.includes(method.id) &&
|
|
347
|
-
!struckCredentialVmIds.includes(method.id)))),
|
|
348
|
-
...addedMethods
|
|
349
|
-
];
|
|
350
|
-
// The retirement filter runs over the EXISTING relation ids only, and the
|
|
351
|
-
// added ids join afterwards: a resumed run's fresh ladder VM already stands
|
|
352
|
-
// in `doc.capabilityDelegation`, so filtering the union would strike the
|
|
353
|
-
// very method this entry is publishing.
|
|
354
|
-
const withoutRemoved = (relation, added) => [
|
|
355
|
-
...new Set([
|
|
356
|
-
...relationIds(relation).filter(referencedId => referencedId !== spentVmId &&
|
|
357
|
-
!ladderVms.includes(referencedId) &&
|
|
358
|
-
!struckCredentialVmIds.includes(referencedId)),
|
|
359
|
-
...(added ?? [])
|
|
360
|
-
])
|
|
361
|
-
];
|
|
362
|
-
const signer = await updateKeySigner({ seed: rung0.seed });
|
|
363
|
-
const updated = await updateDID({
|
|
364
|
-
log: published.log,
|
|
365
|
-
signer,
|
|
366
|
-
alsoKnownAsWeb: true,
|
|
367
|
-
updateKeys: [
|
|
368
|
-
...new Set([
|
|
369
|
-
...published.updateKeys.filter(key => key !== recovery.updateKeyMultibase &&
|
|
370
|
-
!strike.struckKeys.includes(key)),
|
|
371
|
-
rung0.keyMultibase
|
|
372
|
-
])
|
|
147
|
+
// The persist-before-publish seam: the replacement code's record and
|
|
148
|
+
// the fresh credential's unlock record (the ladder seed inside) become
|
|
149
|
+
// durable HERE, before the add entry publishes the ladder VM that seed
|
|
150
|
+
// backs.
|
|
151
|
+
onCommitted,
|
|
152
|
+
// A passphrase the account already stands on is refused before the
|
|
153
|
+
// reveal entry: this continuation retires that credential, and
|
|
154
|
+
// re-binding it would leave its old rungs standing under a new VM.
|
|
155
|
+
credentialVmIds: did => [
|
|
156
|
+
unlockKeyVmId({ did, keyAgreement: credentialKeyAgreement })
|
|
373
157
|
],
|
|
374
|
-
|
|
375
|
-
nextKeyHashes: published.nextKeyHashes.filter(hash => hash !== recoveryHash && !strike.struckHashes.includes(hash)),
|
|
376
|
-
ceremony: 'the transient-recovery add-and-retire entry'
|
|
377
|
-
}),
|
|
378
|
-
verificationMethods,
|
|
379
|
-
// The ladder VM's relation asymmetry: `assertionMethod` and
|
|
158
|
+
// The ladder VM (under the relation asymmetry: `assertionMethod` and
|
|
380
159
|
// `capabilityDelegation` only -- no `authentication`, no
|
|
381
160
|
// `capabilityInvocation` -- which is also what keeps it out of every
|
|
382
|
-
// client listing
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
webDoc: updated.webDoc
|
|
423
|
-
};
|
|
161
|
+
// client listing) and the fresh credential's keyAgreement inventory in;
|
|
162
|
+
// the core appends the replacement code's after them. Atomic with the
|
|
163
|
+
// retirement: the `#DelegatedClients` pointer and the ladder-VM set
|
|
164
|
+
// change in one entry, so no window exists in which the document
|
|
165
|
+
// points at a generation the surviving record cannot reach.
|
|
166
|
+
added: ({ did, doc, persisted }) => {
|
|
167
|
+
// Refuses a malformed pointer target before the entry is built.
|
|
168
|
+
clientAnnexDidParts({ did: persisted.clientAnnexDid });
|
|
169
|
+
const ladderVmId = `${did}#${ladderVmKey}`;
|
|
170
|
+
const credentialVmId = unlockKeyVmId({
|
|
171
|
+
did,
|
|
172
|
+
keyAgreement: credentialKeyAgreement
|
|
173
|
+
});
|
|
174
|
+
return {
|
|
175
|
+
methods: [
|
|
176
|
+
ladderVerificationMethod({
|
|
177
|
+
controller: did,
|
|
178
|
+
publicKeyMultibase: ladderVmKey
|
|
179
|
+
}),
|
|
180
|
+
unlockKeyVerificationMethod({
|
|
181
|
+
did,
|
|
182
|
+
keyAgreement: credentialKeyAgreement
|
|
183
|
+
})
|
|
184
|
+
],
|
|
185
|
+
assertionMethod: [ladderVmId],
|
|
186
|
+
keyAgreement: [credentialVmId],
|
|
187
|
+
capabilityDelegation: [ladderVmId],
|
|
188
|
+
services: servicesPointedAtClientAnnex({
|
|
189
|
+
doc,
|
|
190
|
+
accountDid: did,
|
|
191
|
+
clientAnnexDid: persisted.clientAnnexDid
|
|
192
|
+
})
|
|
193
|
+
};
|
|
194
|
+
},
|
|
195
|
+
...(expectedDid !== undefined ? { expectedDid } : {})
|
|
196
|
+
}));
|
|
197
|
+
// `committed` is the remembered variant's signal; this one has no
|
|
198
|
+
// cross-process resume for it to serve.
|
|
199
|
+
const { committed: _committed, ...rest } = outcome;
|
|
200
|
+
return rest;
|
|
424
201
|
}
|
|
425
202
|
//# sourceMappingURL=recoveryLadderAnchored.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recoveryLadderAnchored.js","sourceRoot":"","sources":["../../src/clientAnnex/recoveryLadderAnchored.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"recoveryLadderAnchored.js","sourceRoot":"","sources":["../../src/clientAnnex/recoveryLadderAnchored.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACrB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,2BAA2B,EAC3B,aAAa,EAEd,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAA;AAMtE,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,EAAE,mBAAmB,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAA;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkHG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,OAQhD;IASC,uEAAuE;IACvE,wEAAwE;IACxE,oEAAoE;IACpE,6DAA6D;IAC7D,IAAI,OAAO,OAAO,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;QAC9C,MAAM,IAAI,SAAS,CACjB,mEAAmE;YACjE,oEAAoE;YACpE,oCAAoC,CACvC,CAAA;IACH,CAAC;IACD,MAAM,EACJ,UAAU,EACV,sBAAsB,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,GAAG;gBACH,YAAY,EAAE,sBAAsB;aACrC,CAAC,CAAA;YACF,OAAO;gBACL,OAAO,EAAE;oBACP,wBAAwB,CAAC;wBACvB,UAAU,EAAE,GAAG;wBACf,kBAAkB,EAAE,WAAW;qBAChC,CAAC;oBACF,2BAA2B,CAAC;wBAC1B,GAAG;wBACH,YAAY,EAAE,sBAAsB;qBACrC,CAAC;iBACH;gBACD,eAAe,EAAE,CAAC,UAAU,CAAC;gBAC7B,YAAY,EAAE,CAAC,cAAc,CAAC;gBAC9B,oBAAoB,EAAE,CAAC,UAAU,CAAC;gBAClC,QAAQ,EAAE,4BAA4B,CAAC;oBACrC,GAAG;oBACH,UAAU,EAAE,GAAG;oBACf,cAAc,EAAE,SAAS,CAAC,cAAc;iBACzC,CAAC;aACH,CAAA;QACH,CAAC;QACD,GAAG,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACtD,CAAC,CACH,CAAA;IACD,kEAAkE;IAClE,wCAAwC;IACxC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAA;IAClD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -6,8 +6,12 @@
|
|
|
6
6
|
* roster delivers after the ensure, not the minted candidate**. The ensure
|
|
7
7
|
* adopts a roster another run landed first, and epoch[0] is create-if-absent,
|
|
8
8
|
* so installing under this run's candidate would key a collection to a key
|
|
9
|
-
* nobody holds.
|
|
10
|
-
*
|
|
9
|
+
* nobody holds. The key-versus-roster test itself is `ensureWalletSpaceEpochs`'s
|
|
10
|
+
* mint gate, which this stage hands the settled descriptor; what this stage
|
|
11
|
+
* owns is the ensure-then-re-read order around it and the mint guard. One
|
|
12
|
+
* function, two callers: the credential-anchored establishment's
|
|
13
|
+
* adopted-roster arm, and the mend entry point's roster arm, each supplying
|
|
14
|
+
* the mint preconditions through the required `beforeMint` seam.
|
|
11
15
|
*
|
|
12
16
|
* The stage order: ensure the roster (create-if-absent with the supplied
|
|
13
17
|
* candidate; the entry proof rides the caller's store signer -- the ladder VM
|
|
@@ -93,12 +97,16 @@ export type RosterDeliveredEpochsResult = {
|
|
|
93
97
|
* delegation); absent, requests invoke the root capability
|
|
94
98
|
* @param [options.collectionIds] {string[]} the fan-out's collection set
|
|
95
99
|
* override, threaded through to `ensureWalletSpaceEpochs`
|
|
96
|
-
* @param
|
|
100
|
+
* @param options.beforeMint {Function} `() => Promise<void>` -- the mint
|
|
97
101
|
* guard, awaited exactly when THIS run's own decide-read observed the
|
|
98
102
|
* roster absent and is about to install the candidate as epoch[0]. A
|
|
99
103
|
* throw refuses the mint and propagates unchanged (never folded into the
|
|
100
104
|
* create-race adoption), so a caller's mint preconditions run against the
|
|
101
|
-
* same observation the mint acts on
|
|
105
|
+
* same observation the mint acts on. Required: a served absent roster is
|
|
106
|
+
* the one observation that can turn this stage into a single-recipient
|
|
107
|
+
* roster genesis evicting every other standing credential, so no caller
|
|
108
|
+
* gets the mint without stating what licenses it. A call without the seam
|
|
109
|
+
* is refused with a `TypeError` before any read
|
|
102
110
|
* @returns {Promise<RosterDeliveredEpochsResult>}
|
|
103
111
|
*/
|
|
104
112
|
export declare function ensureRosterDeliveredEpochs({ store, candidateUserKey, clientKeyAgreementKey, was, spaceId, capability, collectionIds, beforeMint }: {
|
|
@@ -109,6 +117,6 @@ export declare function ensureRosterDeliveredEpochs({ store, candidateUserKey, c
|
|
|
109
117
|
spaceId: string;
|
|
110
118
|
capability?: IZcap;
|
|
111
119
|
collectionIds?: string[];
|
|
112
|
-
beforeMint
|
|
120
|
+
beforeMint: () => Promise<void>;
|
|
113
121
|
}): Promise<RosterDeliveredEpochsResult>;
|
|
114
122
|
//# sourceMappingURL=rosterDeliveredEpochs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rosterDeliveredEpochs.d.ts","sourceRoot":"","sources":["../../src/clientAnnex/rosterDeliveredEpochs.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"rosterDeliveredEpochs.d.ts","sourceRoot":"","sources":["../../src/clientAnnex/rosterDeliveredEpochs.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC1E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AACxE,OAAO,EAIL,KAAK,OAAO,EACZ,KAAK,uBAAuB,EAC7B,MAAM,kBAAkB,CAAA;AAczB;;;;;;;GAOG;AACH,MAAM,MAAM,2BAA2B,GACnC;IACE,OAAO,EAAE,WAAW,GAAG,qBAAqB,CAAA;IAC5C;;OAEG;IACH,OAAO,EAAE,OAAO,CAAA;IAChB,gBAAgB,EAAE,oBAAoB,CAAA;IACtC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAA;IACf,MAAM,EAAE,uBAAuB,CAAA;CAChC,GACD;IACE,OAAO,EAAE,SAAS,CAAA;IAClB,gBAAgB,EAAE,oBAAoB,CAAA;IACtC;;OAEG;IACH,KAAK,EAAE,OAAO,CAAA;CACf,CAAA;AAEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAsB,2BAA2B,CAAC,EAChD,KAAK,EACL,gBAAgB,EAChB,qBAAqB,EACrB,GAAG,EACH,OAAO,EACP,UAAU,EACV,aAAa,EACb,UAAU,EACX,EAAE;IACD,KAAK,EAAE,yBAAyB,CAAA;IAChC,gBAAgB,EAAE,OAAO,CAAA;IACzB,qBAAqB,EAAE,gBAAgB,CAAA;IACvC,GAAG,EAAE,SAAS,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAChC,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAoFvC"}
|
|
@@ -34,15 +34,23 @@ const CREATE_RACE_ERROR_NAMES = new Set([
|
|
|
34
34
|
* delegation); absent, requests invoke the root capability
|
|
35
35
|
* @param [options.collectionIds] {string[]} the fan-out's collection set
|
|
36
36
|
* override, threaded through to `ensureWalletSpaceEpochs`
|
|
37
|
-
* @param
|
|
37
|
+
* @param options.beforeMint {Function} `() => Promise<void>` -- the mint
|
|
38
38
|
* guard, awaited exactly when THIS run's own decide-read observed the
|
|
39
39
|
* roster absent and is about to install the candidate as epoch[0]. A
|
|
40
40
|
* throw refuses the mint and propagates unchanged (never folded into the
|
|
41
41
|
* create-race adoption), so a caller's mint preconditions run against the
|
|
42
|
-
* same observation the mint acts on
|
|
42
|
+
* same observation the mint acts on. Required: a served absent roster is
|
|
43
|
+
* the one observation that can turn this stage into a single-recipient
|
|
44
|
+
* roster genesis evicting every other standing credential, so no caller
|
|
45
|
+
* gets the mint without stating what licenses it. A call without the seam
|
|
46
|
+
* is refused with a `TypeError` before any read
|
|
43
47
|
* @returns {Promise<RosterDeliveredEpochsResult>}
|
|
44
48
|
*/
|
|
45
49
|
export async function ensureRosterDeliveredEpochs({ store, candidateUserKey, clientKeyAgreementKey, was, spaceId, capability, collectionIds, beforeMint }) {
|
|
50
|
+
if (typeof beforeMint !== 'function') {
|
|
51
|
+
throw new TypeError('ensureRosterDeliveredEpochs requires a beforeMint seam: the mint ' +
|
|
52
|
+
'preconditions that license installing the candidate as epoch[0].');
|
|
53
|
+
}
|
|
46
54
|
// The ensure: create-if-absent with the candidate, the mint guard fired
|
|
47
55
|
// on this run's own absent observation. A read failure is a transport
|
|
48
56
|
// error and rethrows unchanged; only the guarded create's lost race is
|
|
@@ -55,9 +63,7 @@ export async function ensureRosterDeliveredEpochs({ store, candidateUserKey, cli
|
|
|
55
63
|
descriptor = current.descriptor;
|
|
56
64
|
}
|
|
57
65
|
else {
|
|
58
|
-
|
|
59
|
-
await beforeMint();
|
|
60
|
-
}
|
|
66
|
+
await beforeMint();
|
|
61
67
|
descriptor = await ensureUserKeyRoster({
|
|
62
68
|
store,
|
|
63
69
|
userKey: candidateUserKey,
|
|
@@ -66,7 +72,7 @@ export async function ensureRosterDeliveredEpochs({ store, candidateUserKey, cli
|
|
|
66
72
|
}
|
|
67
73
|
}
|
|
68
74
|
catch (err) {
|
|
69
|
-
if (!CREATE_RACE_ERROR_NAMES.has(err
|
|
75
|
+
if (!CREATE_RACE_ERROR_NAMES.has(err?.name ?? '')) {
|
|
70
76
|
throw err;
|
|
71
77
|
}
|
|
72
78
|
const reread = await store.read();
|
|
@@ -91,19 +97,22 @@ export async function ensureRosterDeliveredEpochs({ store, candidateUserKey, cli
|
|
|
91
97
|
userKey = read.userKey;
|
|
92
98
|
}
|
|
93
99
|
catch (err) {
|
|
94
|
-
if (err
|
|
100
|
+
if (err?.name === 'UserKeyRosterUnwrapError') {
|
|
95
101
|
return { outcome: 'no-wrap', rosterDescriptor: descriptor, error: err };
|
|
96
102
|
}
|
|
97
103
|
throw err;
|
|
98
104
|
}
|
|
99
105
|
// The fan-out, under the DELIVERED key -- create-if-absent per collection,
|
|
100
106
|
// so this call is also the completion test's re-entry on an epoch-less
|
|
101
|
-
// encrypted collection behind a present roster.
|
|
102
|
-
//
|
|
107
|
+
// encrypted collection behind a present roster. The settled descriptor
|
|
108
|
+
// rides along so the fan-out's own mint gate stands between the key and
|
|
109
|
+
// the install. Per-collection failures ride the result's `failed` list to
|
|
110
|
+
// the caller.
|
|
103
111
|
const epochs = await ensureWalletSpaceEpochs({
|
|
104
112
|
was,
|
|
105
113
|
spaceId,
|
|
106
114
|
userKey,
|
|
115
|
+
rosterDescriptor: descriptor,
|
|
107
116
|
...(capability !== undefined ? { capability } : {}),
|
|
108
117
|
...(collectionIds !== undefined ? { collectionIds } : {})
|
|
109
118
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rosterDeliveredEpochs.js","sourceRoot":"","sources":["../../src/clientAnnex/rosterDeliveredEpochs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rosterDeliveredEpochs.js","sourceRoot":"","sources":["../../src/clientAnnex/rosterDeliveredEpochs.ts"],"names":[],"mappings":"AA8CA,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,EAGlB,MAAM,kBAAkB,CAAA;AAEzB;;;;;;GAMG;AACH,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC;IACtC,yBAAyB;IACzB,uBAAuB;CACxB,CAAC,CAAA;AAiCF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,EAChD,KAAK,EACL,gBAAgB,EAChB,qBAAqB,EACrB,GAAG,EACH,OAAO,EACP,UAAU,EACV,aAAa,EACb,UAAU,EAUX;IACC,IAAI,OAAO,UAAU,KAAK,UAAU,EAAE,CAAC;QACrC,MAAM,IAAI,SAAS,CACjB,mEAAmE;YACjE,kEAAkE,CACrE,CAAA;IACH,CAAC;IACD,wEAAwE;IACxE,sEAAsE;IACtE,uEAAuE;IACvE,gCAAgC;IAChC,IAAI,UAAgC,CAAA;IACpC,IAAI,kBAAkB,GAAG,KAAK,CAAA;IAC9B,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,IAAI,EAAE,CAAA;QAClC,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACrB,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;QACjC,CAAC;aAAM,CAAC;YACN,MAAM,UAAU,EAAE,CAAA;YAClB,UAAU,GAAG,MAAM,mBAAmB,CAAC;gBACrC,KAAK;gBACL,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UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnD,GAAG,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1D,CAAC,CAAA;IACF,OAAO;QACL,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,WAAW;QACjE,OAAO;QACP,gBAAgB,EAAE,UAAU;QAC5B,MAAM;QACN,MAAM;KACP,CAAA;AACH,CAAC"}
|
|
@@ -44,7 +44,6 @@
|
|
|
44
44
|
import type { IKeyAgreementKey } from '@interop/data-integrity-core';
|
|
45
45
|
import type { UserKey } from '../keys/userKey.js';
|
|
46
46
|
import type { AccountPointer } from '../keyring/record.js';
|
|
47
|
-
import { type ResourceLogPinStore } from '@interop/vh-resource-log';
|
|
48
47
|
import type { ClientWebvhUpdateKeys } from '../webvh/didWebvh.js';
|
|
49
48
|
import type { UnlockLogStore } from '../unlock/standingWebvh.js';
|
|
50
49
|
/**
|
|
@@ -65,13 +64,11 @@ import type { UnlockLogStore } from '../unlock/standingWebvh.js';
|
|
|
65
64
|
* with
|
|
66
65
|
* @param options.logStore {UnlockLogStore} the public log read plus the
|
|
67
66
|
* delegated `did.jsonl` PUT, built by the app around the record's bridge
|
|
68
|
-
* delegation
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* its first contact), which is exactly the pin's trust-on-first-use
|
|
74
|
-
* establishment
|
|
67
|
+
* delegation. It carries this client's chain-head pin for the account log,
|
|
68
|
+
* checked on every read the two log entries are built on and advanced as
|
|
69
|
+
* each publishes, then checked again by the verify that follows. A fresh
|
|
70
|
+
* browser normally holds no pin yet (this is its first contact), which is
|
|
71
|
+
* exactly the pin's trust-on-first-use establishment
|
|
75
72
|
* @param options.onCommitted {function}
|
|
76
73
|
* `(committed: { builtOnHead, clientSeed, webvhUpdateKeys }) =>
|
|
77
74
|
* Promise<void>` -- the REQUIRED persist-before-publish seam. The caller
|
|
@@ -111,12 +108,11 @@ import type { UnlockLogStore } from '../unlock/standingWebvh.js';
|
|
|
111
108
|
* cleared. The member exists so a build skew that dropped it surfaces
|
|
112
109
|
* instead of reading as `false`
|
|
113
110
|
*/
|
|
114
|
-
export declare function selfEnrollClientCore({ pointer, ladderSeed, credentialKeyAgreementKey, logStore,
|
|
111
|
+
export declare function selfEnrollClientCore({ pointer, ladderSeed, credentialKeyAgreementKey, logStore, onCommitted, resume }: {
|
|
115
112
|
pointer: AccountPointer;
|
|
116
113
|
ladderSeed: Uint8Array;
|
|
117
114
|
credentialKeyAgreementKey: IKeyAgreementKey;
|
|
118
115
|
logStore: UnlockLogStore;
|
|
119
|
-
accountLogPinStore?: ResourceLogPinStore;
|
|
120
116
|
onCommitted: (committed: {
|
|
121
117
|
builtOnHead: {
|
|
122
118
|
scid: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selfEnroll.d.ts","sourceRoot":"","sources":["../../src/clientAnnex/selfEnroll.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AASpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"selfEnroll.d.ts","sourceRoot":"","sources":["../../src/clientAnnex/selfEnroll.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AASpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBA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