@oxy.so/contracts 1.2.0 → 1.3.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 (53) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/identity.js +3 -2
  3. package/dist/cjs/identityMove.js +111 -40
  4. package/dist/cjs/identityProof.js +164 -0
  5. package/dist/cjs/identityRecovery.js +51 -0
  6. package/dist/cjs/index.js +50 -21
  7. package/dist/cjs/inference/identifiers.js +3 -1
  8. package/dist/cjs/inference/providerConnection.js +1 -1
  9. package/dist/cjs/inference/request.js +15 -1
  10. package/dist/cjs/inference/streamEvents.js +24 -2
  11. package/dist/cjs/username.js +70 -2
  12. package/dist/cjs/webIdentityCarrier.js +112 -53
  13. package/dist/cjs/webauthn.js +14 -0
  14. package/dist/esm/.tsbuildinfo +1 -1
  15. package/dist/esm/identity.js +3 -2
  16. package/dist/esm/identityMove.js +105 -39
  17. package/dist/esm/identityProof.js +159 -0
  18. package/dist/esm/identityRecovery.js +48 -0
  19. package/dist/esm/index.js +11 -8
  20. package/dist/esm/inference/identifiers.js +2 -0
  21. package/dist/esm/inference/providerConnection.js +2 -2
  22. package/dist/esm/inference/request.js +14 -0
  23. package/dist/esm/inference/streamEvents.js +24 -2
  24. package/dist/esm/username.js +69 -1
  25. package/dist/esm/webIdentityCarrier.js +111 -52
  26. package/dist/esm/webauthn.js +14 -0
  27. package/dist/types/.tsbuildinfo +1 -1
  28. package/dist/types/accountGraph.d.ts +7 -7
  29. package/dist/types/agency.d.ts +24 -24
  30. package/dist/types/browserHub.d.ts +16 -16
  31. package/dist/types/deviceDirectory.d.ts +28 -28
  32. package/dist/types/externalIdentity.d.ts +7 -7
  33. package/dist/types/identity.d.ts +3 -2
  34. package/dist/types/identityMove.d.ts +119 -43
  35. package/dist/types/identityProof.d.ts +156 -0
  36. package/dist/types/identityRecovery.d.ts +246 -0
  37. package/dist/types/index.d.ts +13 -11
  38. package/dist/types/inference/identifiers.d.ts +2 -0
  39. package/dist/types/inference/providerConnection.d.ts +40 -40
  40. package/dist/types/inference/request.d.ts +84 -36
  41. package/dist/types/inference/streamEvents.d.ts +57 -1
  42. package/dist/types/keyRotation.d.ts +2 -2
  43. package/dist/types/oauth.d.ts +30 -30
  44. package/dist/types/sessionStatus.d.ts +6 -6
  45. package/dist/types/transparency.d.ts +10 -10
  46. package/dist/types/userResponse.d.ts +18 -18
  47. package/dist/types/username.d.ts +25 -2
  48. package/dist/types/webIdentityCarrier.d.ts +767 -159
  49. package/dist/types/webauthn.d.ts +208 -0
  50. package/package.json +1 -1
  51. package/dist/cjs/devicePairing.js +0 -138
  52. package/dist/esm/devicePairing.js +0 -135
  53. package/dist/types/devicePairing.d.ts +0 -130
@@ -1,30 +1,32 @@
1
1
  /**
2
- * Web identity carrier contract — "one identity, two carriers".
2
+ * Web identity holder contract — the sealed envelope that lets a browser hold an
3
+ * account's self-custody root without Oxy ever being able to use it (ADR 0024).
3
4
  *
4
- * SINGLE SOURCE OF TRUTH for the sealed envelope that lets a browser carry an
5
- * account's self-custody identity without Oxy ever holding it
6
- * (`docs/superpowers/specs/2026-09-15-one-identity-two-carriers-design.md`).
5
+ * A root is a BIP-39 phrase (12–24 words) whose seed's first 32 bytes are the
6
+ * secp256k1 key — exactly the Commons derivation — or, for a few imported
7
+ * identities, a raw private key that never had a phrase. On the web it travels as:
7
8
  *
8
- * The identity is a BIP-39 mnemonic whose seed's first 32 bytes are the
9
- * secp256k1 key — exactly the Commons derivation — so a web identity and a
10
- * Commons identity are the same thing. On the web it travels as:
11
- *
12
- * entropy (16 bytes) ── XChaCha20-Poly1305 under a random DEK ──▶ sealedEntropy
13
- * DEK ── XChaCha20-Poly1305 under KEK_i ──▶ wraps[i]
9
+ * secret ── XChaCha20-Poly1305 under a random DEK ──▶ sealedSecret
10
+ * DEK ── XChaCha20-Poly1305 under KEK_i ──▶ wraps[i]
14
11
  * KEK_i = HKDF(PRF output of passkey i)
15
12
  *
16
13
  * The server stores the envelope and can open NONE of it: the PRF output never
17
- * leaves the user's authenticator, and the mnemonic is never uploaded. The AEAD
18
- * associated data binds every ciphertext to the identity's public key (and each
19
- * wrap to its credential), so a re-labelled or transplanted envelope fails to
20
- * open instead of decrypting into the wrong identity.
14
+ * leaves the user's authenticator, and the secret is never uploaded. The AEAD
15
+ * associated data binds the secret to the root's public key and kind, and each
16
+ * wrap to its credential and RP ID, so a re-labelled or transplanted envelope
17
+ * fails to open instead of decrypting into the wrong identity.
21
18
  *
22
- * Every hex field is lowercase-or-uppercase hex. Platform-agnostic — zod only,
23
- * ESM-safe (no `require()`).
19
+ * Platform-agnostic — zod only, ESM-safe (no `require()`).
24
20
  */
25
21
  import { z } from 'zod';
26
- /** The only envelope version. A scheme change is a new literal, never a mutation. */
27
- export declare const WEB_IDENTITY_ENVELOPE_VERSION: 1;
22
+ /** The envelope scheme. A scheme change is a new literal, never a mutation. */
23
+ export declare const WEB_IDENTITY_ENVELOPE_VERSION: 2;
24
+ /**
25
+ * What an envelope seals. A raw-key identity stays a raw-key identity:
26
+ * nothing ever derives or displays a phrase for it.
27
+ */
28
+ export declare const WEB_IDENTITY_SECRET_KINDS: readonly ["mnemonic-entropy", "raw-private-key"];
29
+ export type WebIdentitySecretKind = (typeof WEB_IDENTITY_SECRET_KINDS)[number];
28
30
  /**
29
31
  * The identity's secp256k1 public key in Oxy's canonical form: uncompressed SEC1
30
32
  * (`04` + 64 bytes), lowercase hex — what `KeyManager.derivePublicKey` produces
@@ -33,6 +35,8 @@ export declare const WEB_IDENTITY_ENVELOPE_VERSION: 1;
33
35
  export declare const webIdentityPublicKeySchema: z.ZodString;
34
36
  /** A WebAuthn credential id, base64url as the browser reports it. */
35
37
  export declare const webauthnCredentialIdSchema: z.ZodString;
38
+ /** A WebAuthn RP ID: a bare registrable host name, lowercase. */
39
+ export declare const webauthnRpIdSchema: z.ZodString;
36
40
  /** One passkey's wrap of the envelope's data key. */
