@interop/wallet-core 0.55.0 → 0.57.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/establish.d.ts +401 -0
- package/dist/clientAnnex/establish.d.ts.map +1 -0
- package/dist/clientAnnex/establish.js +660 -0
- package/dist/clientAnnex/establish.js.map +1 -0
- package/dist/clientAnnex/heal.d.ts +45 -1
- package/dist/clientAnnex/heal.d.ts.map +1 -1
- package/dist/clientAnnex/heal.js +39 -12
- package/dist/clientAnnex/heal.js.map +1 -1
- package/dist/clientAnnex/index.d.ts +7 -1
- package/dist/clientAnnex/index.d.ts.map +1 -1
- package/dist/clientAnnex/index.js +4 -1
- package/dist/clientAnnex/index.js.map +1 -1
- package/dist/clientAnnex/mend.d.ts +322 -0
- package/dist/clientAnnex/mend.d.ts.map +1 -0
- package/dist/clientAnnex/mend.js +761 -0
- package/dist/clientAnnex/mend.js.map +1 -0
- package/dist/clientAnnex/rosterDeliveredEpochs.d.ts +114 -0
- package/dist/clientAnnex/rosterDeliveredEpochs.d.ts.map +1 -0
- package/dist/clientAnnex/rosterDeliveredEpochs.js +118 -0
- package/dist/clientAnnex/rosterDeliveredEpochs.js.map +1 -0
- package/dist/space/ceremony.d.ts +17 -0
- package/dist/space/ceremony.d.ts.map +1 -0
- package/dist/space/ceremony.js +26 -0
- package/dist/space/ceremony.js.map +1 -0
- package/dist/space/index.d.ts +4 -0
- package/dist/space/index.d.ts.map +1 -1
- package/dist/space/index.js +3 -0
- package/dist/space/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The credential-anchored establishment: everything between a derived unlock
|
|
6
|
+
* credential and an account a transient login can enter, with no durable
|
|
7
|
+
* client minted anywhere. One orchestrator serves the fresh signup and the
|
|
8
|
+
* login-time re-run alike -- every stage is an ensure, so a run torn at any
|
|
9
|
+
* point converges by running the whole thing again (the account log is
|
|
10
|
+
* adopted by ladder attribution, never re-created: `createDID` timestamps
|
|
11
|
+
* the genesis entry, so a naive re-create would mint a different SCID).
|
|
12
|
+
*
|
|
13
|
+
* The stage order, with the load-bearing ordering rules folded in:
|
|
14
|
+
*
|
|
15
|
+
* 1. The interim bridge and the FIRST bind, through the required
|
|
16
|
+
* `bindRecord` hook: the standing-layout unlock record -- ladder seed
|
|
17
|
+
* sealed in, pointer still DID-less, the bridge delegated by the ladder
|
|
18
|
+
* VM's bare did:key (functional until promotion; superseded by the
|
|
19
|
+
* re-bind) -- is durably written BEFORE the Space is created and before
|
|
20
|
+
* the genesis entry publishes rung 0 (the transposed
|
|
21
|
+
* persist-before-publish rule: a published rung nobody can re-derive is
|
|
22
|
+
* the orphan brick). CONDITIONAL: skipped when the caller passed
|
|
23
|
+
* `priorCreatedAt` from a standing keyring hit -- the record already
|
|
24
|
+
* carries the ladder seed, and re-writing it DID-less would let a
|
|
25
|
+
* concurrent heal downgrade a sibling browser's completed re-bind
|
|
26
|
+
* moments before dying on the promoted Space, a permanent lockout.
|
|
27
|
+
* 2. `ensureCredentialAnchoredAccountGenesis` under the ladder VM's bare
|
|
28
|
+
* did:key as bootstrap controller, promotion deferred
|
|
29
|
+
* (`promoteController: false`): Space + collections, the optional KMS key
|
|
30
|
+
* map (`provideDidWebKeys`, an opaque best-effort thunk the caller owns),
|
|
31
|
+
* the one-entry ladder-anchored did:webvh genesis with the credential's
|
|
32
|
+
* `keyAgreement` publication folded in, the roster's epoch[0] wrapped to
|
|
33
|
+
* the credential's standing key-agreement key with a ladder-signed entry
|
|
34
|
+
* proof, and the collection epochs. The ceremony installs collection
|
|
35
|
+
* epochs only when the roster's current epoch IS the candidate key it was
|
|
36
|
+
* handed (`epochsSkipped` otherwise); its roster and epoch failures are
|
|
37
|
+
* FATAL here, before anything names the DID, so the tear is the heal-able
|
|
38
|
+
* kind (a DID-less record) rather than a registry sealed under a key only
|
|
39
|
+
* this tab ever held.
|
|
40
|
+
* 2c. The adopted-roster arm: a re-run that adopted an earlier run's
|
|
41
|
+
* roster recovers the real user key from the credential's standing wrap
|
|
42
|
+
* and completes the collection epochs under it -- the one installer,
|
|
43
|
+
* through the shared mint-policy stage (`ensureRosterDeliveredEpochs`):
|
|
44
|
+
* epochs install under the key the roster DELIVERS, never the minted
|
|
45
|
+
* candidate.
|
|
46
|
+
* 3. The annex generation block (`ensurePointedClientAnnexGeneration`),
|
|
47
|
+
* gated on no `#DelegatedClients` pointer: the annex Space resolved in
|
|
48
|
+
* the settled order (document pointer, else the record's sibling's
|
|
49
|
+
* target, else mint fresh), the generation minted under the bootstrap
|
|
50
|
+
* identity, the ladder-VM-signed generation delegation embedded while
|
|
51
|
+
* the auxiliary Space still answers to the bootstrap did:key, the
|
|
52
|
+
* Space's controller flipped to the account DID, and the pointer entry
|
|
53
|
+
* appended -- signed by ladder attribution of the currently revealed
|
|
54
|
+
* rung, under the caller's chain-head pin. Within THIS ceremony the
|
|
55
|
+
* sibling arm never fires: the sibling is only written by stage 4,
|
|
56
|
+
* strictly after the pointer entry, so a stage-3 tear leaves no
|
|
57
|
+
* sibling; the arm serves callers holding a standing invocation
|
|
58
|
+
* authority (the add/change-method fold), and the establishment's own
|
|
59
|
+
* bootstrap authority falls back to a fresh mint when a sibling-named
|
|
60
|
+
* Space refuses it.
|
|
61
|
+
* The revealed-rung attribution runs before this block and strictly
|
|
62
|
+
* before the re-bind: an account whose document no longer anchors this
|
|
63
|
+
* ladder refuses while the record is still in its pre-re-bind shape.
|
|
64
|
+
* 4. The re-bind, through the same `bindRecord` hook: the full pointer (DID
|
|
65
|
+
* in), the ladder-VM-signed bridge and annex-Space sibling, and the
|
|
66
|
+
* management delegation to the account DID -- durably written BEFORE
|
|
67
|
+
* promotion, so the next login signs under the promoted controller only
|
|
68
|
+
* once the record says to.
|
|
69
|
+
* 5. The caller's `beforePromotion` hook (freewallet: the unlock-methods
|
|
70
|
+
* registry write), run under the bootstrap did:key -- the last window
|
|
71
|
+
* where a root invocation works. NOT swallowed here: a throw fails the
|
|
72
|
+
* establishment; a hook that must be best-effort swallows its own
|
|
73
|
+
* failures.
|
|
74
|
+
* 6. The Space-controller promotion onto the account DID, last -- and, when
|
|
75
|
+
* the caller's KMS stage bound a keystore this run, the best-effort
|
|
76
|
+
* keystore-controller promotion beside it (`promoteKeystore`).
|
|
77
|
+
*
|
|
78
|
+
* The caller (the signup, or a login-time heal) then enters the account
|
|
79
|
+
* through its ordinary transient composition. Known residue: a tear inside
|
|
80
|
+
* stage 3 before the pointer entry can orphan a live annex Space nothing
|
|
81
|
+
* enumerates (the annex Space id is a random mint nothing re-derives), and
|
|
82
|
+
* within this ceremony each torn attempt orphans one -- no record names the
|
|
83
|
+
* Space until stage 4's sibling, so an establishment re-run cannot converge
|
|
84
|
+
* onto it and mints another. And a tear between the re-bind and the promotion
|
|
85
|
+
* on a KMS deployment strands the keystore's controller on the ladder's
|
|
86
|
+
* bare did:key -- outside the current-key-set rule -- with no mender here;
|
|
87
|
+
* an open gap owned by the did:web-stage collapse.
|
|
88
|
+
*/
|
|
89
|
+
import type { IKeyAgreementKey, IZcap } from '@interop/data-integrity-core';
|
|
90
|
+
import type { WasClient } from '@interop/was-client';
|
|
91
|
+
import type { EncryptionDescriptorStore } from '@interop/was-client/edv';
|
|
92
|
+
import type { ResourceLogPinStore } from '@interop/vh-resource-log';
|
|
93
|
+
import type { ZcapClient } from '@interop/ezcap';
|
|
94
|
+
import { type AccountGenesisResult } from '../genesis/accountGenesis.js';
|
|
95
|
+
import type { ClientWebvhUpdateKeys, DidWebKeyMapV2, PublishedWebvhLog, WebvhIdStore } from '../webvh/didWebvh.js';
|
|
96
|
+
import type { ICapabilityAgent } from '../webvh/zcap.js';
|
|
97
|
+
import type { AccountPointer } from '../keyring/record.js';
|
|
98
|
+
import { type UserKey } from '../keys/index.js';
|
|
99
|
+
/**
|
|
100
|
+
* The standing members an unlock-methods registry entry records for the
|
|
101
|
+
* established credential: its roster kid and key-agreement multibase, the
|
|
102
|
+
* bind-time revealed rung, the standing client's did:key, the bridge and
|
|
103
|
+
* sibling delegations' signer key ids and expiries, and the unlock
|
|
104
|
+
* key-agreement members the re-bind reported. The member names are the ones
|
|
105
|
+
* the registry already records; nothing here mints a new field.
|
|
106
|
+
*/
|
|
107
|
+
export interface CredentialAnchoredStandingFields {
|
|
108
|
+
rosterKid: string;
|
|
109
|
+
keyAgreementKeyMultibase: string;
|
|
110
|
+
updateKeyMultibase: string;
|
|
111
|
+
unlockClientDid: string;
|
|
112
|
+
delegationKeyId?: string;
|
|
113
|
+
delegationExpires?: string;
|
|
114
|
+
delegatedClientsKeyId?: string;
|
|
115
|
+
delegatedClientsExpires?: string;
|
|
116
|
+
unlockKeyAgreementKeyId?: string;
|
|
117
|
+
unlockKeyAgreementKeyMultibase?: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* What the establishment hands back for the callers' tails: the published
|
|
121
|
+
* DID, the record's unlock Space id and management zcap, the standing fields
|
|
122
|
+
* a registry entry records, and the report members -- the genesis's
|
|
123
|
+
* `epochsSkipped` marker and the best-effort stages' collected failures
|
|
124
|
+
* (`didWebKeys`, `keystorePromotion`).
|
|
125
|
+
*/
|
|
126
|
+
export interface CredentialAnchoredEstablishment {
|
|
127
|
+
did: string;
|
|
128
|
+
unlockSpaceId: string;
|
|
129
|
+
manageCapability?: IZcap;
|
|
130
|
+
standingFields: CredentialAnchoredStandingFields;
|
|
131
|
+
epochsSkipped?: AccountGenesisResult['epochsSkipped'];
|
|
132
|
+
failed: Array<{
|
|
133
|
+
stage: 'didWebKeys' | 'keystorePromotion';
|
|
134
|
+
error: unknown;
|
|
135
|
+
}>;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* What the `bindRecord` hook must return: the bind's freshness stamp (the
|
|
139
|
+
* re-bind's `priorCreatedAt` thread), and -- the standing-layout assertion's
|
|
140
|
+
* observable half -- the record's unlock Space id, with the management zcap
|
|
141
|
+
* and unlock key-agreement members when the bind minted them.
|
|
142
|
+
*/
|
|
143
|
+
export interface CredentialAnchoredBindResult {
|
|
144
|
+
createdAt: string;
|
|
145
|
+
unlockSpaceId: string;
|
|
146
|
+
manageCapability?: IZcap;
|
|
147
|
+
unlockKeyAgreementKeyId?: string;
|
|
148
|
+
unlockKeyAgreementKeyMultibase?: string;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* The unlock-record codec closure the caller supplies (freewallet:
|
|
152
|
+
* `bindCredentialAnchoredUnlockSecret`), called at most twice -- the first
|
|
153
|
+
* bind and the re-bind -- with the ceremony supplying the pointer shape, the
|
|
154
|
+
* delegations, and `priorCreatedAt`. Its obligations, uncheckable here once
|
|
155
|
+
* the codec is caller-supplied: the record it writes MUST carry the standing
|
|
156
|
+
* layout (ladder seed, bridge, binding MAC -- no plain bind), and the
|
|
157
|
+
* caller's local keyring-freshness pin floor is consumed INSIDE this closure
|
|
158
|
+
* (advance-past stamping), so a durable caller must wire it there.
|
|
159
|
+
*/
|
|
160
|
+
export type CredentialAnchoredBindRecordHook = (options: {
|
|
161
|
+
controller: string;
|
|
162
|
+
pointer: AccountPointer;
|
|
163
|
+
delegation: IZcap;
|
|
164
|
+
delegatedClients?: IZcap;
|
|
165
|
+
delegateManagementTo?: string;
|
|
166
|
+
priorCreatedAt?: string;
|
|
167
|
+
}) => Promise<CredentialAnchoredBindResult>;
|
|
168
|
+
/**
|
|
169
|
+
* The stage-3 primitive: ensure the account document points at a client-annex
|
|
170
|
+
* generation, minting and pointing one when it does not. Gated on the
|
|
171
|
+
* pointer: a document already carrying `#DelegatedClients` is returned
|
|
172
|
+
* as-is (`generationMinted: false`). Otherwise the annex Space resolves in
|
|
173
|
+
* the settled order ({@link resolveClientAnnexSpaceId}: the sibling
|
|
174
|
+
* delegation's target, else a fresh Space minted here), and the fold runs in
|
|
175
|
+
* the standing sub-step order: mint the generation, embed the generation
|
|
176
|
+
* delegation while the Space still answers to its creation controller, flip
|
|
177
|
+
* the Space's controller to the account DID, then append the pointer entry
|
|
178
|
+
* -- strictly last in the block, so pointer-present implies every prior
|
|
179
|
+
* sub-step landed. The pointer entry signs by ladder attribution of the
|
|
180
|
+
* currently revealed rung, and every log touch rides the caller's chain-head
|
|
181
|
+
* pin store.
|
|
182
|
+
*
|
|
183
|
+
* Two invocation authorities, heal's pattern. A caller holding a standing
|
|
184
|
+
* invocation authority (`invocation`: an enrolled client's storage handle
|
|
185
|
+
* plus the sibling capability its annex writes ride) converges onto the
|
|
186
|
+
* sibling-named Space as-is -- the Space is already account-controlled, so
|
|
187
|
+
* no flip runs. The bootstrap-only caller (the establishment) can write a
|
|
188
|
+
* sibling-named Space only while it still answers to the bootstrap did:key
|
|
189
|
+
* (a tear before the flip); one an earlier run already flipped refuses its
|
|
190
|
+
* writes, and that authorization refusal falls back to the fresh-mint arm
|
|
191
|
+
* rather than failing the run. The bootstrap arm's own controller flip
|
|
192
|
+
* swallows ONLY an authorization-class refusal (a concurrent run flipped
|
|
193
|
+
* first); a transport failure there aborts BEFORE the pointer entry, since
|
|
194
|
+
* a document pointing at a generation whose Space still answers to the bare
|
|
195
|
+
* ladder did:key would be unreachable forever.
|
|
196
|
+
*
|
|
197
|
+
* The fold shape is fixed (a separate pointer entry); a ceremony whose
|
|
198
|
+
* pointer move must ride another log entry atomically (the transient
|
|
199
|
+
* recovery's add-and-retire) keeps its own inline fold rather than
|
|
200
|
+
* parameterizing this one.
|
|
201
|
+
*
|
|
202
|
+
* @param options {object}
|
|
203
|
+
* @param options.account {object} the VERIFIED account log view
|
|
204
|
+
* (`{ did, doc, log }`; never re-fetched here)
|
|
205
|
+
* @param options.wasServerUrl {string} the account pointer's host
|
|
206
|
+
* @param options.accountSpaceId {string} the ACCOUNT Space's id (the
|
|
207
|
+
* generation delegation's target subtree, and the account-log pin slot)
|
|
208
|
+
* @param options.ladderSeed {Uint8Array} the credential's ladder seed
|
|
209
|
+
* @param options.was {WasClient} the bootstrap storage client (the ladder
|
|
210
|
+
* VM's bare did:key), used by the fresh-mint arm
|
|
211
|
+
* @param options.mintController {string} the annex Space's creation
|
|
212
|
+
* controller (a did:key; the ladder VM's bare did:key here)
|
|
213
|
+
* @param options.mintGenerationDelegation {Function}
|
|
214
|
+
* `({ clientAnnexDid }) => Promise<IZcap>` -- the generation-delegation
|
|
215
|
+
* minter (ladder-VM-signed on a ladder-anchored account)
|
|
216
|
+
* @param options.idStore {WebvhIdStore} the ACCOUNT log's store
|
|
217
|
+
* @param [options.updateKeys] {ClientWebvhUpdateKeys} the pointer entry's
|
|
218
|
+
* signing pair; absent, it is recovered by ladder attribution of the
|
|
219
|
+
* supplied log's current parameters
|
|
220
|
+
* @param [options.delegatedClients] {IZcap} the record's sibling
|
|
221
|
+
* delegation, for the Space resolution's settled order
|
|
222
|
+
* @param [options.invocation] {object} a standing invocation authority for
|
|
223
|
+
* the sibling-named Space's writes: `was` (the standing client's storage
|
|
224
|
+
* handle) and `capability` (the sibling delegation the annex writes ride).
|
|
225
|
+
* Absent, the sibling-named Space is attempted under the bootstrap client
|
|
226
|
+
* and an authorization refusal falls back to a fresh mint
|
|
227
|
+
* @param [options.logOnly] {boolean} pointer entries publish the log only
|
|
228
|
+
* (a bridge-delegated writer has no `did.json` projection rights); the
|
|
229
|
+
* establishment's root window omits it
|
|
230
|
+
* @param [options.pinStore] {ResourceLogPinStore} chain-head pins; slot
|
|
231
|
+
* keys are derived here per log
|
|
232
|
+
* @param [options.now] {number} epoch milliseconds, for tests
|
|
233
|
+
* @returns {Promise<object>} the pointed (or freshly minted) annex DID,
|
|
234
|
+
* the generation delegation when one was installed here, and what ran
|
|
235
|
+
*/
|
|
236
|
+
export declare function ensurePointedClientAnnexGeneration({ account, wasServerUrl, accountSpaceId, ladderSeed, was, mintController, mintGenerationDelegation, idStore, updateKeys, delegatedClients, invocation, logOnly, pinStore, now }: {
|
|
237
|
+
account: Pick<PublishedWebvhLog, 'did' | 'doc' | 'log'>;
|
|
238
|
+
wasServerUrl: string;
|
|
239
|
+
accountSpaceId: string;
|
|
240
|
+
ladderSeed: Uint8Array;
|
|
241
|
+
was: WasClient;
|
|
242
|
+
mintController: string;
|
|
243
|
+
mintGenerationDelegation: (options: {
|
|
244
|
+
clientAnnexDid: string;
|
|
245
|
+
}) => Promise<IZcap>;
|
|
246
|
+
idStore: WebvhIdStore;
|
|
247
|
+
updateKeys?: ClientWebvhUpdateKeys;
|
|
248
|
+
delegatedClients?: IZcap;
|
|
249
|
+
invocation?: {
|
|
250
|
+
was: WasClient;
|
|
251
|
+
capability: IZcap;
|
|
252
|
+
};
|
|
253
|
+
logOnly?: boolean;
|
|
254
|
+
pinStore?: ResourceLogPinStore;
|
|
255
|
+
now?: number;
|
|
256
|
+
}): Promise<{
|
|
257
|
+
clientAnnexDid: string;
|
|
258
|
+
generationDelegation?: IZcap;
|
|
259
|
+
generationMinted: boolean;
|
|
260
|
+
spaceMinted: boolean;
|
|
261
|
+
}>;
|
|
262
|
+
/**
|
|
263
|
+
* Runs the whole credential-anchored establishment for one unlock credential
|
|
264
|
+
* (see the module doc for the stage order and its whys). Idempotent under
|
|
265
|
+
* re-run from durable state alone; a torn run converges by running again.
|
|
266
|
+
*
|
|
267
|
+
* @param options {object}
|
|
268
|
+
* @param options.wasServerUrl {string} the account pointer's host
|
|
269
|
+
* @param options.spaceId {string} the ACCOUNT Space's id, minted by the
|
|
270
|
+
* caller and carried in the account pointer (never minted here)
|
|
271
|
+
* @param options.ladderSeed {Uint8Array} the credential's ladder seed --
|
|
272
|
+
* freshly minted on a signup, recovered from the record on a heal re-run
|
|
273
|
+
* @param options.standing {object} the credential's standing client
|
|
274
|
+
* identity, from a BINDING-VERIFIED record or a fresh derivation:
|
|
275
|
+
* `clientDid`, `keyAgreementKeyMultibase`, `recipientKid`, and
|
|
276
|
+
* `keyAgreementKey` (the private-half key-agreement key, for the
|
|
277
|
+
* adopted-roster read-back)
|
|
278
|
+
* @param options.bindRecord {CredentialAnchoredBindRecordHook} REQUIRED:
|
|
279
|
+
* the unlock-record codec closure (see its type doc for the hook's
|
|
280
|
+
* standing-layout and freshness-floor obligations)
|
|
281
|
+
* @param options.rosterStoreFor {Function} REQUIRED: `({ did }) =>
|
|
282
|
+
* EncryptionDescriptorStore` -- the user-key roster's store, with a
|
|
283
|
+
* LADDER-signed log signer (the ceremony-tail license's first-entry
|
|
284
|
+
* shape), invoked as the bootstrap did:key
|
|
285
|
+
* @param options.bootstrapWasFor {Function} REQUIRED:
|
|
286
|
+
* `({ keyAgent }) => WasClient` -- the storage client wiring, signing as
|
|
287
|
+
* the ladder VM's bare did:key (the agent is derived here from the seed)
|
|
288
|
+
* @param options.idStore {WebvhIdStore} the account's `id` collection
|
|
289
|
+
* store, signing as the same bootstrap did:key
|
|
290
|
+
* @param [options.expectedDid] {string} the account DID, when the caller's
|
|
291
|
+
* pointer already names one (a heal re-run)
|
|
292
|
+
* @param options.lowEntropy {boolean} whether the credential is
|
|
293
|
+
* low-entropy. REQUIRED (the compiler backstop at the passkey call site,
|
|
294
|
+
* where dropping it would publish the commitment and break the verbatim
|
|
295
|
+
* published key that call site's readers trigger on), and it still FAILS
|
|
296
|
+
* SAFE at runtime: the `keyAgreement` key publishes as a hash commitment
|
|
297
|
+
* unless the value is exactly `false` -- a verbatim KDF-derived key in
|
|
298
|
+
* the world-readable document is a standing offline-grind oracle
|
|
299
|
+
* removable only by credential rotation
|
|
300
|
+
* @param [options.email] {string} -- not taken here; carried inside the
|
|
301
|
+
* caller's `bindRecord` closure
|
|
302
|
+
* @param [options.priorCreatedAt] {string} the previous bind's freshness
|
|
303
|
+
* stamp, from a standing keyring hit. Its presence SKIPS stage 1: the
|
|
304
|
+
* record already carries the ladder seed, and a DID-less re-write could
|
|
305
|
+
* downgrade a sibling browser's completed re-bind
|
|
306
|
+
* @param [options.delegatedClients] {IZcap} the record's sibling
|
|
307
|
+
* delegation, when the caller holds one -- threaded into stage 3's Space
|
|
308
|
+
* resolution; under this ceremony's bootstrap-only authority a
|
|
309
|
+
* sibling-named Space it can no longer write falls back to a fresh mint
|
|
310
|
+
* @param [options.provideDidWebKeys] {Function} `() =>
|
|
311
|
+
* Promise<DidWebKeyMapV2 | undefined>` -- the caller's opaque best-effort
|
|
312
|
+
* KMS/did:web thunk, run inside stage 2 (the caller owns its body and its
|
|
313
|
+
* timeout); a throw is the collected non-fatal `didWebKeys` failure
|
|
314
|
+
* @param [options.promoteKeystore] {Function} `({ did }) => Promise<void>`
|
|
315
|
+
* -- the best-effort keystore-controller promotion, called after the
|
|
316
|
+
* Space's own promotion; the caller's closure no-ops when its KMS stage
|
|
317
|
+
* bound no keystore this run. A throw is collected, never fatal
|
|
318
|
+
* @param [options.beforePromotion] {Function} runs after the re-bind and
|
|
319
|
+
* BEFORE the controller promotion -- the last window where a root
|
|
320
|
+
* invocation under the bootstrap did:key works (the signup's registry
|
|
321
|
+
* write). NOT swallowed here: a throw fails the establishment, so a hook
|
|
322
|
+
* that must be best-effort swallows its own failures
|
|
323
|
+
* @param [options.pinStore] {ResourceLogPinStore} the chain-head pin store
|
|
324
|
+
* for every log read here (a transient visit's in-memory handle, or a
|
|
325
|
+
* durable one when a remembered caller seeds its own pin)
|
|
326
|
+
* @param [options.now] {number} epoch milliseconds, for tests
|
|
327
|
+
* @returns {Promise<CredentialAnchoredEstablishment>}
|
|
328
|
+
* @throws {TypeError} synchronously, when a required hook is missing
|
|
329
|
+
* @throws {Error} when the genesis's roster or epoch stage did not land
|
|
330
|
+
* (the underlying failure as `cause`); the record stays DID-less, so the
|
|
331
|
+
* next login's heal re-runs the establishment
|
|
332
|
+
*/
|
|
333
|
+
export declare function establishCredentialAnchoredAccount(options: {
|
|
334
|
+
wasServerUrl: string;
|
|
335
|
+
spaceId: string;
|
|
336
|
+
ladderSeed: Uint8Array;
|
|
337
|
+
standing: {
|
|
338
|
+
clientDid: string;
|
|
339
|
+
keyAgreementKeyMultibase: string;
|
|
340
|
+
recipientKid: string;
|
|
341
|
+
keyAgreementKey: IKeyAgreementKey;
|
|
342
|
+
};
|
|
343
|
+
bindRecord: CredentialAnchoredBindRecordHook;
|
|
344
|
+
rosterStoreFor: (options: {
|
|
345
|
+
did: string;
|
|
346
|
+
}) => EncryptionDescriptorStore;
|
|
347
|
+
bootstrapWasFor: (options: {
|
|
348
|
+
keyAgent: ICapabilityAgent;
|
|
349
|
+
}) => WasClient;
|
|
350
|
+
idStore: WebvhIdStore;
|
|
351
|
+
expectedDid?: string;
|
|
352
|
+
lowEntropy: boolean;
|
|
353
|
+
priorCreatedAt?: string;
|
|
354
|
+
delegatedClients?: IZcap;
|
|
355
|
+
provideDidWebKeys?: () => Promise<DidWebKeyMapV2 | undefined>;
|
|
356
|
+
promoteKeystore?: (options: {
|
|
357
|
+
did: string;
|
|
358
|
+
}) => Promise<void>;
|
|
359
|
+
beforePromotion?: (context: {
|
|
360
|
+
was: WasClient;
|
|
361
|
+
zcapClient: ZcapClient;
|
|
362
|
+
did: string;
|
|
363
|
+
userKey: UserKey;
|
|
364
|
+
establishment: CredentialAnchoredEstablishment;
|
|
365
|
+
}) => Promise<void>;
|
|
366
|
+
pinStore?: ResourceLogPinStore;
|
|
367
|
+
now?: number;
|
|
368
|
+
}): Promise<CredentialAnchoredEstablishment>;
|
|
369
|
+
/**
|
|
370
|
+
* The current `updateKeys` / `nextKeyHashes` view of a published log, for
|
|
371
|
+
* the bind-time rung attribution.
|
|
372
|
+
*
|
|
373
|
+
* @param published {PublishedWebvhLog}
|
|
374
|
+
* @returns {object}
|
|
375
|
+
*/
|
|
376
|
+
export declare function currentLogParameters(published: Pick<PublishedWebvhLog, 'log'>): {
|
|
377
|
+
updateKeys: string[];
|
|
378
|
+
nextKeyHashes: string[];
|
|
379
|
+
};
|
|
380
|
+
/**
|
|
381
|
+
* A delegation's `expires` caveat, when it carries one.
|
|
382
|
+
*
|
|
383
|
+
* @param zcap {IZcap}
|
|
384
|
+
* @returns {string | undefined}
|
|
385
|
+
*/
|
|
386
|
+
export declare function zcapExpires(zcap: IZcap): string | undefined;
|
|
387
|
+
/**
|
|
388
|
+
* Asserts a `bindRecord` result carries the members the ceremony reads --
|
|
389
|
+
* the observable half of the hook's standing-layout obligation (the sealed
|
|
390
|
+
* members are the codec's own duty and cannot be checked from here).
|
|
391
|
+
*
|
|
392
|
+
* @param options {object}
|
|
393
|
+
* @param options.bind {CredentialAnchoredBindResult}
|
|
394
|
+
* @param options.stage {string}
|
|
395
|
+
* @throws {TypeError}
|
|
396
|
+
*/
|
|
397
|
+
export declare function assertBindResult({ bind, stage }: {
|
|
398
|
+
bind: CredentialAnchoredBindResult;
|
|
399
|
+
stage: string;
|
|
400
|
+
}): void;
|
|
401
|
+
//# sourceMappingURL=establish.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"establish.d.ts","sourceRoot":"","sources":["../../src/clientAnnex/establish.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,8BAA8B,CAAA;AAMrC,OAAO,KAAK,EACV,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,YAAY,EACb,MAAM,sBAAsB,CAAA;AAG7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAExD,OAAO,KAA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