@interop/wallet-core 0.100.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.
Files changed (37) hide show
  1. package/README.md +8 -0
  2. package/dist/space/ceremony.d.ts +5 -4
  3. package/dist/space/ceremony.d.ts.map +1 -1
  4. package/dist/space/ceremony.js +7 -4
  5. package/dist/space/ceremony.js.map +1 -1
  6. package/dist/sync/index.d.ts +1 -1
  7. package/dist/sync/index.js +1 -1
  8. package/dist/sync/push.d.ts.map +1 -1
  9. package/dist/sync/push.js +17 -25
  10. package/dist/sync/push.js.map +1 -1
  11. package/dist/sync/remint.d.ts +1 -1
  12. package/dist/sync/remint.d.ts.map +1 -1
  13. package/dist/sync/remint.js +2 -2
  14. package/dist/sync/remint.js.map +1 -1
  15. package/dist/sync/types.d.ts +36 -33
  16. package/dist/sync/types.d.ts.map +1 -1
  17. package/dist/sync/types.js +8 -5
  18. package/dist/sync/types.js.map +1 -1
  19. package/dist/testing/accountBuilder.d.ts +237 -0
  20. package/dist/testing/accountBuilder.d.ts.map +1 -0
  21. package/dist/testing/accountBuilder.js +510 -0
  22. package/dist/testing/accountBuilder.js.map +1 -0
  23. package/dist/testing/fastKdf.d.ts +16 -0
  24. package/dist/testing/fastKdf.d.ts.map +1 -0
  25. package/dist/testing/fastKdf.js +8 -0
  26. package/dist/testing/fastKdf.js.map +1 -0
  27. package/dist/testing/index.d.ts +13 -0
  28. package/dist/testing/index.d.ts.map +1 -0
  29. package/dist/testing/index.js +13 -0
  30. package/dist/testing/index.js.map +1 -0
  31. package/dist/{testing.d.ts → testing/signerFixture.d.ts} +2 -2
  32. package/dist/testing/signerFixture.d.ts.map +1 -0
  33. package/dist/{testing.js → testing/signerFixture.js} +1 -1
  34. package/dist/testing/signerFixture.js.map +1 -0
  35. package/package.json +12 -10
  36. package/dist/testing.d.ts.map +0 -1
  37. package/dist/testing.js.map +0 -1