37
41
  export declare const webIdentityWrapSchema: z.ZodObject<{
38
42
  credentialId: z.ZodString;
@@ -41,16 +45,27 @@ export declare const webIdentityWrapSchema: z.ZodObject<{
41
45
  /** The 32-byte DEK sealed under this passkey's KEK, with the 16-byte tag appended (48 bytes). */
42
46
  wrappedKey: z.ZodString;
43
47
  createdAt: z.ZodString;
48
+ /** The RP ID the passkey was created under, asserted explicitly by every later ceremony (ADR 0024 D2). */
49
+ rpId: z.ZodString;
50
+ /**
51
+ * When this passkey's PRF output was shown to open the envelope. A wrap is a
52
+ * root HOLDER only once this is set; a login passkey never is by default.
53
+ */
54
+ verifiedAt: z.ZodOptional<z.ZodString>;
44
55
  }, "strip", z.ZodTypeAny, {
45
56
  credentialId: string;
46
57
  createdAt: string;
47
58
  nonce: string;
48
59
  wrappedKey: string;
60
+ rpId: string;
61
+ verifiedAt?: string | undefined;
49
62
  }, {
50
63
  credentialId: string;
51
64
  createdAt: string;
52
65
  nonce: string;
53
66
  wrappedKey: string;
67
+ rpId: string;
68
+ verifiedAt?: string | undefined;
54
69
  }>;
55
70
  /**
56
71
  * The sealed identity as it is stored (server copy and local copy alike).
@@ -58,14 +73,18 @@ export declare const webIdentityWrapSchema: z.ZodObject<{
58
73
  * `wraps` holds one entry per passkey able to open it; at least one, and a
59
74
  * bounded number so an envelope cannot grow without limit.
60
75
  */
61
- export declare const webIdentityEnvelopeSchema: z.ZodObject<{
62
- version: z.ZodLiteral<1>;
76
+ export declare const webIdentityEnvelopeSchema: z.ZodEffects<z.ZodObject<{
77
+ version: z.ZodLiteral<2>;
63
78
  algorithm: z.ZodLiteral<"xchacha20poly1305">;
64
79
  publicKey: z.ZodString;
65
- /** 24-byte nonce of the entropy seal. */
66
- entropyNonce: z.ZodString;
67
- /** The 16-byte BIP-39 entropy sealed under the DEK, tag appended (32 bytes). */
68
- sealedEntropy: z.ZodString;
80
+ secretKind: z.ZodEnum<["mnemonic-entropy", "raw-private-key"]>;
81
+ /** 24-byte nonce of the secret seal. */
82
+ secretNonce: z.ZodString;
83
+ /**
84
+ * The sealed secret, tag appended: 16/20/24/28/32 bytes of BIP-39 entropy
85
+ * (12–24 words) or a 32-byte private key, plus 16.
86
+ */
87
+ sealedSecret: z.ZodString;
69
88
  wraps: z.ZodArray<z.ZodObject<{
70
89
  credentialId: z.ZodString;
71
90
  /** 24-byte XChaCha20-Poly1305 nonce. */
@@ -73,40 +92,87 @@ export declare const webIdentityEnvelopeSchema: z.ZodObject<{
73
92
  /** The 32-byte DEK sealed under this passkey's KEK, with the 16-byte tag appended (48 bytes). */
74
93
  wrappedKey: z.ZodString;
75
94
  createdAt: z.ZodString;
95
+ /** The RP ID the passkey was created under, asserted explicitly by every later ceremony (ADR 0024 D2). */
96
+ rpId: z.ZodString;
97
+ /**
98
+ * When this passkey's PRF output was shown to open the envelope. A wrap is a
99
+ * root HOLDER only once this is set; a login passkey never is by default.
100
+ */
101
+ verifiedAt: z.ZodOptional<z.ZodString>;
76
102
  }, "strip", z.ZodTypeAny, {
77
103
  credentialId: string;
78
104
  createdAt: string;
79
105
  nonce: string;
80
106
  wrappedKey: string;
107
+ rpId: string;
108
+ verifiedAt?: string | undefined;
81
109
  }, {
82
110
  credentialId: string;
83
111
  createdAt: string;
84
112
  nonce: string;
85
113
  wrappedKey: string;
114
+ rpId: string;
115
+ verifiedAt?: string | undefined;
86
116
  }>, "many">;
87
117
  }, "strip", z.ZodTypeAny, {
88
- version: 1;
118
+ version: 2;
89
119
  publicKey: string;
90
120
  algorithm: "xchacha20poly1305";
91
- entropyNonce: string;
92
- sealedEntropy: string;
121
+ secretKind: "mnemonic-entropy" | "raw-private-key";
122
+ secretNonce: string;
123
+ sealedSecret: string;
93
124
  wraps: {
94
125
  credentialId: string;
95
126
  createdAt: string;
96
127
  nonce: string;
97
128
  wrappedKey: string;
129
+ rpId: string;
130
+ verifiedAt?: string | undefined;
98
131
  }[];
99
132
  }, {
100
- version: 1;
133
+ version: 2;
101
134
  publicKey: string;
102
135
  algorithm: "xchacha20poly1305";
103
- entropyNonce: string;
104
- sealedEntropy: string;
136
+ secretKind: "mnemonic-entropy" | "raw-private-key";
137
+ secretNonce: string;
138
+ sealedSecret: string;
105
139
  wraps: {
106
140
  credentialId: string;
107
141
  createdAt: string;
108
142
  nonce: string;
109
143
  wrappedKey: string;
144
+ rpId: string;
145
+ verifiedAt?: string | undefined;
146
+ }[];
147
+ }>, {
148
+ version: 2;
149
+ publicKey: string;
150
+ algorithm: "xchacha20poly1305";
151
+ secretKind: "mnemonic-entropy" | "raw-private-key";
152
+ secretNonce: string;
153
+ sealedSecret: string;
154
+ wraps: {
155
+ credentialId: string;
156
+ createdAt: string;
157
+ nonce: string;
158
+ wrappedKey: string;
159
+ rpId: string;
160
+ verifiedAt?: string | undefined;
161
+ }[];
162
+ }, {
163
+ version: 2;
164
+ publicKey: string;
165
+ algorithm: "xchacha20poly1305";
166
+ secretKind: "mnemonic-entropy" | "raw-private-key";
167
+ secretNonce: string;
168
+ sealedSecret: string;
169
+ wraps: {
170
+ credentialId: string;
171
+ createdAt: string;
172
+ nonce: string;
173
+ wrappedKey: string;
174
+ rpId: string;
175
+ verifiedAt?: string | undefined;
110
176
  }[];
111
177
  }>;
112
178
  /**
@@ -116,14 +182,18 @@ export declare const webIdentityEnvelopeSchema: z.ZodObject<{
116
182
  * account: an envelope can only ever carry the account's own identity.
117
183
  */
118
184
  export declare const webIdentityEnvelopeUploadSchema: z.ZodObject<{
119
- envelope: z.ZodObject<{
120
- version: z.ZodLiteral<1>;
185
+ envelope: z.ZodEffects<z.ZodObject<{
186
+ version: z.ZodLiteral<2>;
121
187
  algorithm: z.ZodLiteral<"xchacha20poly1305">;
122
188
  publicKey: z.ZodString;
123
- /** 24-byte nonce of the entropy seal. */
124
- entropyNonce: z.ZodString;
125
- /** The 16-byte BIP-39 entropy sealed under the DEK, tag appended (32 bytes). */
126
- sealedEntropy: z.ZodString;
189
+ secretKind: z.ZodEnum<["mnemonic-entropy", "raw-private-key"]>;
190
+ /** 24-byte nonce of the secret seal. */
191
+ secretNonce: z.ZodString;
192
+ /**
193
+ * The sealed secret, tag appended: 16/20/24/28/32 bytes of BIP-39 entropy
194
+ * (12–24 words) or a 32-byte private key, plus 16.
195
+ */
196
+ sealedSecret: z.ZodString;
127
197
  wraps: z.ZodArray<z.ZodObject<{
128
198
  credentialId: z.ZodString;
129
199
  /** 24-byte XChaCha20-Poly1305 nonce. */
@@ -131,81 +201,159 @@ export declare const webIdentityEnvelopeUploadSchema: z.ZodObject<{
131
201
  /** The 32-byte DEK sealed under this passkey's KEK, with the 16-byte tag appended (48 bytes). */
132
202
  wrappedKey: z.ZodString;
133
203
  createdAt: z.ZodString;
204
+ /** The RP ID the passkey was created under, asserted explicitly by every later ceremony (ADR 0024 D2). */
205
+ rpId: z.ZodString;
206
+ /**
207
+ * When this passkey's PRF output was shown to open the envelope. A wrap is a
208
+ * root HOLDER only once this is set; a login passkey never is by default.
209
+ */
210
+ verifiedAt: z.ZodOptional<z.ZodString>;
134
211
  }, "strip", z.ZodTypeAny, {
135
212
  credentialId: string;
136
213
  createdAt: string;
137
214
  nonce: string;
138
215
  wrappedKey: string;
216
+ rpId: string;
217
+ verifiedAt?: string | undefined;
139
218
  }, {
140
219
  credentialId: string;
141
220
  createdAt: string;
142
221
  nonce: string;
143
222
  wrappedKey: string;
223
+ rpId: string;
224
+ verifiedAt?: string | undefined;
144
225
  }>, "many">;
145
226
  }, "strip", z.ZodTypeAny, {
146
- version: 1;
227
+ version: 2;
228
+ publicKey: string;
229
+ algorithm: "xchacha20poly1305";
230
+ secretKind: "mnemonic-entropy" | "raw-private-key";
231
+ secretNonce: string;
232
+ sealedSecret: string;
233
+ wraps: {
234
+ credentialId: string;
235
+ createdAt: string;
236
+ nonce: string;
237
+ wrappedKey: string;
238
+ rpId: string;
239
+ verifiedAt?: string | undefined;
240
+ }[];
241
+ }, {
242
+ version: 2;
243
+ publicKey: string;
244
+ algorithm: "xchacha20poly1305";
245
+ secretKind: "mnemonic-entropy" | "raw-private-key";
246
+ secretNonce: string;
247
+ sealedSecret: string;
248
+ wraps: {
249
+ credentialId: string;
250
+ createdAt: string;
251
+ nonce: string;
252
+ wrappedKey: string;
253
+ rpId: string;
254
+ verifiedAt?: string | undefined;
255
+ }[];
256
+ }>, {
257
+ version: 2;
147
258
  publicKey: string;
148
259
  algorithm: "xchacha20poly1305";
149
- entropyNonce: string;
150
- sealedEntropy: string;
260
+ secretKind: "mnemonic-entropy" | "raw-private-key";
261
+ secretNonce: string;
262
+ sealedSecret: string;
151
263
  wraps: {
152
264
  credentialId: string;
153
265
  createdAt: string;
154
266
  nonce: string;
155
267
  wrappedKey: string;
268
+ rpId: string;
269
+ verifiedAt?: string | undefined;
156
270
  }[];
157
271
  }, {
158
- version: 1;
272
+ version: 2;
159
273
  publicKey: string;
160
274
  algorithm: "xchacha20poly1305";
161
- entropyNonce: string;
162
- sealedEntropy: string;
275
+ secretKind: "mnemonic-entropy" | "raw-private-key";
276
+ secretNonce: string;
277
+ sealedSecret: string;
163
278
  wraps: {
164
279
  credentialId: string;
165
280
  createdAt: string;
166
281
  nonce: string;
167
282
  wrappedKey: string;
283
+ rpId: string;
284
+ verifiedAt?: string | undefined;
168
285
  }[];
169
286
  }>;
170
287
  }, "strip", z.ZodTypeAny, {
171
288
  envelope: {
172
- version: 1;
289
+ version: 2;
173
290
  publicKey: string;
174
291
  algorithm: "xchacha20poly1305";
175
- entropyNonce: string;
176
- sealedEntropy: string;
292
+ secretKind: "mnemonic-entropy" | "raw-private-key";
293
+ secretNonce: string;
294
+ sealedSecret: string;
177
295
  wraps: {
178
296
  credentialId: string;
179
297
  createdAt: string;
180
298
  nonce: string;
181
299
  wrappedKey: string;
300
+ rpId: string;
301
+ verifiedAt?: string | undefined;
182
302
  }[];
183
303
  };
184
304
  }, {
185
305
  envelope: {
186
- version: 1;
306
+ version: 2;
187
307
  publicKey: string;
188
308
  algorithm: "xchacha20poly1305";
189
- entropyNonce: string;
190
- sealedEntropy: string;
309
+ secretKind: "mnemonic-entropy" | "raw-private-key";
310
+ secretNonce: string;
311
+ sealedSecret: string;
191
312
  wraps: {
192
313
  credentialId: string;
193
314
  createdAt: string;
194
315
  nonce: string;
195
316
  wrappedKey: string;
317
+ rpId: string;
318
+ verifiedAt?: string | undefined;
196
319
  }[];
197
320
  };
198
321
  }>;
199
- /** `GET /identity/web-envelope` — the caller's envelope and its recovery-phrase state. */
322
+ /** A root holder as the status read reports it — metadata only, nothing that opens anything. */
323
+ export declare const webIdentityHolderSchema: z.ZodObject<{
324
+ credentialId: z.ZodString;
325
+ rpId: z.ZodString;
326
+ verifiedAt: z.ZodNullable<z.ZodString>;
327
+ createdAt: z.ZodString;
328
+ }, "strip", z.ZodTypeAny, {
329
+ credentialId: string;
330
+ createdAt: string;
331
+ verifiedAt: string | null;
332
+ rpId: string;
333
+ }, {
334
+ credentialId: string;
335
+ createdAt: string;
336
+ verifiedAt: string | null;
337
+ rpId: string;
338
+ }>;
339
+ /**
340
+ * `GET /identity/web-envelope` — the caller's envelope and the readiness facts
341
+ * ADR 0024 D5 keeps separate. A client decides what to show from these fields
342
+ * WITHOUT decrypting anything.
343
+ */
200
344
  export declare const webIdentityEnvelopeResponseSchema: z.ZodObject<{
201
- envelope: z.ZodNullable<z.ZodObject<{
202
- version: z.ZodLiteral<1>;
345
+ envelope: z.ZodNullable<z.ZodEffects<z.ZodObject<{
346
+ version: z.ZodLiteral<2>;
203
347
  algorithm: z.ZodLiteral<"xchacha20poly1305">;
204
348
  publicKey: z.ZodString;
205
- /** 24-byte nonce of the entropy seal. */
206
- entropyNonce: z.ZodString;
207
- /** The 16-byte BIP-39 entropy sealed under the DEK, tag appended (32 bytes). */
208
- sealedEntropy: z.ZodString;
349
+ secretKind: z.ZodEnum<["mnemonic-entropy", "raw-private-key"]>;
350
+ /** 24-byte nonce of the secret seal. */
351
+ secretNonce: z.ZodString;
352
+ /**
353
+ * The sealed secret, tag appended: 16/20/24/28/32 bytes of BIP-39 entropy
354
+ * (12–24 words) or a 32-byte private key, plus 16.
355
+ */
356
+ sealedSecret: z.ZodString;
209
357
  wraps: z.ZodArray<z.ZodObject<{
210
358
  credentialId: z.ZodString;
211
359
  /** 24-byte XChaCha20-Poly1305 nonce. */
@@ -213,111 +361,261 @@ export declare const webIdentityEnvelopeResponseSchema: z.ZodObject<{
213
361
  /** The 32-byte DEK sealed under this passkey's KEK, with the 16-byte tag appended (48 bytes). */
214
362
  wrappedKey: z.ZodString;
215
363
  createdAt: z.ZodString;
364
+ /** The RP ID the passkey was created under, asserted explicitly by every later ceremony (ADR 0024 D2). */
365
+ rpId: z.ZodString;
366
+ /**
367
+ * When this passkey's PRF output was shown to open the envelope. A wrap is a
368
+ * root HOLDER only once this is set; a login passkey never is by default.
369
+ */
370
+ verifiedAt: z.ZodOptional<z.ZodString>;
216
371
  }, "strip", z.ZodTypeAny, {
217
372
  credentialId: string;
218
373
  createdAt: string;
219
374
  nonce: string;
220
375
  wrappedKey: string;
376
+ rpId: string;
377
+ verifiedAt?: string | undefined;
221
378
  }, {
222
379
  credentialId: string;
223
380
  createdAt: string;
224
381
  nonce: string;
225
382
  wrappedKey: string;
383
+ rpId: string;
384
+ verifiedAt?: string | undefined;
226
385
  }>, "many">;
227
386
  }, "strip", z.ZodTypeAny, {
228
- version: 1;
387
+ version: 2;
229
388
  publicKey: string;
230
389
  algorithm: "xchacha20poly1305";
231
- entropyNonce: string;
232
- sealedEntropy: string;
390
+ secretKind: "mnemonic-entropy" | "raw-private-key";
391
+ secretNonce: string;
392
+ sealedSecret: string;
233
393
  wraps: {
234
394
  credentialId: string;
235
395
  createdAt: string;
236
396
  nonce: string;
237
397
  wrappedKey: string;
398
+ rpId: string;
399
+ verifiedAt?: string | undefined;
238
400
  }[];
239
401
  }, {
240
- version: 1;
402
+ version: 2;
241
403
  publicKey: string;
242
404
  algorithm: "xchacha20poly1305";
243
- entropyNonce: string;
244
- sealedEntropy: string;
405
+ secretKind: "mnemonic-entropy" | "raw-private-key";
406
+ secretNonce: string;
407
+ sealedSecret: string;
245
408
  wraps: {
246
409
  credentialId: string;
247
410
  createdAt: string;
248
411
  nonce: string;
249
412
  wrappedKey: string;
413
+ rpId: string;
414
+ verifiedAt?: string | undefined;
415
+ }[];
416
+ }>, {
417
+ version: 2;
418
+ publicKey: string;
419
+ algorithm: "xchacha20poly1305";
420
+ secretKind: "mnemonic-entropy" | "raw-private-key";
421
+ secretNonce: string;
422
+ sealedSecret: string;
423
+ wraps: {
424
+ credentialId: string;
425
+ createdAt: string;
426
+ nonce: string;
427
+ wrappedKey: string;
428
+ rpId: string;
429
+ verifiedAt?: string | undefined;
430
+ }[];
431
+ }, {
432
+ version: 2;
433
+ publicKey: string;
434
+ algorithm: "xchacha20poly1305";
435
+ secretKind: "mnemonic-entropy" | "raw-private-key";
436
+ secretNonce: string;
437
+ sealedSecret: string;
438
+ wraps: {
439
+ credentialId: string;
440
+ createdAt: string;
441
+ nonce: string;
442
+ wrappedKey: string;
443
+ rpId: string;
444
+ verifiedAt?: string | undefined;
250
445
  }[];
251
446
  }>>;
252
- /**
253
- * When the owner confirmed they wrote the recovery phrase down, or `null`.
254
- * Until then the identity must not be unlocked on a second device, nor used
255
- * for any operation that needs the key (design decision D2).
256
- */
447
+ /** The revision a write must name as `expectedRevision`; `0` when there is no envelope. */
448
+ revision: z.ZodNumber;
449
+ /** Whether the account has a linked root at all (it may live only in Commons). */
450
+ rootLinked: z.ZodBoolean;
451
+ /** The web wraps, as metadata. */
452
+ holders: z.ZodArray<z.ZodObject<{
453
+ credentialId: z.ZodString;
454
+ rpId: z.ZodString;
455
+ verifiedAt: z.ZodNullable<z.ZodString>;
456
+ createdAt: z.ZodString;
457
+ }, "strip", z.ZodTypeAny, {
458
+ credentialId: string;
459
+ createdAt: string;
460
+ verifiedAt: string | null;
461
+ rpId: string;
462
+ }, {
463
+ credentialId: string;
464
+ createdAt: string;
465
+ verifiedAt: string | null;
466
+ rpId: string;
467
+ }>, "many">;
468
+ /** When the owner confirmed the recovery material is written down, or `null`. */
257
469
  phraseConfirmedAt: z.ZodNullable<z.ZodString>;
470
+ /** When the recovery material was shown to re-derive this root, or `null`. */
471
+ recoveryVerifiedAt: z.ZodNullable<z.ZodString>;
258
472
  updatedAt: z.ZodNullable<z.ZodString>;
259
473
  }, "strip", z.ZodTypeAny, {
260
474
  updatedAt: string | null;
475
+ revision: number;
476
+ rootLinked: boolean;
477
+ phraseConfirmedAt: string | null;
478
+ recoveryVerifiedAt: string | null;
261
479
  envelope: {
262
- version: 1;
480
+ version: 2;
263
481
  publicKey: string;
264
482
  algorithm: "xchacha20poly1305";
265
- entropyNonce: string;
266
- sealedEntropy: string;
483
+ secretKind: "mnemonic-entropy" | "raw-private-key";
484
+ secretNonce: string;
485
+ sealedSecret: string;
267
486
  wraps: {
268
487
  credentialId: string;
269
488
  createdAt: string;
270
489
  nonce: string;
271
490
  wrappedKey: string;
491
+ rpId: string;
492
+ verifiedAt?: string | undefined;
272
493
  }[];
273
494
  } | null;
274
- phraseConfirmedAt: string | null;
495
+ holders: {
496
+ credentialId: string;
497
+ createdAt: string;
498
+ verifiedAt: string | null;
499
+ rpId: string;
500
+ }[];
275
501
  }, {
276
502
  updatedAt: string | null;
503
+ revision: number;
504
+ rootLinked: boolean;
505
+ phraseConfirmedAt: string | null;
506
+ recoveryVerifiedAt: string | null;
277
507
  envelope: {
278
- version: 1;
508
+ version: 2;
279
509
  publicKey: string;
280
510
  algorithm: "xchacha20poly1305";
281
- entropyNonce: string;
282
- sealedEntropy: string;
511
+ secretKind: "mnemonic-entropy" | "raw-private-key";
512
+ secretNonce: string;
513
+ sealedSecret: string;
283
514
  wraps: {
284
515
  credentialId: string;
285
516
  createdAt: string;
286
517
  nonce: string;
287
518
  wrappedKey: string;
519
+ rpId: string;
520
+ verifiedAt?: string | undefined;
288
521
  }[];
289
522
  } | null;
290
- phraseConfirmedAt: string | null;
523
+ holders: {
524
+ credentialId: string;
525
+ createdAt: string;
526
+ verifiedAt: string | null;
527
+ rpId: string;
528
+ }[];
529
+ }>;
530
+ /** A root proof, plus the envelope revision the write expects to replace. */
531
+ export declare const webIdentityEnvelopeProofFieldsSchema: z.ZodObject<{
532
+ proof: z.ZodObject<{
533
+ v: z.ZodLiteral<2>;
534
+ challenge: z.ZodString;
535
+ expiresAt: z.ZodNumber;
536
+ signature: z.ZodString;
537
+ }, "strip", z.ZodTypeAny, {
538
+ expiresAt: number;
539
+ signature: string;
540
+ v: 2;
541
+ challenge: string;
542
+ }, {
543
+ expiresAt: number;
544
+ signature: string;
545
+ v: 2;
546
+ challenge: string;
547
+ }>;
548
+ expectedRevision: z.ZodNumber;
549
+ }, "strip", z.ZodTypeAny, {
550
+ proof: {
551
+ expiresAt: number;
552
+ signature: string;
553
+ v: 2;
554
+ challenge: string;
555
+ };
556
+ expectedRevision: number;
557
+ }, {
558
+ proof: {
559
+ expiresAt: number;
560
+ signature: string;
561
+ v: 2;
562
+ challenge: string;
563
+ };
564
+ expectedRevision: number;
291
565
  }>;
292
566
  /**
293
- * `POST /identity/web-envelope/phrase-confirmed` and
294
- * `DELETE /identity/web-envelope` both prove control of the identity key, not
295
- * just a bearer: a stolen session must not be able to mark a phrase as saved or
296
- * destroy the web copy of someone's identity.
297
- *
298
- * The signed message is `JSON.stringify({ action, userId, timestamp })` — the
299
- * same scheme as `link_identity`.
567
+ * `POST /identity/web-envelope/phrase-confirmed`, `/recovery-verified` and
568
+ * `DELETE /identity/web-envelope` prove control of the root, not just a bearer.
300
569
  */
301
- export declare const webIdentityEnvelopeProofSchema: z.ZodObject<{
302
- signature: z.ZodString;
303
- timestamp: z.ZodNumber;
304
- }, "strip", z.ZodTypeAny, {
305
- signature: string;
306
- timestamp: number;
570
+ export declare const webIdentityEnvelopeActionSchema: z.ZodObject<{
571
+ proof: z.ZodObject<{
572
+ v: z.ZodLiteral<2>;
573
+ challenge: z.ZodString;
574
+ expiresAt: z.ZodNumber;
575
+ signature: z.ZodString;
576
+ }, "strip", z.ZodTypeAny, {
577
+ expiresAt: number;
578
+ signature: string;
579
+ v: 2;
580
+ challenge: string;
581
+ }, {
582
+ expiresAt: number;
583
+ signature: string;
584
+ v: 2;
585
+ challenge: string;
586
+ }>;
587
+ expectedRevision: z.ZodNumber;
588
+ }, "strict", z.ZodTypeAny, {
589
+ proof: {
590
+ expiresAt: number;
591
+ signature: string;
592
+ v: 2;
593
+ challenge: string;
594
+ };
595
+ expectedRevision: number;
307
596
  }, {
308
- signature: string;
309
- timestamp: number;
597
+ proof: {
598
+ expiresAt: number;
599
+ signature: string;
600
+ v: 2;
601
+ challenge: string;
602
+ };
603
+ expectedRevision: number;
310
604
  }>;
311
- /** `PUT /identity/web-envelope` body: the envelope plus a `web_envelope_put` identity-key proof. */
605
+ /** `PUT /identity/web-envelope` body. */
312
606
  export declare const webIdentityEnvelopePutSchema: z.ZodObject<{
313
- envelope: z.ZodObject<{
314
- version: z.ZodLiteral<1>;
607
+ envelope: z.ZodEffects<z.ZodObject<{
608
+ version: z.ZodLiteral<2>;
315
609
  algorithm: z.ZodLiteral<"xchacha20poly1305">;
316
610
  publicKey: z.ZodString;
317
- /** 24-byte nonce of the entropy seal. */
318
- entropyNonce: z.ZodString;
319
- /** The 16-byte BIP-39 entropy sealed under the DEK, tag appended (32 bytes). */
320
- sealedEntropy: z.ZodString;
611
+ secretKind: z.ZodEnum<["mnemonic-entropy", "raw-private-key"]>;
612
+ /** 24-byte nonce of the secret seal. */
613
+ secretNonce: z.ZodString;
614
+ /**
615
+ * The sealed secret, tag appended: 16/20/24/28/32 bytes of BIP-39 entropy
616
+ * (12–24 words) or a 32-byte private key, plus 16.
617
+ */
618
+ sealedSecret: z.ZodString;
321
619
  wraps: z.ZodArray<z.ZodObject<{
322
620
  credentialId: z.ZodString;
323
621
  /** 24-byte XChaCha20-Poly1305 nonce. */
@@ -325,96 +623,247 @@ export declare const webIdentityEnvelopePutSchema: z.ZodObject<{
325
623
  /** The 32-byte DEK sealed under this passkey's KEK, with the 16-byte tag appended (48 bytes). */
326
624
  wrappedKey: z.ZodString;
327
625
  createdAt: z.ZodString;
626
+ /** The RP ID the passkey was created under, asserted explicitly by every later ceremony (ADR 0024 D2). */
627
+ rpId: z.ZodString;
628
+ /**
629
+ * When this passkey's PRF output was shown to open the envelope. A wrap is a
630
+ * root HOLDER only once this is set; a login passkey never is by default.
631
+ */
632
+ verifiedAt: z.ZodOptional<z.ZodString>;
328
633
  }, "strip", z.ZodTypeAny, {
329
634
  credentialId: string;
330
635
  createdAt: string;
331
636
  nonce: string;
332
637
  wrappedKey: string;
638
+ rpId: string;
639
+ verifiedAt?: string | undefined;
333
640
  }, {
334
641
  credentialId: string;
335
642
  createdAt: string;
336
643
  nonce: string;
337
644
  wrappedKey: string;
645
+ rpId: string;
646
+ verifiedAt?: string | undefined;
338
647
  }>, "many">;
339
648
  }, "strip", z.ZodTypeAny, {
340
- version: 1;
649
+ version: 2;
650
+ publicKey: string;
651
+ algorithm: "xchacha20poly1305";
652
+ secretKind: "mnemonic-entropy" | "raw-private-key";
653
+ secretNonce: string;
654
+ sealedSecret: string;
655
+ wraps: {
656
+ credentialId: string;
657
+ createdAt: string;
658
+ nonce: string;
659
+ wrappedKey: string;
660
+ rpId: string;
661
+ verifiedAt?: string | undefined;
662
+ }[];
663
+ }, {
664
+ version: 2;
341
665
  publicKey: string;
342
666
  algorithm: "xchacha20poly1305";
343
- entropyNonce: string;
344
- sealedEntropy: string;
667
+ secretKind: "mnemonic-entropy" | "raw-private-key";
668
+ secretNonce: string;
669
+ sealedSecret: string;
345
670
  wraps: {
346
671
  credentialId: string;
347
672
  createdAt: string;
348
673
  nonce: string;
349
674
  wrappedKey: string;
675
+ rpId: string;
676
+ verifiedAt?: string | undefined;
677
+ }[];
678
+ }>, {
679
+ version: 2;
680
+ publicKey: string;
681
+ algorithm: "xchacha20poly1305";
682
+ secretKind: "mnemonic-entropy" | "raw-private-key";
683
+ secretNonce: string;
684
+ sealedSecret: string;
685
+ wraps: {
686
+ credentialId: string;
687
+ createdAt: string;
688
+ nonce: string;
689
+ wrappedKey: string;
690
+ rpId: string;
691
+ verifiedAt?: string | undefined;
350
692
  }[];
351
693
  }, {
352
- version: 1;
694
+ version: 2;
353
695
  publicKey: string;
354
696
  algorithm: "xchacha20poly1305";
355
- entropyNonce: string;
356
- sealedEntropy: string;
697
+ secretKind: "mnemonic-entropy" | "raw-private-key";
698
+ secretNonce: string;
699
+ sealedSecret: string;
357
700
  wraps: {
358
701
  credentialId: string;
359
702
  createdAt: string;
360
703
  nonce: string;
361
704
  wrappedKey: string;
705
+ rpId: string;
706
+ verifiedAt?: string | undefined;
362
707
  }[];
363
708
  }>;
364
709
  } & {
365
- signature: z.ZodString;
366
- timestamp: z.ZodNumber;
367
- }, "strip", z.ZodTypeAny, {
368
- signature: string;
369
- timestamp: number;
710
+ proof: z.ZodObject<{
711
+ v: z.ZodLiteral<2>;
712
+ challenge: z.ZodString;
713
+ expiresAt: z.ZodNumber;
714
+ signature: z.ZodString;
715
+ }, "strip", z.ZodTypeAny, {
716
+ expiresAt: number;
717
+ signature: string;
718
+ v: 2;
719
+ challenge: string;
720
+ }, {
721
+ expiresAt: number;
722
+ signature: string;
723
+ v: 2;
724
+ challenge: string;
725
+ }>;
726
+ expectedRevision: z.ZodNumber;
727
+ }, "strict", z.ZodTypeAny, {
728
+ proof: {
729
+ expiresAt: number;
730
+ signature: string;
731
+ v: 2;
732
+ challenge: string;
733
+ };
370
734
  envelope: {
371
- version: 1;
735
+ version: 2;
372
736
  publicKey: string;
373
737
  algorithm: "xchacha20poly1305";
374
- entropyNonce: string;
375
- sealedEntropy: string;
738
+ secretKind: "mnemonic-entropy" | "raw-private-key";
739
+ secretNonce: string;
740
+ sealedSecret: string;
376
741
  wraps: {
377
742
  credentialId: string;
378
743
  createdAt: string;
379
744
  nonce: string;
380
745
  wrappedKey: string;
746
+ rpId: string;
747
+ verifiedAt?: string | undefined;
381
748
  }[];
382
749
  };
750
+ expectedRevision: number;
383
751
  }, {
384
- signature: string;
385
- timestamp: number;
752
+ proof: {
753
+ expiresAt: number;
754
+ signature: string;
755
+ v: 2;
756
+ challenge: string;
757
+ };
386
758
  envelope: {
387
- version: 1;
759
+ version: 2;
388
760
  publicKey: string;
389
761
  algorithm: "xchacha20poly1305";
390
- entropyNonce: string;
391
- sealedEntropy: string;
762
+ secretKind: "mnemonic-entropy" | "raw-private-key";
763
+ secretNonce: string;
764
+ sealedSecret: string;
392
765
  wraps: {
393
766
  credentialId: string;
394
767
  createdAt: string;
395
768
  nonce: string;
396
769
  wrappedKey: string;
770
+ rpId: string;
771
+ verifiedAt?: string | undefined;
397
772
  }[];
398
773
  };
774
+ expectedRevision: number;
399
775
  }>;
400
776
  /**
401
- * `POST /identity/web-envelope/establish` body — create an account's FIRST
402
- * identity on the web: link the key and store its envelope in ONE transaction.
403
- *
404
- * Linking and storing as two calls would let a failure (or a closed tab) in
405
- * between leave the account bound to a key that nothing carries — an identity
406
- * lost at birth. `link` is a `link_identity` proof and the outer proof a
407
- * `web_envelope_put` proof, both signed by the envelope's own key.
777
+ * A WebAuthn assertion by one of the account's EXISTING passkeys whose
778
+ * `clientDataJSON.challenge` is the proof challenge — the fresh use of the
779
+ * existing factor a keyless account needs before its first root is linked.
780
+ */
781
+ export declare const webauthnAssertionResponseSchema: z.ZodObject<{
782
+ id: z.ZodString;
783
+ rawId: z.ZodString;
784
+ type: z.ZodLiteral<"public-key">;
785
+ response: z.ZodObject<{
786
+ clientDataJSON: z.ZodString;
787
+ authenticatorData: z.ZodString;
788
+ signature: z.ZodString;
789
+ userHandle: z.ZodOptional<z.ZodString>;
790
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
791
+ clientDataJSON: z.ZodString;
792
+ authenticatorData: z.ZodString;
793
+ signature: z.ZodString;
794
+ userHandle: z.ZodOptional<z.ZodString>;
795
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
796
+ clientDataJSON: z.ZodString;
797
+ authenticatorData: z.ZodString;
798
+ signature: z.ZodString;
799
+ userHandle: z.ZodOptional<z.ZodString>;
800
+ }, z.ZodTypeAny, "passthrough">>;
801
+ clientExtensionResults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
802
+ authenticatorAttachment: z.ZodOptional<z.ZodString>;
803
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
804
+ id: z.ZodString;
805
+ rawId: z.ZodString;
806
+ type: z.ZodLiteral<"public-key">;
807
+ response: z.ZodObject<{
808
+ clientDataJSON: z.ZodString;
809
+ authenticatorData: z.ZodString;
810
+ signature: z.ZodString;
811
+ userHandle: z.ZodOptional<z.ZodString>;
812
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
813
+ clientDataJSON: z.ZodString;
814
+ authenticatorData: z.ZodString;
815
+ signature: z.ZodString;
816
+ userHandle: z.ZodOptional<z.ZodString>;
817
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
818
+ clientDataJSON: z.ZodString;
819
+ authenticatorData: z.ZodString;
820
+ signature: z.ZodString;
821
+ userHandle: z.ZodOptional<z.ZodString>;
822
+ }, z.ZodTypeAny, "passthrough">>;
823
+ clientExtensionResults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
824
+ authenticatorAttachment: z.ZodOptional<z.ZodString>;
825
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
826
+ id: z.ZodString;
827
+ rawId: z.ZodString;
828
+ type: z.ZodLiteral<"public-key">;
829
+ response: z.ZodObject<{
830
+ clientDataJSON: z.ZodString;
831
+ authenticatorData: z.ZodString;
832
+ signature: z.ZodString;
833
+ userHandle: z.ZodOptional<z.ZodString>;
834
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
835
+ clientDataJSON: z.ZodString;
836
+ authenticatorData: z.ZodString;
837
+ signature: z.ZodString;
838
+ userHandle: z.ZodOptional<z.ZodString>;
839
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
840
+ clientDataJSON: z.ZodString;
841
+ authenticatorData: z.ZodString;
842
+ signature: z.ZodString;
843
+ userHandle: z.ZodOptional<z.ZodString>;
844
+ }, z.ZodTypeAny, "passthrough">>;
845
+ clientExtensionResults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
846
+ authenticatorAttachment: z.ZodOptional<z.ZodString>;
847
+ }, z.ZodTypeAny, "passthrough">>;
848
+ /**
849
+ * `POST /identity/web-envelope/establish` body — an account's FIRST root, linked
850
+ * and stored with its envelope in ONE transaction: one root proof
851
+ * (`web_envelope_establish`, digest of the envelope) plus a fresh `assertion` by
852
+ * an existing passkey over the same challenge.
408
853
  */
409
854
  export declare const webIdentityEnvelopeEstablishSchema: z.ZodObject<{
410
- envelope: z.ZodObject<{
411
- version: z.ZodLiteral<1>;
855
+ envelope: z.ZodEffects<z.ZodObject<{
856
+ version: z.ZodLiteral<2>;
412
857
  algorithm: z.ZodLiteral<"xchacha20poly1305">;
413
858
  publicKey: z.ZodString;
414
- /** 24-byte nonce of the entropy seal. */
415
- entropyNonce: z.ZodString;
416
- /** The 16-byte BIP-39 entropy sealed under the DEK, tag appended (32 bytes). */
417
- sealedEntropy: z.ZodString;
859
+ secretKind: z.ZodEnum<["mnemonic-entropy", "raw-private-key"]>;
860
+ /** 24-byte nonce of the secret seal. */
861
+ secretNonce: z.ZodString;
862
+ /**
863
+ * The sealed secret, tag appended: 16/20/24/28/32 bytes of BIP-39 entropy
864
+ * (12–24 words) or a 32-byte private key, plus 16.
865
+ */
866
+ sealedSecret: z.ZodString;
418
867
  wraps: z.ZodArray<z.ZodObject<{
419
868
  credentialId: z.ZodString;
420
869
  /** 24-byte XChaCha20-Poly1305 nonce. */
@@ -422,101 +871,260 @@ export declare const webIdentityEnvelopeEstablishSchema: z.ZodObject<{
422
871
  /** The 32-byte DEK sealed under this passkey's KEK, with the 16-byte tag appended (48 bytes). */
423
872
  wrappedKey: z.ZodString;
424
873
  createdAt: z.ZodString;
874
+ /** The RP ID the passkey was created under, asserted explicitly by every later ceremony (ADR 0024 D2). */
875
+ rpId: z.ZodString;
876
+ /**
877
+ * When this passkey's PRF output was shown to open the envelope. A wrap is a
878
+ * root HOLDER only once this is set; a login passkey never is by default.
879
+ */
880
+ verifiedAt: z.ZodOptional<z.ZodString>;
425
881
  }, "strip", z.ZodTypeAny, {
426
882
  credentialId: string;
427
883
  createdAt: string;
428
884
  nonce: string;
429
885
  wrappedKey: string;
886
+ rpId: string;
887
+ verifiedAt?: string | undefined;
430
888
  }, {
431
889
  credentialId: string;
432
890
  createdAt: string;
433
891
  nonce: string;
434
892
  wrappedKey: string;
893
+ rpId: string;
894
+ verifiedAt?: string | undefined;
435
895
  }>, "many">;
436
896
  }, "strip", z.ZodTypeAny, {
437
- version: 1;
897
+ version: 2;
438
898
  publicKey: string;
439
899
  algorithm: "xchacha20poly1305";
440
- entropyNonce: string;
441
- sealedEntropy: string;
900
+ secretKind: "mnemonic-entropy" | "raw-private-key";
901
+ secretNonce: string;
902
+ sealedSecret: string;
442
903
  wraps: {
443
904
  credentialId: string;
444
905
  createdAt: string;
445
906
  nonce: string;
446
907
  wrappedKey: string;
908
+ rpId: string;
909
+ verifiedAt?: string | undefined;
447
910
  }[];
448
911
  }, {
449
- version: 1;
912
+ version: 2;
450
913
  publicKey: string;
451
914
  algorithm: "xchacha20poly1305";
452
- entropyNonce: string;
453
- sealedEntropy: string;
915
+ secretKind: "mnemonic-entropy" | "raw-private-key";
916
+ secretNonce: string;
917
+ sealedSecret: string;
454
918
  wraps: {
455
919
  credentialId: string;
456
920
  createdAt: string;
457
921
  nonce: string;
458
922
  wrappedKey: string;
923
+ rpId: string;
924
+ verifiedAt?: string | undefined;
925
+ }[];
926
+ }>, {
927
+ version: 2;
928
+ publicKey: string;
929
+ algorithm: "xchacha20poly1305";
930
+ secretKind: "mnemonic-entropy" | "raw-private-key";
931
+ secretNonce: string;
932
+ sealedSecret: string;
933
+ wraps: {
934
+ credentialId: string;
935
+ createdAt: string;
936
+ nonce: string;
937
+ wrappedKey: string;
938
+ rpId: string;
939
+ verifiedAt?: string | undefined;
940
+ }[];
941
+ }, {
942
+ version: 2;
943
+ publicKey: string;
944
+ algorithm: "xchacha20poly1305";
945
+ secretKind: "mnemonic-entropy" | "raw-private-key";
946
+ secretNonce: string;
947
+ sealedSecret: string;
948
+ wraps: {
949
+ credentialId: string;
950
+ createdAt: string;
951
+ nonce: string;
952
+ wrappedKey: string;
953
+ rpId: string;
954
+ verifiedAt?: string | undefined;
459
955
  }[];
460
956
  }>;
461
957
  } & {
462
- signature: z.ZodString;
463
- timestamp: z.ZodNumber;
464
- } & {
465
- link: z.ZodObject<{
958
+ proof: z.ZodObject<{
959
+ v: z.ZodLiteral<2>;
960
+ challenge: z.ZodString;
961
+ expiresAt: z.ZodNumber;
466
962
  signature: z.ZodString;
467
- timestamp: z.ZodNumber;
468
963
  }, "strip", z.ZodTypeAny, {
964
+ expiresAt: number;
469
965
  signature: string;
470
- timestamp: number;
966
+ v: 2;
967
+ challenge: string;
471
968
  }, {
969
+ expiresAt: number;
472
970
  signature: string;
473
- timestamp: number;
971
+ v: 2;
972
+ challenge: string;
474
973
  }>;
475
- }, "strip", z.ZodTypeAny, {
476
- signature: string;
477
- timestamp: number;
974
+ assertion: z.ZodObject<{
975
+ id: z.ZodString;
976
+ rawId: z.ZodString;
977
+ type: z.ZodLiteral<"public-key">;
978
+ response: z.ZodObject<{
979
+ clientDataJSON: z.ZodString;
980
+ authenticatorData: z.ZodString;
981
+ signature: z.ZodString;
982
+ userHandle: z.ZodOptional<z.ZodString>;
983
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
984
+ clientDataJSON: z.ZodString;
985
+ authenticatorData: z.ZodString;
986
+ signature: z.ZodString;
987
+ userHandle: z.ZodOptional<z.ZodString>;
988
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
989
+ clientDataJSON: z.ZodString;
990
+ authenticatorData: z.ZodString;
991
+ signature: z.ZodString;
992
+ userHandle: z.ZodOptional<z.ZodString>;
993
+ }, z.ZodTypeAny, "passthrough">>;
994
+ clientExtensionResults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
995
+ authenticatorAttachment: z.ZodOptional<z.ZodString>;
996
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
997
+ id: z.ZodString;
998
+ rawId: z.ZodString;
999
+ type: z.ZodLiteral<"public-key">;
1000
+ response: z.ZodObject<{
1001
+ clientDataJSON: z.ZodString;
1002
+ authenticatorData: z.ZodString;
1003
+ signature: z.ZodString;
1004
+ userHandle: z.ZodOptional<z.ZodString>;
1005
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1006
+ clientDataJSON: z.ZodString;
1007
+ authenticatorData: z.ZodString;
1008
+ signature: z.ZodString;
1009
+ userHandle: z.ZodOptional<z.ZodString>;
1010
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1011
+ clientDataJSON: z.ZodString;
1012
+ authenticatorData: z.ZodString;
1013
+ signature: z.ZodString;
1014
+ userHandle: z.ZodOptional<z.ZodString>;
1015
+ }, z.ZodTypeAny, "passthrough">>;
1016
+ clientExtensionResults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1017
+ authenticatorAttachment: z.ZodOptional<z.ZodString>;
1018
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1019
+ id: z.ZodString;
1020
+ rawId: z.ZodString;
1021
+ type: z.ZodLiteral<"public-key">;
1022
+ response: z.ZodObject<{
1023
+ clientDataJSON: z.ZodString;
1024
+ authenticatorData: z.ZodString;
1025
+ signature: z.ZodString;
1026
+ userHandle: z.ZodOptional<z.ZodString>;
1027
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1028
+ clientDataJSON: z.ZodString;
1029
+ authenticatorData: z.ZodString;
1030
+ signature: z.ZodString;
1031
+ userHandle: z.ZodOptional<z.ZodString>;
1032
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1033
+ clientDataJSON: z.ZodString;
1034
+ authenticatorData: z.ZodString;
1035
+ signature: z.ZodString;
1036
+ userHandle: z.ZodOptional<z.ZodString>;
1037
+ }, z.ZodTypeAny, "passthrough">>;
1038
+ clientExtensionResults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1039
+ authenticatorAttachment: z.ZodOptional<z.ZodString>;
1040
+ }, z.ZodTypeAny, "passthrough">>;
1041
+ }, "strict", z.ZodTypeAny, {
1042
+ proof: {
1043
+ expiresAt: number;
1044
+ signature: string;
1045
+ v: 2;
1046
+ challenge: string;
1047
+ };
478
1048
  envelope: {
479
- version: 1;
1049
+ version: 2;
480
1050
  publicKey: string;
481
1051
  algorithm: "xchacha20poly1305";
482
- entropyNonce: string;
483
- sealedEntropy: string;
1052
+ secretKind: "mnemonic-entropy" | "raw-private-key";
1053
+ secretNonce: string;
1054
+ sealedSecret: string;
484
1055
  wraps: {
485
1056
  credentialId: string;
486
1057
  createdAt: string;
487
1058
  nonce: string;
488
1059
  wrappedKey: string;
1060
+ rpId: string;
1061
+ verifiedAt?: string | undefined;
489
1062
  }[];
490
1063
  };
491
- link: {
492
- signature: string;
493
- timestamp: number;
1064
+ assertion: {
1065
+ type: "public-key";
1066
+ id: string;
1067
+ rawId: string;
1068
+ response: {
1069
+ signature: string;
1070
+ clientDataJSON: string;
1071
+ authenticatorData: string;
1072
+ userHandle?: string | undefined;
1073
+ } & {
1074
+ [k: string]: unknown;
1075
+ };
1076
+ clientExtensionResults?: Record<string, unknown> | undefined;
1077
+ authenticatorAttachment?: string | undefined;
1078
+ } & {
1079
+ [k: string]: unknown;
494
1080
  };
495
1081
  }, {
496
- signature: string;
497
- timestamp: number;
1082
+ proof: {
1083
+ expiresAt: number;
1084
+ signature: string;
1085
+ v: 2;
1086
+ challenge: string;
1087
+ };
498
1088
  envelope: {
499
- version: 1;
1089
+ version: 2;
500
1090
  publicKey: string;
501
1091
  algorithm: "xchacha20poly1305";
502
- entropyNonce: string;
503
- sealedEntropy: string;
1092
+ secretKind: "mnemonic-entropy" | "raw-private-key";
1093
+ secretNonce: string;
1094
+ sealedSecret: string;
504
1095
  wraps: {
505
1096
  credentialId: string;
506
1097
  createdAt: string;
507
1098
  nonce: string;
508
1099
  wrappedKey: string;
1100
+ rpId: string;
1101
+ verifiedAt?: string | undefined;
509
1102
  }[];
510
1103
  };
511
- link: {
512
- signature: string;
513
- timestamp: number;
1104
+ assertion: {
1105
+ type: "public-key";
1106
+ id: string;
1107
+ rawId: string;
1108
+ response: {
1109
+ signature: string;
1110
+ clientDataJSON: string;
1111
+ authenticatorData: string;
1112
+ userHandle?: string | undefined;
1113
+ } & {
1114
+ [k: string]: unknown;
1115
+ };
1116
+ clientExtensionResults?: Record<string, unknown> | undefined;
1117
+ authenticatorAttachment?: string | undefined;
1118
+ } & {
1119
+ [k: string]: unknown;
514
1120
  };
515
1121
  }>;
516
1122
  export type WebIdentityWrap = z.infer<typeof webIdentityWrapSchema>;
517
1123
  export type WebIdentityEnvelope = z.infer<typeof webIdentityEnvelopeSchema>;
1124
+ export type WebIdentityHolder = z.infer<typeof webIdentityHolderSchema>;
1125
+ export type WebIdentityEnvelopeAction = z.infer<typeof webIdentityEnvelopeActionSchema>;
1126
+ export type WebauthnAssertionResponse = z.infer<typeof webauthnAssertionResponseSchema>;
518
1127
  export type WebIdentityEnvelopeUpload = z.infer<typeof webIdentityEnvelopeUploadSchema>;
519
1128
  export type WebIdentityEnvelopeResponse = z.infer<typeof webIdentityEnvelopeResponseSchema>;
520
- export type WebIdentityEnvelopeProof = z.infer<typeof webIdentityEnvelopeProofSchema>;
521
1129
  export type WebIdentityEnvelopePut = z.infer<typeof webIdentityEnvelopePutSchema>;
522
1130
  export type WebIdentityEnvelopeEstablish = z.infer<typeof webIdentityEnvelopeEstablishSchema>;