@interop/wallet-core 0.99.0 → 0.101.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 +8 -0
- package/dist/clients/revocation.d.ts +5 -4
- package/dist/clients/revocation.d.ts.map +1 -1
- package/dist/clients/revocation.js.map +1 -1
- package/dist/menders/ids.d.ts +1 -1
- package/dist/menders/ids.d.ts.map +1 -1
- package/dist/menders/ids.js +7 -2
- package/dist/menders/ids.js.map +1 -1
- package/dist/space/ceremony.d.ts +5 -4
- package/dist/space/ceremony.d.ts.map +1 -1
- package/dist/space/ceremony.js +7 -4
- package/dist/space/ceremony.js.map +1 -1
- package/dist/sync/index.d.ts +1 -1
- package/dist/sync/index.js +1 -1
- package/dist/sync/push.d.ts.map +1 -1
- package/dist/sync/push.js +17 -25
- package/dist/sync/push.js.map +1 -1
- package/dist/sync/remint.d.ts +1 -1
- package/dist/sync/remint.d.ts.map +1 -1
- package/dist/sync/remint.js +2 -2
- package/dist/sync/remint.js.map +1 -1
- package/dist/sync/types.d.ts +36 -33
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/sync/types.js +8 -5
- package/dist/sync/types.js.map +1 -1
- package/dist/testing/accountBuilder.d.ts +237 -0
- package/dist/testing/accountBuilder.d.ts.map +1 -0
- package/dist/testing/accountBuilder.js +510 -0
- package/dist/testing/accountBuilder.js.map +1 -0
- package/dist/testing/fastKdf.d.ts +16 -0
- package/dist/testing/fastKdf.d.ts.map +1 -0
- package/dist/testing/fastKdf.js +8 -0
- package/dist/testing/fastKdf.js.map +1 -0
- package/dist/testing/index.d.ts +13 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +13 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/{testing.d.ts → testing/signerFixture.d.ts} +2 -2
- package/dist/testing/signerFixture.d.ts.map +1 -0
- package/dist/{testing.js → testing/signerFixture.js} +1 -1
- package/dist/testing/signerFixture.js.map +1 -0
- package/package.json +12 -10
- package/dist/testing.d.ts.map +0 -1
- package/dist/testing.js.map +0 -1
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* TEST FIXTURES ONLY. The shared account builder: the named account shapes a
|
|
6
|
+
* test starts from, each made through this package's own ceremonies against
|
|
7
|
+
* a real WAS server, with no fake store anywhere. Both wallets use it from
|
|
8
|
+
* their test globs only, and this package's integration tier uses it too.
|
|
9
|
+
*
|
|
10
|
+
* Never import this subpath from production code. Each consumer keeps a lint
|
|
11
|
+
* restriction excluding `@interop/wallet-core/testing` from its non-test
|
|
12
|
+
* globs.
|
|
13
|
+
*
|
|
14
|
+
* The builder imports no server package. The caller boots the server (the
|
|
15
|
+
* integration tier boots `was-teaching-server` in process) and hands over
|
|
16
|
+
* its URL; every client built here targets that URL.
|
|
17
|
+
*
|
|
18
|
+
* Every shape starts as a credential-anchored signup
|
|
19
|
+
* (`establishCredentialAnchoredAccount`) and adds one thing in the order a
|
|
20
|
+
* wallet's ladder-kind session runs it, acting as the signup credential:
|
|
21
|
+
*
|
|
22
|
+
* - `buildPassphraseAccount`: nothing more.
|
|
23
|
+
* - `buildSecondCredentialAccount`: a second standing credential
|
|
24
|
+
* (`addStandingCredential`), the standing establishment's ladder branch.
|
|
25
|
+
* - `buildRecoveryCodeAccount`: one issued, unspent recovery code
|
|
26
|
+
* (`issueRecoveryCode`), the issuance's ladder branch.
|
|
27
|
+
* - `buildEnrolledClientAccount`: one enrolled client (`enrollClient`), the
|
|
28
|
+
* credential's self-enrollment.
|
|
29
|
+
*
|
|
30
|
+
* A passphrase derives through `FAST_KDF`, an HKDF stand-in for the shipped
|
|
31
|
+
* Argon2id set, so a passphrase shape derives in microseconds. A passphrase
|
|
32
|
+
* credential is low-entropy, so its `keyAgreement` key publishes as a hash
|
|
33
|
+
* commitment.
|
|
34
|
+
*
|
|
35
|
+
* The unlock records every shape binds are held in memory and never written:
|
|
36
|
+
* their codec and their storage are the wallet's. What a shape returns in
|
|
37
|
+
* their place is what the bind carried, the bridge and sibling delegations
|
|
38
|
+
* and the ladder seed, so a test can act as the credential afterwards.
|
|
39
|
+
*
|
|
40
|
+
* No shape performs the other app-side writes either. No shape writes an
|
|
41
|
+
* unlock-methods registry record. No shape writes a `connections` directory
|
|
42
|
+
* entry for the enrolled client. Each ladder-context add
|
|
43
|
+
* (`addStandingCredential`, `issueRecoveryCode`) enrolls one transient VM
|
|
44
|
+
* into the pointed generation, and `buildPassphraseAccount` enrolls none. So
|
|
45
|
+
* a shape's annex VM count differs from a real signup's.
|
|
46
|
+
*
|
|
47
|
+
* Each builder run keeps its own in-memory chain-head pins, as a fresh tab
|
|
48
|
+
* would.
|
|
49
|
+
*/
|
|
50
|
+
import { WasClient } from '@interop/was-client';
|
|
51
|
+
import { agentsFromSeed } from '@interop/was-client/identity';
|
|
52
|
+
import { memoryResourceLogPinStore } from '@interop/vh-resource-log';
|
|
53
|
+
import { clientAnnexDidParts, clientAnnexLogStore, commitClientAnnexRung, delegatedClientsPointer, embeddedGenerationDelegation, enrollTransientClient, establishCredentialAnchoredAccount, ladderVmAgent, ladderVmZcapClient, mintDelegatedClientsDelegation, selfEnrollClientCore } from '../clientAnnex/index.js';
|
|
54
|
+
import { mintSpaceId } from '../genesis/index.js';
|
|
55
|
+
import { deriveUnlockSeed, unlockIdentityFromSeed } from '../keyring/index.js';
|
|
56
|
+
import { accountCollectionStores, addUserKeyRosterRecipient, userKeyRosterDescriptorStore, userKeyRosterLogSigner } from '../keys/index.js';
|
|
57
|
+
import { delegateLogWrite, generateRecoveryCode, publishRecoveryKey, recoveryClientFromCode } from '../recovery/index.js';
|
|
58
|
+
import { webvhResourceLogController } from '../resourceLog/index.js';
|
|
59
|
+
import { ID_COLLECTION } from '../space/index.js';
|
|
60
|
+
import { generateLadderSeed, publishUnlockKey, standingClientFromUnlockSeed } from '../unlock/index.js';
|
|
61
|
+
import { clientSigningKeyMultibase, delegatedWebvhLogStore, didKeyZcapClient, keyAgreementCommitment, ladderRung, verifyAccountLog, wasWebvhIdStore, webvhZcapClient } from '../webvh/index.js';
|
|
62
|
+
import { FAST_KDF } from './fastKdf.js';
|
|
63
|
+
/**
|
|
64
|
+
* A passphrase no other account in the process uses.
|
|
65
|
+
*
|
|
66
|
+
* @returns {string}
|
|
67
|
+
*/
|
|
68
|
+
function uniquePassphrase() {
|
|
69
|
+
return `builder-account-${crypto.randomUUID()}-Zz9!`;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A fresh credential and the account Space id it will be carried under: a
|
|
73
|
+
* random ladder seed, and the standing client derived from the credential's
|
|
74
|
+
* unlock seed. Given a passphrase, the unlock seed derives under `FAST_KDF`
|
|
75
|
+
* and the credential is low-entropy; the unlock identity rides along so a
|
|
76
|
+
* test can name its unlock Space. Without one, the unlock seed is 32 random
|
|
77
|
+
* bytes and the credential is high-entropy.
|
|
78
|
+
*
|
|
79
|
+
* @param [options] {object}
|
|
80
|
+
* @param [options.passphrase] {string}
|
|
81
|
+
* @returns {Promise<object>} `{ spaceId, ladderSeed, standing, lowEntropy,
|
|
82
|
+
* unlock? }`
|
|
83
|
+
*/
|
|
84
|
+
export async function mintCredential({ passphrase } = {}) {
|
|
85
|
+
const unlockSeed = passphrase === undefined
|
|
86
|
+
? crypto.getRandomValues(new Uint8Array(32))
|
|
87
|
+
: await deriveUnlockSeed({ secret: passphrase, kdf: FAST_KDF });
|
|
88
|
+
return {
|
|
89
|
+
spaceId: mintSpaceId(),
|
|
90
|
+
ladderSeed: generateLadderSeed(),
|
|
91
|
+
standing: await standingClientFromUnlockSeed({ unlockSeed }),
|
|
92
|
+
lowEntropy: passphrase !== undefined,
|
|
93
|
+
...(passphrase === undefined
|
|
94
|
+
? {}
|
|
95
|
+
: { unlock: await unlockIdentityFromSeed({ seed: unlockSeed }) })
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Establishes a credential-anchored account on the server, through one run of
|
|
100
|
+
* the signup ceremony. Each call is one run with its own in-memory pins, as a
|
|
101
|
+
* fresh tab's would be, so a test re-running a torn establishment passes the
|
|
102
|
+
* same `credential` again.
|
|
103
|
+
*
|
|
104
|
+
* @param options {object}
|
|
105
|
+
* @param options.serverUrl {string} the booted server's URL
|
|
106
|
+
* @param [options.credential] {BuilderCredential} from `mintCredential`; a
|
|
107
|
+
* fresh high-entropy one when omitted
|
|
108
|
+
* @returns {Promise<object>} the account's ids, the credential's ladder seed
|
|
109
|
+
* and standing client, and the bridge and sibling delegations the re-bind
|
|
110
|
+
* carried
|
|
111
|
+
*/
|
|
112
|
+
export async function establishAccount({ serverUrl, credential }) {
|
|
113
|
+
const { spaceId, ladderSeed, standing, lowEntropy, unlock } = credential ?? (await mintCredential());
|
|
114
|
+
const pinStore = memoryResourceLogPinStore();
|
|
115
|
+
const bootstrapAgent = await ladderVmAgent({ ladderSeed });
|
|
116
|
+
const bootstrapZcap = didKeyZcapClient({ keyAgent: bootstrapAgent });
|
|
117
|
+
const bootstrapWas = new WasClient({ serverUrl, zcapClient: bootstrapZcap });
|
|
118
|
+
const signer = userKeyRosterLogSigner({ keyAgent: bootstrapAgent });
|
|
119
|
+
// The unlock record, held in memory. The re-bind is the last call, and the
|
|
120
|
+
// one carrying the sibling delegation.
|
|
121
|
+
const binds = [];
|
|
122
|
+
const establishment = await establishCredentialAnchoredAccount({
|
|
123
|
+
wasServerUrl: serverUrl,
|
|
124
|
+
spaceId,
|
|
125
|
+
ladderSeed,
|
|
126
|
+
standing: {
|
|
127
|
+
clientDid: standing.clientDid,
|
|
128
|
+
keyAgreementKeyMultibase: standing.keyAgreementKeyMultibase,
|
|
129
|
+
recipientKid: standing.recipientKid,
|
|
130
|
+
keyAgreementKey: standing.agents.keyAgreementKey
|
|
131
|
+
},
|
|
132
|
+
lowEntropy,
|
|
133
|
+
bindRecord: async ({ delegation, delegatedClients }) => {
|
|
134
|
+
binds.push({
|
|
135
|
+
delegation,
|
|
136
|
+
...(delegatedClients ? { delegatedClients } : {})
|
|
137
|
+
});
|
|
138
|
+
return {
|
|
139
|
+
createdAt: new Date(Date.now() + binds.length).toISOString(),
|
|
140
|
+
unlockSpaceId: unlock?.spaceId ?? 'unlock-space-held-in-memory'
|
|
141
|
+
};
|
|
142
|
+
},
|
|
143
|
+
rosterStoreFor: ({ did, log }) => userKeyRosterDescriptorStore({
|
|
144
|
+
storageServerUrl: serverUrl,
|
|
145
|
+
zcapClient: bootstrapZcap,
|
|
146
|
+
spaceId,
|
|
147
|
+
resolveController: async () => webvhResourceLogController({ did, log }),
|
|
148
|
+
pinStore,
|
|
149
|
+
signer
|
|
150
|
+
}),
|
|
151
|
+
collectionStoreFor: ({ did, log }) => accountCollectionStores({
|
|
152
|
+
storageServerUrl: serverUrl,
|
|
153
|
+
zcapClient: bootstrapZcap,
|
|
154
|
+
spaceId,
|
|
155
|
+
did,
|
|
156
|
+
pinStore,
|
|
157
|
+
signer,
|
|
158
|
+
log
|
|
159
|
+
}),
|
|
160
|
+
bootstrapWasFor: () => bootstrapWas,
|
|
161
|
+
idStore: wasWebvhIdStore({ was: bootstrapWas, spaceId, pinStore })
|
|
162
|
+
});
|
|
163
|
+
const record = binds.at(-1);
|
|
164
|
+
if (!record?.delegatedClients) {
|
|
165
|
+
throw new Error('fixture: the re-bind carried no sibling delegation');
|
|
166
|
+
}
|
|
167
|
+
const pointed = delegatedClientsPointer({ doc: establishment.accountLog.doc });
|
|
168
|
+
if (pointed === undefined) {
|
|
169
|
+
throw new Error('fixture: the establishment left no pointer');
|
|
170
|
+
}
|
|
171
|
+
return {
|
|
172
|
+
serverUrl,
|
|
173
|
+
spaceId,
|
|
174
|
+
accountDid: establishment.did,
|
|
175
|
+
annexSpaceId: clientAnnexDidParts({ did: pointed }).spaceId,
|
|
176
|
+
ladderSeed,
|
|
177
|
+
standing,
|
|
178
|
+
bridge: record.delegation,
|
|
179
|
+
sibling: record.delegatedClients
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* A credential-anchored account with one passphrase.
|
|
184
|
+
*
|
|
185
|
+
* @param options {object}
|
|
186
|
+
* @param options.serverUrl {string}
|
|
187
|
+
* @param [options.passphrase] {string} a unique one by default
|
|
188
|
+
* @returns {Promise<object>} the established account plus `passphrase`
|
|
189
|
+
*/
|
|
190
|
+
export async function buildPassphraseAccount({ serverUrl, passphrase = uniquePassphrase() }) {
|
|
191
|
+
const account = await establishAccount({
|
|
192
|
+
serverUrl,
|
|
193
|
+
credential: await mintCredential({ passphrase })
|
|
194
|
+
});
|
|
195
|
+
return { ...account, passphrase };
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* The account-ceremony context a transient session on the account's
|
|
199
|
+
* credential acts under (the ladder kind): the account log written through
|
|
200
|
+
* the record's bridge and signed by a ladder rung, and roster appends signed
|
|
201
|
+
* by the ladder VM and invoked by a per-visit annex VM under the generation
|
|
202
|
+
* delegation, the only authority such a session holds over the account
|
|
203
|
+
* Space once its controller is the did:webvh.
|
|
204
|
+
*
|
|
205
|
+
* @param options {object}
|
|
206
|
+
* @param options.account {EstablishedAccount}
|
|
207
|
+
* @param options.pinStore {ResourceLogPinStore} the run's chain-head pins
|
|
208
|
+
* @returns {Promise<object>} `{ idStore, rosterStore, signer }`
|
|
209
|
+
*/
|
|
210
|
+
async function ladderContext({ account, pinStore }) {
|
|
211
|
+
const { serverUrl, spaceId, accountDid, annexSpaceId, ladderSeed } = account;
|
|
212
|
+
const readAccountLog = async () => verifyAccountLog({ did: accountDid, spaceId, host: serverUrl, pinStore });
|
|
213
|
+
// The transient visit: a per-visit key enrolled into the pointed
|
|
214
|
+
// generation through the record's sibling delegation.
|
|
215
|
+
const { keyAgent } = await agentsFromSeed({
|
|
216
|
+
seed: crypto.getRandomValues(new Uint8Array(32))
|
|
217
|
+
});
|
|
218
|
+
const enrolled = await enrollTransientClient({
|
|
219
|
+
readAccountDocument: async () => (await readAccountLog()).doc,
|
|
220
|
+
storeForGenerationId: generationId => delegatedWebvhLogStore({
|
|
221
|
+
host: serverUrl,
|
|
222
|
+
spaceId: annexSpaceId,
|
|
223
|
+
collectionId: generationId,
|
|
224
|
+
delegation: account.sibling,
|
|
225
|
+
zcapClient: account.standing.agents.zcapClient,
|
|
226
|
+
pinStore
|
|
227
|
+
}),
|
|
228
|
+
ladderSeed,
|
|
229
|
+
transientKeyMultibase: clientSigningKeyMultibase({ keyAgent })
|
|
230
|
+
});
|
|
231
|
+
const capability = embeddedGenerationDelegation({ doc: enrolled.doc });
|
|
232
|
+
if (capability === undefined) {
|
|
233
|
+
throw new Error('fixture: the generation carries no delegation');
|
|
234
|
+
}
|
|
235
|
+
return {
|
|
236
|
+
// Public reads of the world-readable `did.jsonl`, and the bridge's
|
|
237
|
+
// delegated PUT, invoked by the credential's standing client. The two
|
|
238
|
+
// publishers declare the wide `WebvhIdStore` but only forward the store
|
|
239
|
+
// to `signAccountEntry`, which needs the three-member shape.
|
|
240
|
+
idStore: delegatedWebvhLogStore({
|
|
241
|
+
host: serverUrl,
|
|
242
|
+
spaceId,
|
|
243
|
+
collectionId: ID_COLLECTION.id,
|
|
244
|
+
delegation: account.bridge,
|
|
245
|
+
zcapClient: account.standing.agents.zcapClient,
|
|
246
|
+
pinStore
|
|
247
|
+
}),
|
|
248
|
+
// The controller view resolves per operation, so an append after an
|
|
249
|
+
// entry anchors at the post-entry head.
|
|
250
|
+
rosterStore: userKeyRosterDescriptorStore({
|
|
251
|
+
storageServerUrl: serverUrl,
|
|
252
|
+
zcapClient: webvhZcapClient({ keyAgent, did: enrolled.clientAnnexDid }),
|
|
253
|
+
spaceId,
|
|
254
|
+
resolveController: async () => webvhResourceLogController({
|
|
255
|
+
did: accountDid,
|
|
256
|
+
log: (await readAccountLog()).log
|
|
257
|
+
}),
|
|
258
|
+
pinStore,
|
|
259
|
+
signer: userKeyRosterLogSigner({
|
|
260
|
+
keyAgent: await ladderVmAgent({ ladderSeed })
|
|
261
|
+
}),
|
|
262
|
+
capability
|
|
263
|
+
}),
|
|
264
|
+
signer: { kind: 'ladder', ladderSeed },
|
|
265
|
+
standingKeyAgreementKey: account.standing.agents
|
|
266
|
+
.keyAgreementKey
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Adds a second standing credential to the account, acting as the account's
|
|
271
|
+
* existing credential in a transient session: the standing establishment's
|
|
272
|
+
* ladder branch. The new credential's bridge and sibling delegations are
|
|
273
|
+
* signed by its OWN ladder VM; its record binds in memory; its ladder's rung
|
|
274
|
+
* 0 is committed into the pointed generation (blocking on this branch); the
|
|
275
|
+
* bind entry publishes, signed by the acting credential's ladder; and only
|
|
276
|
+
* then is the new credential escrowed into the roster, since a ladder-signed
|
|
277
|
+
* roster append is licensed at the inventory-changing version its own entry
|
|
278
|
+
* mints.
|
|
279
|
+
*
|
|
280
|
+
* A second call with the same passphrase is not a converging re-run: each
|
|
281
|
+
* call mints a fresh ladder seed, so the re-bind is refused at
|
|
282
|
+
* `publishUnlockKey`.
|
|
283
|
+
*
|
|
284
|
+
* @param options {object}
|
|
285
|
+
* @param options.account {EstablishedAccount} the acting credential's
|
|
286
|
+
* account
|
|
287
|
+
* @param [options.passphrase] {string} the new credential's passphrase, a
|
|
288
|
+
* unique one by default
|
|
289
|
+
* @returns {Promise<object>} the new credential's passphrase, standing
|
|
290
|
+
* client, ladder seed, bridge, and sibling
|
|
291
|
+
*/
|
|
292
|
+
export async function addStandingCredential({ account, passphrase = uniquePassphrase() }) {
|
|
293
|
+
const { serverUrl, spaceId, accountDid, annexSpaceId } = account;
|
|
294
|
+
const pinStore = memoryResourceLogPinStore();
|
|
295
|
+
const ctx = await ladderContext({ account, pinStore });
|
|
296
|
+
const pointer = { did: accountDid, spaceId, host: serverUrl };
|
|
297
|
+
const { standing, ladderSeed } = await mintCredential({ passphrase });
|
|
298
|
+
const rung0 = await ladderRung({ ladderSeed, index: 0 });
|
|
299
|
+
const boundZcapClient = await ladderVmZcapClient({ accountDid, ladderSeed });
|
|
300
|
+
// The bridge and sibling, held in memory as the bound record's members.
|
|
301
|
+
const bridge = await delegateLogWrite({
|
|
302
|
+
zcapClient: boundZcapClient,
|
|
303
|
+
pointer,
|
|
304
|
+
recoveryClientDid: standing.clientDid
|
|
305
|
+
});
|
|
306
|
+
const sibling = await mintDelegatedClientsDelegation({
|
|
307
|
+
zcapClient: boundZcapClient,
|
|
308
|
+
wasServerUrl: serverUrl,
|
|
309
|
+
clientAnnexSpaceId: annexSpaceId,
|
|
310
|
+
controller: standing.clientDid
|
|
311
|
+
});
|
|
312
|
+
// The bound credential's annex rung 0, committed under the acting
|
|
313
|
+
// credential's rung through the acting record's sibling.
|
|
314
|
+
const { doc } = await verifyAccountLog({
|
|
315
|
+
did: accountDid,
|
|
316
|
+
spaceId,
|
|
317
|
+
host: serverUrl,
|
|
318
|
+
pinStore
|
|
319
|
+
});
|
|
320
|
+
const clientAnnexDid = delegatedClientsPointer({ doc });
|
|
321
|
+
if (clientAnnexDid === undefined) {
|
|
322
|
+
throw new Error('fixture: the account points at no annex generation');
|
|
323
|
+
}
|
|
324
|
+
const { generationId } = clientAnnexDidParts({ did: clientAnnexDid });
|
|
325
|
+
await commitClientAnnexRung({
|
|
326
|
+
store: clientAnnexLogStore({
|
|
327
|
+
was: new WasClient({
|
|
328
|
+
serverUrl,
|
|
329
|
+
zcapClient: account.standing.agents.zcapClient
|
|
330
|
+
}),
|
|
331
|
+
spaceId: annexSpaceId,
|
|
332
|
+
generationId,
|
|
333
|
+
pinStore,
|
|
334
|
+
capability: account.sibling
|
|
335
|
+
}),
|
|
336
|
+
boundLadderSeed: ladderSeed,
|
|
337
|
+
actingLadderSeed: account.ladderSeed,
|
|
338
|
+
generationId,
|
|
339
|
+
expectedDid: clientAnnexDid
|
|
340
|
+
});
|
|
341
|
+
await publishUnlockKey({
|
|
342
|
+
idStore: ctx.idStore,
|
|
343
|
+
signer: ctx.signer,
|
|
344
|
+
unlockKeys: {
|
|
345
|
+
keyAgreement: {
|
|
346
|
+
commitment: await keyAgreementCommitment({
|
|
347
|
+
keyAgreementKeyMultibase: standing.keyAgreementKeyMultibase
|
|
348
|
+
})
|
|
349
|
+
},
|
|
350
|
+
updateKeyMultibase: rung0.keyMultibase
|
|
351
|
+
},
|
|
352
|
+
ladderSeed,
|
|
353
|
+
expectedDid: accountDid
|
|
354
|
+
});
|
|
355
|
+
await addUserKeyRosterRecipient({
|
|
356
|
+
store: ctx.rosterStore,
|
|
357
|
+
recipient: {
|
|
358
|
+
id: standing.recipientKid,
|
|
359
|
+
publicKeyMultibase: standing.keyAgreementKeyMultibase
|
|
360
|
+
},
|
|
361
|
+
ownerKeyAgreementKey: ctx.standingKeyAgreementKey
|
|
362
|
+
});
|
|
363
|
+
return { passphrase, standing, ladderSeed, bridge, sibling };
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Issues one recovery code, acting as the account's credential in a
|
|
367
|
+
* transient session: the issuance's ladder branch. The code's bridge is
|
|
368
|
+
* signed by the code's own ladder VM and binds in memory; then the code's
|
|
369
|
+
* `keyAgreement` key publishes, its wrap is escrowed into the roster, and the
|
|
370
|
+
* authority half (its ladder VM and rung-0 commitment) publishes last. The
|
|
371
|
+
* code is not spent.
|
|
372
|
+
*
|
|
373
|
+
* @param options {object}
|
|
374
|
+
* @param options.account {EstablishedAccount}
|
|
375
|
+
* @returns {Promise<object>} `{ code, client, recoveryKid, bridge }`
|
|
376
|
+
*/
|
|
377
|
+
export async function issueRecoveryCode({ account }) {
|
|
378
|
+
const { serverUrl, spaceId, accountDid } = account;
|
|
379
|
+
const pinStore = memoryResourceLogPinStore();
|
|
380
|
+
const ctx = await ladderContext({ account, pinStore });
|
|
381
|
+
const pointer = { did: accountDid, spaceId, host: serverUrl };
|
|
382
|
+
const code = generateRecoveryCode();
|
|
383
|
+
const client = await recoveryClientFromCode({ code });
|
|
384
|
+
const recovery = {
|
|
385
|
+
keyAgreementKeyMultibase: client.keyAgreementKeyMultibase,
|
|
386
|
+
updateKeyMultibase: client.updateKeyMultibase
|
|
387
|
+
};
|
|
388
|
+
const bridge = await delegateLogWrite({
|
|
389
|
+
zcapClient: await ladderVmZcapClient({
|
|
390
|
+
accountDid,
|
|
391
|
+
ladderSeed: client.ladderSeed
|
|
392
|
+
}),
|
|
393
|
+
pointer,
|
|
394
|
+
recoveryClientDid: client.clientDid
|
|
395
|
+
});
|
|
396
|
+
const publishPart = async (part) => publishRecoveryKey({
|
|
397
|
+
idStore: ctx.idStore,
|
|
398
|
+
signer: ctx.signer,
|
|
399
|
+
recovery,
|
|
400
|
+
ladderSeed: client.ladderSeed,
|
|
401
|
+
part,
|
|
402
|
+
expectedDid: accountDid
|
|
403
|
+
});
|
|
404
|
+
await publishPart('key');
|
|
405
|
+
await addUserKeyRosterRecipient({
|
|
406
|
+
store: ctx.rosterStore,
|
|
407
|
+
recipient: {
|
|
408
|
+
id: client.recipientKid,
|
|
409
|
+
publicKeyMultibase: client.keyAgreementKeyMultibase
|
|
410
|
+
},
|
|
411
|
+
ownerKeyAgreementKey: ctx.standingKeyAgreementKey
|
|
412
|
+
});
|
|
413
|
+
await publishPart('authority');
|
|
414
|
+
return { code, client, recoveryKid: client.recipientKid, bridge };
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Self-enrolls one enrolled client with the account's credential
|
|
418
|
+
* (`selfEnrollClientCore`), writing the account log through the record's
|
|
419
|
+
* bridge. The `onCommitted` seam is an in-memory no-op: a wallet persists
|
|
420
|
+
* the pending client-key record there, and here the seeds the core hands
|
|
421
|
+
* back are returned to the caller, which is this fixture's persist. A torn
|
|
422
|
+
* run is not this fixture's subject.
|
|
423
|
+
*
|
|
424
|
+
* @param options {object}
|
|
425
|
+
* @param options.account {EstablishedAccount}
|
|
426
|
+
* @returns {Promise<object>} the new client's seed, agents, signing key
|
|
427
|
+
* multibase, did:webvh update keys, did:key, the user key it read, and a
|
|
428
|
+
* zcap client signing as `<accountDid>#<signing key>`
|
|
429
|
+
*/
|
|
430
|
+
export async function enrollClient({ account }) {
|
|
431
|
+
const { serverUrl, spaceId, accountDid, ladderSeed, standing } = account;
|
|
432
|
+
const pinStore = memoryResourceLogPinStore();
|
|
433
|
+
const enrolled = await selfEnrollClientCore({
|
|
434
|
+
pointer: { did: accountDid, spaceId, host: serverUrl },
|
|
435
|
+
ladderSeed,
|
|
436
|
+
credentialKeyAgreementKey: standing.agents
|
|
437
|
+
.keyAgreementKey,
|
|
438
|
+
logStore: delegatedWebvhLogStore({
|
|
439
|
+
host: serverUrl,
|
|
440
|
+
spaceId,
|
|
441
|
+
collectionId: ID_COLLECTION.id,
|
|
442
|
+
delegation: account.bridge,
|
|
443
|
+
zcapClient: standing.agents.zcapClient,
|
|
444
|
+
pinStore
|
|
445
|
+
}),
|
|
446
|
+
onCommitted: async () => { }
|
|
447
|
+
});
|
|
448
|
+
const agents = await agentsFromSeed({ seed: enrolled.clientSeed });
|
|
449
|
+
const zcapClient = webvhZcapClient({
|
|
450
|
+
keyAgent: agents.keyAgent,
|
|
451
|
+
did: accountDid
|
|
452
|
+
});
|
|
453
|
+
return {
|
|
454
|
+
clientSeed: enrolled.clientSeed,
|
|
455
|
+
agents,
|
|
456
|
+
signingKeyMultibase: clientSigningKeyMultibase({
|
|
457
|
+
keyAgent: agents.keyAgent
|
|
458
|
+
}),
|
|
459
|
+
webvhUpdateKeys: enrolled.webvhUpdateKeys,
|
|
460
|
+
clientDid: enrolled.clientDid,
|
|
461
|
+
userKey: enrolled.userKey,
|
|
462
|
+
zcapClient
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* The passphrase shape plus a second standing credential.
|
|
467
|
+
*
|
|
468
|
+
* @param options {object}
|
|
469
|
+
* @param options.serverUrl {string}
|
|
470
|
+
* @param [options.passphrase] {string} a unique one by default
|
|
471
|
+
* @returns {Promise<object>} the passphrase account plus `second`
|
|
472
|
+
*/
|
|
473
|
+
export async function buildSecondCredentialAccount({ serverUrl, passphrase }) {
|
|
474
|
+
const account = await buildPassphraseAccount({
|
|
475
|
+
serverUrl,
|
|
476
|
+
...(passphrase === undefined ? {} : { passphrase })
|
|
477
|
+
});
|
|
478
|
+
return { ...account, second: await addStandingCredential({ account }) };
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* The passphrase shape plus one issued, unspent recovery code.
|
|
482
|
+
*
|
|
483
|
+
* @param options {object}
|
|
484
|
+
* @param options.serverUrl {string}
|
|
485
|
+
* @param [options.passphrase] {string} a unique one by default
|
|
486
|
+
* @returns {Promise<object>} the passphrase account plus `recovery`
|
|
487
|
+
*/
|
|
488
|
+
export async function buildRecoveryCodeAccount({ serverUrl, passphrase }) {
|
|
489
|
+
const account = await buildPassphraseAccount({
|
|
490
|
+
serverUrl,
|
|
491
|
+
...(passphrase === undefined ? {} : { passphrase })
|
|
492
|
+
});
|
|
493
|
+
return { ...account, recovery: await issueRecoveryCode({ account }) };
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* The passphrase shape plus one enrolled client.
|
|
497
|
+
*
|
|
498
|
+
* @param options {object}
|
|
499
|
+
* @param options.serverUrl {string}
|
|
500
|
+
* @param [options.passphrase] {string} a unique one by default
|
|
501
|
+
* @returns {Promise<object>} the passphrase account plus `client`
|
|
502
|
+
*/
|
|
503
|
+
export async function buildEnrolledClientAccount({ serverUrl, passphrase }) {
|
|
504
|
+
const account = await buildPassphraseAccount({
|
|
505
|
+
serverUrl,
|
|
506
|
+
...(passphrase === undefined ? {} : { passphrase })
|
|
507
|
+
});
|
|
508
|
+
return { ...account, client: await enrollClient({ account }) };
|
|
509
|
+
}
|
|
510
|
+
//# sourceMappingURL=accountBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accountBuilder.js","sourceRoot":"","sources":["../../src/testing/accountBuilder.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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Y. A cheap stand-in for the passphrase parameter set, for
|
|
6
|
+
* tests whose subject is a record codec or a ceremony rather than the KDF
|
|
7
|
+
* itself (`keyring-kdf.test.ts` pins that one): an HKDF expansion in place of
|
|
8
|
+
* the shipped memory-hard Argon2id stretch, which costs a 64 MiB allocation
|
|
9
|
+
* and a visible fraction of a second per derivation.
|
|
10
|
+
*
|
|
11
|
+
* Never import this subpath from production code: an unlock identity derived
|
|
12
|
+
* under it is not the one the shipped `KEYRING_KDF` derives.
|
|
13
|
+
*/
|
|
14
|
+
import type { UnlockKdf } from '../keyring/index.js';
|
|
15
|
+
export declare const FAST_KDF: UnlockKdf;
|
|
16
|
+
//# sourceMappingURL=fastKdf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fastKdf.d.ts","sourceRoot":"","sources":["../../src/testing/fastKdf.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAEpD,eAAO,MAAM,QAAQ,EAAE,SAMtB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fastKdf.js","sourceRoot":"","sources":["../../src/testing/fastKdf.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,MAAM,QAAQ,GAAc;IACjC,OAAO,EAAE,CAAC;IACV,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,iCAAiC;IACvC,IAAI,EAAE,aAAa;CACpB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* TEST FIXTURES ONLY: the `./testing` subpath. The recorded-grant signer
|
|
6
|
+
* fixture, the fast passphrase KDF, and the account builder that makes real
|
|
7
|
+
* accounts against a caller-booted WAS server. Never import it from
|
|
8
|
+
* production code.
|
|
9
|
+
*/
|
|
10
|
+
export * from './signerFixture.js';
|
|
11
|
+
export * from './fastKdf.js';
|
|
12
|
+
export * from './accountBuilder.js';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;GAKG;AACH,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* TEST FIXTURES ONLY: the `./testing` subpath. The recorded-grant signer
|
|
6
|
+
* fixture, the fast passphrase KDF, and the account builder that makes real
|
|
7
|
+
* accounts against a caller-booted WAS server. Never import it from
|
|
8
|
+
* production code.
|
|
9
|
+
*/
|
|
10
|
+
export * from './signerFixture.js';
|
|
11
|
+
export * from './fastKdf.js';
|
|
12
|
+
export * from './accountBuilder.js';
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;GAKG;AACH,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA"}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* globs.
|
|
14
14
|
*/
|
|
15
15
|
import type { IZcap } from '@interop/data-integrity-core';
|
|
16
|
-
import type { AccountSignerCheck } from '
|
|
16
|
+
import type { AccountSignerCheck } from '../clientAnnex/grantRevocation.js';
|
|
17
17
|
/**
|
|
18
18
|
* The account the signer-check fixture describes: one enrolled client and
|
|
19
19
|
* one standing credential's ladder VM under `capabilityDelegation`, the
|
|
@@ -75,4 +75,4 @@ export declare function recordedGrant({ id, controller, invocationTarget, expire
|
|
|
75
75
|
signerKeyId?: string;
|
|
76
76
|
};
|
|
77
77
|
}): IZcap;
|
|
78
|
-
//# sourceMappingURL=
|
|
78
|
+
//# sourceMappingURL=signerFixture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signerFixture.d.ts","sourceRoot":"","sources":["../../src/testing/signerFixture.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAE3E;;;;;GAKG;AACH,eAAO,MAAM,cAAc;;;;;;;;CAQjB,CAAA;AAEV;;;GAGG;AACH,eAAO,MAAM,eAAe,QAA+D,CAAA;AAC3F,eAAO,MAAM,aAAa,QAA4D,CAAA;AACtF,eAAO,MAAM,WAAW,QAA0C,CAAA;AAElE;;;;;;GAMG;AACH,wBAAgB,kBAAkB,IAAI,kBAAkB,CAcvD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,aAAa,CAAC,EAC5B,EAAmB,EACnB,UAAkC,EAClC,gBAAoE,EACpE,OAAgC,EAChC,WAAW,EACX,MAAM,EACP,GAAE;IACD,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CACjD,GAAG,KAAK,CAuBb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signerFixture.js","sourceRo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