@@ -0,0 +1,237 @@
1
+ import type { IZcap } from '@interop/data-integrity-core';
2
+ import type { ZcapClient } from '@interop/ezcap';
3
+ /**
4
+ * A fresh credential and the account Space id it will be carried under: a
5
+ * random ladder seed, and the standing client derived from the credential's
6
+ * unlock seed. Given a passphrase, the unlock seed derives under `FAST_KDF`
7
+ * and the credential is low-entropy; the unlock identity rides along so a
8
+ * test can name its unlock Space. Without one, the unlock seed is 32 random
9
+ * bytes and the credential is high-entropy.
10
+ *
11
+ * @param [options] {object}
12
+ * @param [options.passphrase] {string}
13
+ * @returns {Promise<object>} `{ spaceId, ladderSeed, standing, lowEntropy,
14
+ * unlock? }`
15
+ */
16
+ export declare function mintCredential({ passphrase }?: {
17
+ passphrase?: string;
18
+ }): Promise<{
19
+ unlock?: import("../keyring/unlockIdentity.js").UnlockIdentity | undefined;
20
+ spaceId: string;
21
+ ladderSeed: Uint8Array<ArrayBufferLike>;
22
+ standing: import("../unlock/standingClient.js").StandingUnlockClient;
23
+ lowEntropy: boolean;
24
+ }>;
25
+ /**
26
+ * A credential as {@link mintCredential} returns it.
27
+ */
28
+ export type BuilderCredential = Awaited<ReturnType<typeof mintCredential>>;
29
+ /**
30
+ * Establishes a credential-anchored account on the server, through one run of
31
+ * the signup ceremony. Each call is one run with its own in-memory pins, as a
32
+ * fresh tab's would be, so a test re-running a torn establishment passes the
33
+ * same `credential` again.
34
+ *
35
+ * @param options {object}
36
+ * @param options.serverUrl {string} the booted server's URL
37
+ * @param [options.credential] {BuilderCredential} from `mintCredential`; a
38
+ * fresh high-entropy one when omitted
39
+ * @returns {Promise<object>} the account's ids, the credential's ladder seed
40
+ * and standing client, and the bridge and sibling delegations the re-bind
41
+ * carried
42
+ */
43
+ export declare function establishAccount({ serverUrl, credential }: {
44
+ serverUrl: string;
45
+ credential?: BuilderCredential;
46
+ }): Promise<{
47
+ serverUrl: string;
48
+ spaceId: string;
49
+ accountDid: string;
50
+ annexSpaceId: string;
51
+ ladderSeed: Uint8Array<ArrayBufferLike>;
52
+ standing: import("../unlock/standingClient.js").StandingUnlockClient;
53
+ bridge: IZcap;
54
+ sibling: IZcap;
55
+ }>;
56
+ export type EstablishedAccount = Awaited<ReturnType<typeof establishAccount>>;
57
+ /**
58
+ * A credential-anchored account with one passphrase.
59
+ *
60
+ * @param options {object}
61
+ * @param options.serverUrl {string}
62
+ * @param [options.passphrase] {string} a unique one by default
63
+ * @returns {Promise<object>} the established account plus `passphrase`
64
+ */
65
+ export declare function buildPassphraseAccount({ serverUrl, passphrase }: {
66
+ serverUrl: string;
67
+ passphrase?: string;
68
+ }): Promise<EstablishedAccount & {
69
+ passphrase: string;
70
+ }>;
71
+ /**
72
+ * Adds a second standing credential to the account, acting as the account's
73
+ * existing credential in a transient session: the standing establishment's
74
+ * ladder branch. The new credential's bridge and sibling delegations are
75
+ * signed by its OWN ladder VM; its record binds in memory; its ladder's rung
76
+ * 0 is committed into the pointed generation (blocking on this branch); the
77
+ * bind entry publishes, signed by the acting credential's ladder; and only
78
+ * then is the new credential escrowed into the roster, since a ladder-signed
79
+ * roster append is licensed at the inventory-changing version its own entry
80
+ * mints.
81
+ *
82
+ * A second call with the same passphrase is not a converging re-run: each
83
+ * call mints a fresh ladder seed, so the re-bind is refused at
84
+ * `publishUnlockKey`.
85
+ *
86
+ * @param options {object}
87
+ * @param options.account {EstablishedAccount} the acting credential's
88
+ * account
89
+ * @param [options.passphrase] {string} the new credential's passphrase, a
90
+ * unique one by default
91
+ * @returns {Promise<object>} the new credential's passphrase, standing
92
+ * client, ladder seed, bridge, and sibling
93
+ */
94
+ export declare function addStandingCredential({ account, passphrase }: {
95
+ account: EstablishedAccount;
96
+ passphrase?: string;
97
+ }): Promise<{
98
+ passphrase: string;
99
+ standing: import("../unlock/standingClient.js").StandingUnlockClient;
100
+ ladderSeed: Uint8Array<ArrayBufferLike>;
101
+ bridge: IZcap;
102
+ sibling: IZcap;
103
+ }>;
104
+ /**
105
+ * Issues one recovery code, acting as the account's credential in a
106
+ * transient session: the issuance's ladder branch. The code's bridge is
107
+ * signed by the code's own ladder VM and binds in memory; then the code's
108
+ * `keyAgreement` key publishes, its wrap is escrowed into the roster, and the
109
+ * authority half (its ladder VM and rung-0 commitment) publishes last. The
110
+ * code is not spent.
111
+ *
112
+ * @param options {object}
113
+ * @param options.account {EstablishedAccount}
114
+ * @returns {Promise<object>} `{ code, client, recoveryKid, bridge }`
115
+ */
116
+ export declare function issueRecoveryCode({ account }: {
117
+ account: EstablishedAccount;
118
+ }): Promise<{
119
+ code: string;
120
+ client: import("../recovery/recoveryCode.js").RecoveryClient;
121
+ recoveryKid: string;
122
+ bridge: IZcap;
123
+ }>;
124
+ /**
125
+ * Self-enrolls one enrolled client with the account's credential
126
+ * (`selfEnrollClientCore`), writing the account log through the record's
127
+ * bridge. The `onCommitted` seam is an in-memory no-op: a wallet persists
128
+ * the pending client-key record there, and here the seeds the core hands
129
+ * back are returned to the caller, which is this fixture's persist. A torn
130
+ * run is not this fixture's subject.
131
+ *
132
+ * @param options {object}
133
+ * @param options.account {EstablishedAccount}
134
+ * @returns {Promise<object>} the new client's seed, agents, signing key
135
+ * multibase, did:webvh update keys, did:key, the user key it read, and a
136
+ * zcap client signing as `<accountDid>#<signing key>`
137
+ */
138
+ export declare function enrollClient({ account }: {
139
+ account: EstablishedAccount;
140
+ }): Promise<{
141
+ clientSeed: Uint8Array<ArrayBufferLike>;
142
+ agents: import("@interop/was-client/identity").ProfileAgents;
143
+ signingKeyMultibase: string;
144
+ webvhUpdateKeys: import("../webvh/didWebvh.js").ClientWebvhUpdateKeys;
145
+ clientDid: string;
146
+ userKey: import("../keys/userKey.js").UserKey;
147
+ zcapClient: ZcapClient;
148
+ }>;
149
+ /**
150
+ * The passphrase shape plus a second standing credential.
151
+ *
152
+ * @param options {object}
153
+ * @param options.serverUrl {string}
154
+ * @param [options.passphrase] {string} a unique one by default
155
+ * @returns {Promise<object>} the passphrase account plus `second`
156
+ */
157
+ export declare function buildSecondCredentialAccount({ serverUrl, passphrase }: {
158
+ serverUrl: string;
159
+ passphrase?: string;
160
+ }): Promise<{
161
+ second: {
162
+ passphrase: string;
163
+ standing: import("../unlock/standingClient.js").StandingUnlockClient;
164
+ ladderSeed: Uint8Array<ArrayBufferLike>;
165
+ bridge: IZcap;
166
+ sibling: IZcap;
167
+ };
168
+ serverUrl: string;
169
+ spaceId: string;
170
+ accountDid: string;
171
+ annexSpaceId: string;
172
+ ladderSeed: Uint8Array<ArrayBufferLike>;
173
+ standing: import("../unlock/standingClient.js").StandingUnlockClient;
174
+ bridge: IZcap;
175
+ sibling: IZcap;
176
+ passphrase: string;
177
+ }>;
178
+ /**
179
+ * The passphrase shape plus one issued, unspent recovery code.
180
+ *
181
+ * @param options {object}
182
+ * @param options.serverUrl {string}
183
+ * @param [options.passphrase] {string} a unique one by default
184
+ * @returns {Promise<object>} the passphrase account plus `recovery`
185
+ */
186
+ export declare function buildRecoveryCodeAccount({ serverUrl, passphrase }: {
187
+ serverUrl: string;
188
+ passphrase?: string;
189
+ }): Promise<{
190
+ recovery: {
191
+ code: string;
192
+ client: import("../recovery/recoveryCode.js").RecoveryClient;
193
+ recoveryKid: string;
194
+ bridge: IZcap;
195
+ };
196
+ serverUrl: string;
197
+ spaceId: string;
198
+ accountDid: string;
199
+ annexSpaceId: string;
200
+ ladderSeed: Uint8Array<ArrayBufferLike>;
201
+ standing: import("../unlock/standingClient.js").StandingUnlockClient;
202
+ bridge: IZcap;
203
+ sibling: IZcap;
204
+ passphrase: string;
205
+ }>;
206
+ /**
207
+ * The passphrase shape plus one enrolled client.
208
+ *
209
+ * @param options {object}
210
+ * @param options.serverUrl {string}
211
+ * @param [options.passphrase] {string} a unique one by default
212
+ * @returns {Promise<object>} the passphrase account plus `client`
213
+ */
214
+ export declare function buildEnrolledClientAccount({ serverUrl, passphrase }: {
215
+ serverUrl: string;
216
+ passphrase?: string;
217
+ }): Promise<{
218
+ client: {
219
+ clientSeed: Uint8Array<ArrayBufferLike>;
220
+ agents: import("@interop/was-client/identity").ProfileAgents;
221
+ signingKeyMultibase: string;
222
+ webvhUpdateKeys: import("../webvh/didWebvh.js").ClientWebvhUpdateKeys;
223
+ clientDid: string;
224
+ userKey: import("../keys/userKey.js").UserKey;
225
+ zcapClient: ZcapClient;
226
+ };
227
+ serverUrl: string;
228
+ spaceId: string;
229
+ accountDid: string;
230
+ annexSpaceId: string;
231
+ ladderSeed: Uint8Array<ArrayBufferLike>;
232
+ standing: import("../unlock/standingClient.js").StandingUnlockClient;
233
+ bridge: IZcap;
234
+ sibling: IZcap;
235
+ passphrase: string;
236
+ }>;
237
+ //# sourceMappingURL=accountBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accountBuilder.d.ts","sourceRoot":"","sources":["../../src/testing/accountBuilder.ts"],"names":[],"mappings":"AAkDA,OAAO,KAAK,EAAoB,KAAK,EAAE,MAAM,8BAA8B,CAAA;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AA6DhD;;;;;;;;;;;;GAYG;AACH,wBAAsB,cAAc,CAAC,EACnC,UAAU,EACX,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO;;;;;;GAc9B;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAA;AAE1E;;;;;;;;;;;;;GAaG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,SAAS,EACT,UAAU,EACX,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,iBAAiB,CAAA;CAC/B;;;;;;;;;GA0EA;AAED,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAA;AAE7E;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAAC,EAC3C,SAAS,EACT,UAA+B,EAChC,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,GA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