@oxy.so/contracts 2.1.0 → 2.2.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 (42) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/accountEmail.js +83 -0
  3. package/dist/cjs/identityLink.js +89 -0
  4. package/dist/cjs/identityProof.js +6 -29
  5. package/dist/cjs/index.js +35 -49
  6. package/dist/cjs/webauthn.js +50 -21
  7. package/dist/esm/.tsbuildinfo +1 -1
  8. package/dist/esm/accountEmail.js +80 -0
  9. package/dist/esm/identityLink.js +84 -0
  10. package/dist/esm/identityProof.js +6 -29
  11. package/dist/esm/index.js +7 -10
  12. package/dist/esm/webauthn.js +49 -20
  13. package/dist/types/.tsbuildinfo +1 -1
  14. package/dist/types/accountEmail.d.ts +98 -0
  15. package/dist/types/accountGraph.d.ts +4 -4
  16. package/dist/types/agency.d.ts +2 -2
  17. package/dist/types/deviceSession.d.ts +4 -4
  18. package/dist/types/externalIdentity.d.ts +8 -8
  19. package/dist/types/identityLink.d.ts +210 -0
  20. package/dist/types/identityProof.d.ts +15 -42
  21. package/dist/types/index.d.ts +6 -8
  22. package/dist/types/inference/accountBilling.d.ts +2 -2
  23. package/dist/types/inference/embeddings.d.ts +16 -16
  24. package/dist/types/inference/errors.d.ts +8 -8
  25. package/dist/types/inference/inbox.d.ts +8 -8
  26. package/dist/types/inference/providerConnection.d.ts +20 -20
  27. package/dist/types/inference/request.d.ts +16 -16
  28. package/dist/types/inference/streamEvents.d.ts +20 -20
  29. package/dist/types/keyRecovery.d.ts +4 -4
  30. package/dist/types/sessionStatus.d.ts +2 -2
  31. package/dist/types/userResponse.d.ts +4 -4
  32. package/dist/types/webauthn.d.ts +102 -214
  33. package/package.json +1 -1
  34. package/dist/cjs/identityMove.js +0 -156
  35. package/dist/cjs/identityRecovery.js +0 -51
  36. package/dist/cjs/webIdentityCarrier.js +0 -181
  37. package/dist/esm/identityMove.js +0 -148
  38. package/dist/esm/identityRecovery.js +0 -48
  39. package/dist/esm/webIdentityCarrier.js +0 -178
  40. package/dist/types/identityMove.d.ts +0 -185
  41. package/dist/types/identityRecovery.d.ts +0 -246
  42. package/dist/types/webIdentityCarrier.d.ts +0 -1130
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Recovery email contracts (ADR 0029 D3).
3
+ *
4
+ * A web account is a username, a passkey and a recovery email. The email is
5
+ * proven by a 6-digit code sent to it, and the proof is a short-lived one-use
6
+ * ticket the next step spends:
7
+ *
8
+ * - `signup`: the ticket lets `POST /webauthn/register/verify` create the
9
+ * account with that email;
10
+ * - `recovery`: the person names their username or email, the code goes to the
11
+ * account's recovery email, and the ticket lets them register a new passkey
12
+ * for that account.
13
+ *
14
+ * `start` answers the same whether or not an account exists, so neither purpose
15
+ * tells anyone which emails or usernames have an Oxy account. An account with a
16
+ * Commons key has no recovery email: it recovers in Commons.
17
+ */
18
+ import { z } from 'zod';
19
+ export declare const EMAIL_VERIFICATION_PURPOSES: readonly ["signup", "recovery"];
20
+ export type EmailVerificationPurpose = (typeof EMAIL_VERIFICATION_PURPOSES)[number];
21
+ /** Digits in a code. */
22
+ export declare const EMAIL_CODE_LENGTH = 6;
23
+ /** How long a code can be confirmed. */
24
+ export declare const EMAIL_CODE_TTL_MS: number;
25
+ /** Wrong codes before a verification is spent and a new code is needed. */
26
+ export declare const EMAIL_CODE_MAX_ATTEMPTS = 5;
27
+ /** How long a confirmed code's ticket can be spent. */
28
+ export declare const EMAIL_TICKET_TTL_MS: number;
29
+ /** An email address as the API stores it: trimmed and lowercase. */
30
+ export declare const emailAddressSchema: z.ZodString;
31
+ /** An opaque one-use ticket (32 random bytes, base64url). */
32
+ export declare const emailTicketSchema: z.ZodString;
33
+ /** `POST /auth/email/verify/start` */
34
+ export declare const emailVerificationStartRequestSchema: z.ZodDiscriminatedUnion<"purpose", [z.ZodObject<{
35
+ purpose: z.ZodLiteral<"signup">;
36
+ email: z.ZodString;
37
+ }, "strict", z.ZodTypeAny, {
38
+ purpose: "signup";
39
+ email: string;
40
+ }, {
41
+ purpose: "signup";
42
+ email: string;
43
+ }>, z.ZodObject<{
44
+ purpose: z.ZodLiteral<"recovery">;
45
+ /** The account's username, or its recovery email. */
46
+ identifier: z.ZodString;
47
+ }, "strict", z.ZodTypeAny, {
48
+ purpose: "recovery";
49
+ identifier: string;
50
+ }, {
51
+ purpose: "recovery";
52
+ identifier: string;
53
+ }>]>;
54
+ export type EmailVerificationStartRequest = z.infer<typeof emailVerificationStartRequestSchema>;
55
+ export interface EmailVerificationStartResponse {
56
+ /** Names this verification in `confirm`. Returned whether or not a code was sent. */
57
+ verificationId: string;
58
+ /** Unix milliseconds after which the code is refused. */
59
+ expiresAt: number;
60
+ }
61
+ export declare const emailVerificationStartResponseSchema: z.ZodType<EmailVerificationStartResponse>;
62
+ /** `POST /auth/email/verify/confirm` */
63
+ export declare const emailVerificationConfirmRequestSchema: z.ZodObject<{
64
+ verificationId: z.ZodString;
65
+ code: z.ZodString;
66
+ }, "strict", z.ZodTypeAny, {
67
+ code: string;
68
+ verificationId: string;
69
+ }, {
70
+ code: string;
71
+ verificationId: string;
72
+ }>;
73
+ export type EmailVerificationConfirmRequest = z.infer<typeof emailVerificationConfirmRequestSchema>;
74
+ export interface EmailVerificationConfirmResponse {
75
+ ticket: string;
76
+ /** Unix milliseconds after which the ticket is refused. */
77
+ expiresAt: number;
78
+ /** Recovery only: the account the ticket recovers. `null` for sign-up. */
79
+ username: string | null;
80
+ }
81
+ export declare const emailVerificationConfirmResponseSchema: z.ZodType<EmailVerificationConfirmResponse>;
82
+ /**
83
+ * Stable error codes (`error.code` in the API error body). Clients map these
84
+ * through their localization, never the English message.
85
+ */
86
+ export declare const EMAIL_VERIFICATION_ERROR_CODES: {
87
+ /** The code is wrong, or its verification expired or was spent. */
88
+ readonly codeInvalid: "EMAIL_CODE_INVALID";
89
+ /** Too many wrong codes: request a new one. */
90
+ readonly tooManyAttempts: "EMAIL_CODE_TOO_MANY_ATTEMPTS";
91
+ /** The ticket is unknown, expired, spent, or for another email or purpose. */
92
+ readonly ticketInvalid: "EMAIL_TICKET_INVALID";
93
+ /** A sign-up without a confirmed recovery email. */
94
+ readonly ticketRequired: "EMAIL_TICKET_REQUIRED";
95
+ /** This server cannot send mail. */
96
+ readonly unavailable: "EMAIL_UNAVAILABLE";
97
+ };
98
+ export type EmailVerificationErrorCode = (typeof EMAIL_VERIFICATION_ERROR_CODES)[keyof typeof EMAIL_VERIFICATION_ERROR_CODES];
@@ -315,8 +315,8 @@ export declare const createAccountRequestSchema: z.ZodEffects<z.ZodObject<{
315
315
  */
316
316
  isPrivateAccount: z.ZodOptional<z.ZodBoolean>;
317
317
  }, "strip", z.ZodTypeAny, {
318
- kind: "bot" | "organization" | "project" | "channel";
319
318
  username: string;
319
+ kind: "bot" | "organization" | "project" | "channel";
320
320
  parentAccountId?: string | undefined;
321
321
  name?: {
322
322
  first?: string | undefined;
@@ -330,8 +330,8 @@ export declare const createAccountRequestSchema: z.ZodEffects<z.ZodObject<{
330
330
  accountCategories?: ("security" | "news" | "politics" | "business" | "startup" | "finance" | "crypto" | "marketplace" | "retail" | "real_estate" | "agency" | "landlord" | "cooperative" | "architecture" | "technology" | "software" | "ai" | "automation" | "science" | "education" | "books" | "health" | "fitness" | "sports" | "gaming" | "music" | "film" | "podcast" | "art" | "photography" | "comedy" | "food" | "travel" | "fashion" | "home_garden" | "diy" | "automotive" | "animals" | "family" | "nonprofit" | "government" | "community" | "activism" | "environment" | "religion" | "other")[] | undefined;
331
331
  isPrivateAccount?: boolean | undefined;
332
332
  }, {
333
- kind: "bot" | "organization" | "project" | "channel";
334
333
  username: string;
334
+ kind: "bot" | "organization" | "project" | "channel";
335
335
  parentAccountId?: string | undefined;
336
336
  name?: {
337
337
  first?: string | undefined;
@@ -345,8 +345,8 @@ export declare const createAccountRequestSchema: z.ZodEffects<z.ZodObject<{
345
345
  accountCategories?: ("security" | "news" | "politics" | "business" | "startup" | "finance" | "crypto" | "marketplace" | "retail" | "real_estate" | "agency" | "landlord" | "cooperative" | "architecture" | "technology" | "software" | "ai" | "automation" | "science" | "education" | "books" | "health" | "fitness" | "sports" | "gaming" | "music" | "film" | "podcast" | "art" | "photography" | "comedy" | "food" | "travel" | "fashion" | "home_garden" | "diy" | "automotive" | "animals" | "family" | "nonprofit" | "government" | "community" | "activism" | "environment" | "religion" | "other")[] | undefined;
346
346
  isPrivateAccount?: boolean | undefined;
347
347
  }>, {
348
- kind: "bot" | "organization" | "project" | "channel";
349
348
  username: string;
349
+ kind: "bot" | "organization" | "project" | "channel";
350
350
  parentAccountId?: string | undefined;
351
351
  name?: {
352
352
  first?: string | undefined;
@@ -360,8 +360,8 @@ export declare const createAccountRequestSchema: z.ZodEffects<z.ZodObject<{
360
360
  accountCategories?: ("security" | "news" | "politics" | "business" | "startup" | "finance" | "crypto" | "marketplace" | "retail" | "real_estate" | "agency" | "landlord" | "cooperative" | "architecture" | "technology" | "software" | "ai" | "automation" | "science" | "education" | "books" | "health" | "fitness" | "sports" | "gaming" | "music" | "film" | "podcast" | "art" | "photography" | "comedy" | "food" | "travel" | "fashion" | "home_garden" | "diy" | "automotive" | "animals" | "family" | "nonprofit" | "government" | "community" | "activism" | "environment" | "religion" | "other")[] | undefined;
361
361
  isPrivateAccount?: boolean | undefined;
362
362
  }, {
363
- kind: "bot" | "organization" | "project" | "channel";
364
363
  username: string;
364
+ kind: "bot" | "organization" | "project" | "channel";
365
365
  parentAccountId?: string | undefined;
366
366
  name?: {
367
367
  first?: string | undefined;
@@ -190,6 +190,7 @@ export declare const delegationGrantSchema: z.ZodObject<{
190
190
  createdAt: z.ZodString;
191
191
  updatedAt: z.ZodString;
192
192
  }, "strict", z.ZodTypeAny, {
193
+ expiresAt: string | null;
193
194
  ownerAccountId: string;
194
195
  id: string;
195
196
  actor: {
@@ -223,11 +224,11 @@ export declare const delegationGrantSchema: z.ZodObject<{
223
224
  }[];
224
225
  maximumAutonomy: "read_only" | "draft" | "execute_on_request" | "autonomous";
225
226
  canRedelegate: boolean;
226
- expiresAt: string | null;
227
227
  revokedAt: string | null;
228
228
  createdAt: string;
229
229
  updatedAt: string;
230
230
  }, {
231
+ expiresAt: string | null;
231
232
  ownerAccountId: string;
232
233
  id: string;
233
234
  actor: {
@@ -251,7 +252,6 @@ export declare const delegationGrantSchema: z.ZodObject<{
251
252
  capabilityPackages: ("security" | "finance" | "read" | "create" | "publish" | "communicate" | "administer" | "delegate")[];
252
253
  capabilities: string[];
253
254
  maximumAutonomy: "read_only" | "draft" | "execute_on_request" | "autonomous";
254
- expiresAt: string | null;
255
255
  createdAt: string;
256
256
  updatedAt: string;
257
257
  toolOverrides?: {
@@ -353,13 +353,13 @@ export declare const deviceBackgroundCredentialResponseSchema: z.ZodObject<{
353
353
  accountId: z.ZodString;
354
354
  expiresAt: z.ZodString;
355
355
  }, "strip", z.ZodTypeAny, {
356
- accountId: string;
357
356
  expiresAt: string;
357
+ accountId: string;
358
358
  deviceId: string;
359
359
  secret: string;
360
360
  }, {
361
- accountId: string;
362
361
  expiresAt: string;
362
+ accountId: string;
363
363
  deviceId: string;
364
364
  secret: string;
365
365
  }>;
@@ -398,12 +398,12 @@ export declare const deviceBackgroundTokenResponseSchema: z.ZodObject<{
398
398
  expiresAt: z.ZodString;
399
399
  accountId: z.ZodString;
400
400
  }, "strip", z.ZodTypeAny, {
401
- accountId: string;
402
401
  expiresAt: string;
402
+ accountId: string;
403
403
  accessToken: string;
404
404
  }, {
405
- accountId: string;
406
405
  expiresAt: string;
406
+ accountId: string;
407
407
  accessToken: string;
408
408
  }>;
409
409
  export type DeviceBackgroundCredentialResponse = z.infer<typeof deviceBackgroundCredentialResponseSchema>;
@@ -253,6 +253,7 @@ export declare const resolveExternalIdentityResponseSchema: z.ZodEffects<z.ZodOb
253
253
  sourceUserId: string;
254
254
  }[];
255
255
  redirectedUserIds: string[];
256
+ email?: string | undefined;
256
257
  kind?: "bot" | "personal" | "organization" | "project" | "channel" | undefined;
257
258
  bio?: string | undefined;
258
259
  avatar?: string | null | undefined;
@@ -263,7 +264,6 @@ export declare const resolveExternalIdentityResponseSchema: z.ZodEffects<z.ZodOb
263
264
  did?: string | undefined;
264
265
  verifiedDomains?: import("./identity").VerifiedDomain[] | undefined;
265
266
  _id?: string | undefined;
266
- email?: string | undefined;
267
267
  phone?: string | undefined;
268
268
  address?: string | undefined;
269
269
  birthday?: string | undefined;
@@ -307,6 +307,7 @@ export declare const resolveExternalIdentityResponseSchema: z.ZodEffects<z.ZodOb
307
307
  sourceUserId: string;
308
308
  }[];
309
309
  redirectedUserIds: string[];
310
+ email?: string | undefined;
310
311
  kind?: "bot" | "personal" | "organization" | "project" | "channel" | undefined;
311
312
  bio?: string | undefined;
312
313
  avatar?: string | null | undefined;
@@ -317,7 +318,6 @@ export declare const resolveExternalIdentityResponseSchema: z.ZodEffects<z.ZodOb
317
318
  did?: string | undefined;
318
319
  verifiedDomains?: import("./identity").VerifiedDomain[] | undefined;
319
320
  _id?: string | undefined;
320
- email?: string | undefined;
321
321
  phone?: string | undefined;
322
322
  address?: string | undefined;
323
323
  birthday?: string | undefined;
@@ -361,6 +361,7 @@ export declare const resolveExternalIdentityResponseSchema: z.ZodEffects<z.ZodOb
361
361
  sourceUserId: string;
362
362
  }[];
363
363
  redirectedUserIds: string[];
364
+ email?: string | undefined;
364
365
  kind?: "bot" | "personal" | "organization" | "project" | "channel" | undefined;
365
366
  bio?: string | undefined;
366
367
  avatar?: string | null | undefined;
@@ -371,7 +372,6 @@ export declare const resolveExternalIdentityResponseSchema: z.ZodEffects<z.ZodOb
371
372
  did?: string | undefined;
372
373
  verifiedDomains?: import("./identity").VerifiedDomain[] | undefined;
373
374
  _id?: string | undefined;
374
- email?: string | undefined;
375
375
  phone?: string | undefined;
376
376
  address?: string | undefined;
377
377
  birthday?: string | undefined;
@@ -415,6 +415,7 @@ export declare const resolveExternalIdentityResponseSchema: z.ZodEffects<z.ZodOb
415
415
  sourceUserId: string;
416
416
  }[];
417
417
  redirectedUserIds: string[];
418
+ email?: string | undefined;
418
419
  kind?: "bot" | "personal" | "organization" | "project" | "channel" | undefined;
419
420
  bio?: string | undefined;
420
421
  avatar?: string | null | undefined;
@@ -425,7 +426,6 @@ export declare const resolveExternalIdentityResponseSchema: z.ZodEffects<z.ZodOb
425
426
  did?: string | undefined;
426
427
  verifiedDomains?: import("./identity").VerifiedDomain[] | undefined;
427
428
  _id?: string | undefined;
428
- email?: string | undefined;
429
429
  phone?: string | undefined;
430
430
  address?: string | undefined;
431
431
  birthday?: string | undefined;
@@ -491,6 +491,7 @@ export declare const lookupExternalIdentitiesResponseSchema: z.ZodObject<{
491
491
  }>, "many">;
492
492
  redirectedUserIds: z.ZodArray<z.ZodString, "many">;
493
493
  }, "strip", z.ZodTypeAny, {
494
+ identifier: string;
494
495
  userId: string | null;
495
496
  externalIdentities: {
496
497
  canonicalAcct: string;
@@ -501,8 +502,8 @@ export declare const lookupExternalIdentitiesResponseSchema: z.ZodObject<{
501
502
  sourceUserId: string;
502
503
  }[];
503
504
  redirectedUserIds: string[];
504
- identifier: string;
505
505
  }, {
506
+ identifier: string;
506
507
  userId: string | null;
507
508
  externalIdentities: {
508
509
  canonicalAcct: string;
@@ -513,10 +514,10 @@ export declare const lookupExternalIdentitiesResponseSchema: z.ZodObject<{
513
514
  sourceUserId: string;
514
515
  }[];
515
516
  redirectedUserIds: string[];
516
- identifier: string;
517
517
  }>, "many">;
518
518
  }, "strip", z.ZodTypeAny, {
519
519
  identities: {
520
+ identifier: string;
520
521
  userId: string | null;
521
522
  externalIdentities: {
522
523
  canonicalAcct: string;
@@ -527,10 +528,10 @@ export declare const lookupExternalIdentitiesResponseSchema: z.ZodObject<{
527
528
  sourceUserId: string;
528
529
  }[];
529
530
  redirectedUserIds: string[];
530
- identifier: string;
531
531
  }[];
532
532
  }, {
533
533
  identities: {
534
+ identifier: string;
534
535
  userId: string | null;
535
536
  externalIdentities: {
536
537
  canonicalAcct: string;
@@ -541,7 +542,6 @@ export declare const lookupExternalIdentitiesResponseSchema: z.ZodObject<{
541
542
  sourceUserId: string;
542
543
  }[];
543
544
  redirectedUserIds: string[];
544
- identifier: string;
545
545
  }[];
546
546
  }>;
547
547
  export type ExternalIdentityReference = z.infer<typeof externalIdentityReferenceSchema>;
@@ -0,0 +1,210 @@
1
+ /**
2
+ * Linking Commons to a passkey account (ADR 0029 D3) — the two-device relay.
3
+ *
4
+ * A passkey account links a Commons root once, and becomes self-custodied: its
5
+ * recovery email is deleted and its phrase in Commons is how it gets back in.
6
+ * The authority is the same as `POST /auth/link` (ADR 0024 D8): a root proof
7
+ * (`link_identity`) by the key Commons holds, and a fresh assertion by one of
8
+ * the account's passkeys over the SAME one-use challenge. Only the transport is
9
+ * new, because the two factors live on two devices:
10
+ *
11
+ * 1. auth.oxy.so (signed in) opens a link request → `{ linkId, challenge }`,
12
+ * shown as a QR (`oxycommons://link?id=…&c=…`).
13
+ * 2. Commons scans it, reads the request (the account's id and username),
14
+ * signs the root proof over the challenge and posts it with its key.
15
+ * 3. Both screens show the same 6-digit code, derived from the link id and
16
+ * that key (`deriveIdentityLinkCode` in `@oxy.so/core`); the person checks
17
+ * they match, so a photographed QR cannot slip another key in.
18
+ * 4. auth.oxy.so asserts the passkey over the challenge and completes: the
19
+ * account gains the root, loses the email, and Commons signs in with it.
20
+ *
21
+ * The server stores only the challenge's hash; the challenge travels in the QR.
22
+ */
23
+ import { z } from 'zod';
24
+ export declare const IDENTITY_LINK_STATUSES: readonly ["pending", "signed", "completed", "cancelled"];
25
+ export type IdentityLinkStatus = (typeof IDENTITY_LINK_STATUSES)[number];
26
+ /** The scheme and host Commons routes a link QR to. */
27
+ export declare const IDENTITY_LINK_QR_PREFIX = "oxycommons://link";
28
+ export declare const identityLinkIdSchema: z.ZodString;
29
+ /** The QR auth.oxy.so shows: the request's id and the challenge Commons signs. */
30
+ export declare function buildIdentityLinkQrPayload(linkId: string, challenge: string): string;
31
+ /** The request a scanned code names, or `null` for anything that is not a link QR. */
32
+ export declare function parseIdentityLinkQrPayload(raw: string): {
33
+ linkId: string;
34
+ challenge: string;
35
+ } | null;
36
+ /** `POST /identity/link` */
37
+ export interface IdentityLinkCreateResponse {
38
+ linkId: string;
39
+ /** The one-use `link_identity` proof challenge, hex. */
40
+ challenge: string;
41
+ /** Unix milliseconds. */
42
+ expiresAt: number;
43
+ qrPayload: string;
44
+ }
45
+ export declare const identityLinkCreateResponseSchema: z.ZodType<IdentityLinkCreateResponse>;
46
+ /** `GET /identity/link/:linkId` — what both devices poll. */
47
+ export interface IdentityLinkState {
48
+ status: IdentityLinkStatus;
49
+ /** The account being linked: the proof's subject and actor. */
50
+ userId: string;
51
+ username: string | null;
52
+ /** The key Commons signed with, once it has. */
53
+ publicKey: string | null;
54
+ audience: string;
55
+ expiresAt: number;
56
+ }
57
+ export declare const identityLinkStateSchema: z.ZodType<IdentityLinkState>;
58
+ /** `POST /identity/link/:linkId/proof` — from Commons, no bearer. */
59
+ export declare const identityLinkProofRequestSchema: z.ZodObject<{
60
+ publicKey: z.ZodString;
61
+ proof: z.ZodObject<{
62
+ v: z.ZodLiteral<2>;
63
+ challenge: z.ZodString;
64
+ expiresAt: z.ZodNumber;
65
+ signature: z.ZodString;
66
+ }, "strip", z.ZodTypeAny, {
67
+ expiresAt: number;
68
+ signature: string;
69
+ v: 2;
70
+ challenge: string;
71
+ }, {
72
+ expiresAt: number;
73
+ signature: string;
74
+ v: 2;
75
+ challenge: string;
76
+ }>;
77
+ }, "strict", z.ZodTypeAny, {
78
+ publicKey: string;
79
+ proof: {
80
+ expiresAt: number;
81
+ signature: string;
82
+ v: 2;
83
+ challenge: string;
84
+ };
85
+ }, {
86
+ publicKey: string;
87
+ proof: {
88
+ expiresAt: number;
89
+ signature: string;
90
+ v: 2;
91
+ challenge: string;
92
+ };
93
+ }>;
94
+ export type IdentityLinkProofRequest = z.infer<typeof identityLinkProofRequestSchema>;
95
+ /** `POST /identity/link/:linkId/options` — WebAuthn request options over the challenge. */
96
+ export declare const identityLinkOptionsRequestSchema: z.ZodObject<{
97
+ challenge: z.ZodString;
98
+ }, "strict", z.ZodTypeAny, {
99
+ challenge: string;
100
+ }, {
101
+ challenge: string;
102
+ }>;
103
+ export type IdentityLinkOptionsRequest = z.infer<typeof identityLinkOptionsRequestSchema>;
104
+ /** `POST /identity/link/:linkId/complete` — the passkey assertion over the challenge. */
105
+ export declare const identityLinkCompleteRequestSchema: z.ZodObject<{
106
+ assertion: z.ZodObject<{
107
+ id: z.ZodString;
108
+ rawId: z.ZodString;
109
+ type: z.ZodLiteral<"public-key">;
110
+ response: z.ZodObject<{
111
+ clientDataJSON: z.ZodString;
112
+ authenticatorData: z.ZodString;
113
+ signature: z.ZodString;
114
+ userHandle: z.ZodOptional<z.ZodString>;
115
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
116
+ clientDataJSON: z.ZodString;
117
+ authenticatorData: z.ZodString;
118
+ signature: z.ZodString;
119
+ userHandle: z.ZodOptional<z.ZodString>;
120
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
121
+ clientDataJSON: z.ZodString;
122
+ authenticatorData: z.ZodString;
123
+ signature: z.ZodString;
124
+ userHandle: z.ZodOptional<z.ZodString>;
125
+ }, z.ZodTypeAny, "passthrough">>;
126
+ clientExtensionResults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
127
+ authenticatorAttachment: z.ZodOptional<z.ZodString>;
128
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
129
+ id: z.ZodString;
130
+ rawId: z.ZodString;
131
+ type: z.ZodLiteral<"public-key">;
132
+ response: z.ZodObject<{
133
+ clientDataJSON: z.ZodString;
134
+ authenticatorData: z.ZodString;
135
+ signature: z.ZodString;
136
+ userHandle: z.ZodOptional<z.ZodString>;
137
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
138
+ clientDataJSON: z.ZodString;
139
+ authenticatorData: z.ZodString;
140
+ signature: z.ZodString;
141
+ userHandle: z.ZodOptional<z.ZodString>;
142
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
143
+ clientDataJSON: z.ZodString;
144
+ authenticatorData: z.ZodString;
145
+ signature: z.ZodString;
146
+ userHandle: z.ZodOptional<z.ZodString>;
147
+ }, z.ZodTypeAny, "passthrough">>;
148
+ clientExtensionResults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
149
+ authenticatorAttachment: z.ZodOptional<z.ZodString>;
150
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
151
+ id: z.ZodString;
152
+ rawId: z.ZodString;
153
+ type: z.ZodLiteral<"public-key">;
154
+ response: z.ZodObject<{
155
+ clientDataJSON: z.ZodString;
156
+ authenticatorData: z.ZodString;
157
+ signature: z.ZodString;
158
+ userHandle: z.ZodOptional<z.ZodString>;
159
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
160
+ clientDataJSON: z.ZodString;
161
+ authenticatorData: z.ZodString;
162
+ signature: z.ZodString;
163
+ userHandle: z.ZodOptional<z.ZodString>;
164
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
165
+ clientDataJSON: z.ZodString;
166
+ authenticatorData: z.ZodString;
167
+ signature: z.ZodString;
168
+ userHandle: z.ZodOptional<z.ZodString>;
169
+ }, z.ZodTypeAny, "passthrough">>;
170
+ clientExtensionResults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
171
+ authenticatorAttachment: z.ZodOptional<z.ZodString>;
172
+ }, z.ZodTypeAny, "passthrough">>;
173
+ }, "strict", z.ZodTypeAny, {
174
+ assertion: {
175
+ type: "public-key";
176
+ id: string;
177
+ rawId: string;
178
+ response: {
179
+ signature: string;
180
+ clientDataJSON: string;
181
+ authenticatorData: string;
182
+ userHandle?: string | undefined;
183
+ } & {
184
+ [k: string]: unknown;
185
+ };
186
+ clientExtensionResults?: Record<string, unknown> | undefined;
187
+ authenticatorAttachment?: string | undefined;
188
+ } & {
189
+ [k: string]: unknown;
190
+ };
191
+ }, {
192
+ assertion: {
193
+ type: "public-key";
194
+ id: string;
195
+ rawId: string;
196
+ response: {
197
+ signature: string;
198
+ clientDataJSON: string;
199
+ authenticatorData: string;
200
+ userHandle?: string | undefined;
201
+ } & {
202
+ [k: string]: unknown;
203
+ };
204
+ clientExtensionResults?: Record<string, unknown> | undefined;
205
+ authenticatorAttachment?: string | undefined;
206
+ } & {
207
+ [k: string]: unknown;
208
+ };
209
+ }>;
210
+ export type IdentityLinkCompleteRequest = z.infer<typeof identityLinkCompleteRequestSchema>;
@@ -27,26 +27,12 @@ export declare const IDENTITY_PROOF_CHALLENGE_TTL_MS: number;
27
27
  * action and spent only by a proof for that action.
28
28
  */
29
29
  export declare const IDENTITY_PROOF_ACTIONS: {
30
- /** A keyless account's FIRST root, stored with its web envelope. */
31
- readonly establish: "web_envelope_establish";
32
- /** Replace the web envelope (add or remove a wrap, re-seal). */
33
- readonly put: "web_envelope_put";
34
- /** Record that the recovery material is written down. */
35
- readonly phraseConfirmed: "web_envelope_phrase_confirmed";
36
- /** Record that the recovery material re-derived the root. */
37
- readonly recoveryVerified: "web_envelope_recovery_verified";
38
- /** Remove the web holder. */
39
- readonly delete: "web_envelope_delete";
40
- /** Link a keyless account's first root without a web envelope (`POST /auth/link`). */
30
+ /**
31
+ * Link Commons' root to a passkey account that has none (`POST /auth/link`).
32
+ * The account becomes self-custodied and its recovery email is deleted
33
+ * (ADR 0029 D3).
34
+ */
41
35
  readonly link: "link_identity";
42
- /** Create a personal account together with its root (passkey sign-up). */
43
- readonly enroll: "enroll_identity";
44
- /** Prove the root to start signed-out recovery. */
45
- readonly recoverStart: "recover_account_start";
46
- /** Bind the new passkey and envelope when completing signed-out recovery. */
47
- readonly recoverComplete: "recover_account_complete";
48
- /** Seal the root for the Commons device that joined a move (payload: move id + sealed bytes). */
49
- readonly moveSeal: "identity_move_seal";
50
36
  };
51
37
  export type IdentityProofAction = (typeof IDENTITY_PROOF_ACTIONS)[keyof typeof IDENTITY_PROOF_ACTIONS];
52
38
  export declare const IDENTITY_PROOF_ACTION_VALUES: [IdentityProofAction, ...IdentityProofAction[]];
@@ -64,7 +50,7 @@ export interface IdentityProofClaims {
64
50
  rootPublicKey: string;
65
51
  /** SHA-256 hex of `canonicalJson(payload)`, or `null` when the operation has no payload. */
66
52
  payloadDigest: string | null;
67
- /** The envelope revision the operation expects to replace, or `null`. */
53
+ /** The revision the operation expects to replace, or `null` when it replaces nothing. */
68
54
  expectedRevision: number | null;
69
55
  audience: string;
70
56
  /** The one-use server challenge. */
@@ -103,11 +89,11 @@ export declare const identityProofSchema: z.ZodObject<{
103
89
  export type IdentityProof = z.infer<typeof identityProofSchema>;
104
90
  /** `POST /identity/proof-challenge` */
105
91
  export declare const identityProofChallengeRequestSchema: z.ZodObject<{
106
- action: z.ZodEnum<[IdentityProofAction, ...IdentityProofAction[]]>;
92
+ action: z.ZodEnum<["link_identity", ..."link_identity"[]]>;
107
93
  }, "strip", z.ZodTypeAny, {
108
- action: IdentityProofAction;
94
+ action: "link_identity";
109
95
  }, {
110
- action: IdentityProofAction;
96
+ action: "link_identity";
111
97
  }>;
112
98
  export type IdentityProofChallengeRequest = z.infer<typeof identityProofChallengeRequestSchema>;
113
99
  export interface IdentityProofChallengeResponse {
@@ -123,34 +109,21 @@ export declare const identityProofChallengeResponseSchema: z.ZodType<IdentityPro
123
109
  */
124
110
  export declare const IDENTITY_ERROR_CODES: {
125
111
  readonly proofInvalid: "IDENTITY_PROOF_INVALID";
126
- readonly revisionConflict: "IDENTITY_ENVELOPE_REVISION_CONFLICT";
127
112
  readonly rootAlreadyLinked: "IDENTITY_ROOT_ALREADY_LINKED";
128
113
  readonly rootLinkedElsewhere: "IDENTITY_ROOT_LINKED_ELSEWHERE";
129
- readonly noRoot: "IDENTITY_NO_ROOT";
130
114
  readonly freshFactorRequired: "IDENTITY_FRESH_FACTOR_REQUIRED";
131
- readonly lastWebHolder: "IDENTITY_LAST_WEB_HOLDER";
132
- readonly enrollmentRequired: "IDENTITY_ENROLLMENT_REQUIRED";
133
- readonly enrollmentInvalid: "IDENTITY_ENROLLMENT_INVALID";
134
115
  readonly notPersonal: "IDENTITY_NOT_PERSONAL_ACCOUNT";
135
- readonly recoveryFailed: "IDENTITY_RECOVERY_FAILED";
136
116
  };
137
117
  export type IdentityErrorCode = (typeof IDENTITY_ERROR_CODES)[keyof typeof IDENTITY_ERROR_CODES];
138
118
  /**
139
- * `GET /identity/root-status` — non-sensitive readiness metadata any first-party
140
- * surface (Accounts, the account menu) may read with a bearer to show a reminder,
141
- * without the ciphertext and without opening anything (ADR 0024 D5).
119
+ * `GET /identity/root-status` — how the signed-in account is kept (ADR 0029 D3),
120
+ * for Accounts and the account menu to recommend linking Commons. Read with a
121
+ * bearer from any first-party origin.
142
122
  */
143
123
  export interface IdentityRootStatus {
144
- /** Whether the account has a root at all. */
124
+ /** Whether Commons' root is linked: the account is self-custodied. */
145
125
  rootLinked: boolean;
146
- /** Passkeys whose wraps can open the web holder, and how many have proven it. `null`: no web holder. */
147
- webHolder: {
148
- passkeys: number;
149
- verifiedPasskeys: number;
150
- } | null;
151
- /** Whether the root has recovery words (a raw-key root does not). `null` when unknown (no web holder). */
152
- hasPhrase: boolean | null;
153
- phraseConfirmedAt: string | null;
154
- recoveryVerifiedAt: string | null;
126
+ /** The recovery email of a passkey account; `null` once Commons is linked. */
127
+ recoveryEmail: string | null;
155
128
  }
156
129
  export declare const identityRootStatusSchema: z.ZodType<IdentityRootStatus>;
@@ -49,18 +49,16 @@ export { rotateKeyChallengeResponseSchema, rotateKeyCompleteRequestSchema, rotat
49
49
  export type { RotateKeyChallengeResponse, RotateKeyCompleteRequest, RotateKeyCompleteResponse, } from './keyRotation';
50
50
  export { backupLookupIdSchema, encryptedBackupEnvelopeSchema, backupUploadRequestSchema, backupStatusResponseSchema, } from './keyRecovery';
51
51
  export type { EncryptedBackupEnvelope, BackupUploadRequest, BackupStatusResponse, } from './keyRecovery';
52
- export { WEB_IDENTITY_ENVELOPE_VERSION, WEB_IDENTITY_SECRET_KINDS, webIdentityPublicKeySchema, webauthnCredentialIdSchema, webauthnRpIdSchema, webIdentityWrapSchema, webIdentityEnvelopeSchema, webIdentityEnvelopeUploadSchema, webIdentityHolderSchema, webIdentityEnvelopeResponseSchema, webIdentityEnvelopeProofFieldsSchema, webIdentityEnvelopeActionSchema, webIdentityEnvelopePutSchema, webauthnAssertionResponseSchema, webIdentityEnvelopeEstablishSchema, } from './webIdentityCarrier';
53
52
  export { IDENTITY_PROOF_VERSION, IDENTITY_PROOF_DOMAIN, IDENTITY_PROOF_AUDIENCE, IDENTITY_PROOF_CHALLENGE_TTL_MS, IDENTITY_PROOF_ACTIONS, IDENTITY_PROOF_ACTION_VALUES, IDENTITY_ERROR_CODES, canonicalJson, buildIdentityProofMessage, identityProofSchema, identityProofChallengeRequestSchema, identityProofChallengeResponseSchema, identityRootStatusSchema, } from './identityProof';
54
- export { IDENTITY_RECOVERY_TTL_MS, identityRecoveryChallengeResponseSchema, identityRecoveryStartRequestSchema, identityRecoveryCompleteRequestSchema, } from './identityRecovery';
55
- export type { IdentityRecoveryChallengeResponse, IdentityRecoveryStartRequest, IdentityRecoveryStartResponse, IdentityRecoveryCompleteRequest, } from './identityRecovery';
56
53
  export type { IdentityProofAction, IdentityErrorCode, IdentityProofClaims, IdentityProof, IdentityProofChallengeRequest, IdentityProofChallengeResponse, IdentityRootStatus, } from './identityProof';
57
- export { IDENTITY_MOVE_TTL_MS, IDENTITY_MOVE_STATUSES, IDENTITY_MOVE_QR_PREFIX, identityMoveRevealRequestSchema, buildMoveCommitmentInput, buildMoveSasInput, buildMoveSealPayload, buildMoveCiphertextDigestInput, buildMoveReceiptMessage, identityMoveIdSchema, identityMoveEphemeralKeySchema, identityMoveCreateRequestSchema, identityMoveCreateResponseSchema, identityMoveJoinRequestSchema, identityMoveSealRequestSchema, identityMoveReceiptRequestSchema, identityMoveStateSchema, } from './identityMove';
58
- export type { IdentityMoveStatus, IdentityMoveCreateRequest, IdentityMoveCreateResponse, IdentityMoveJoinRequest, IdentityMoveSealRequest, IdentityMoveReceiptRequest, IdentityMoveRevealRequest, IdentityMoveState, } from './identityMove';
59
- export type { WebIdentityWrap, WebIdentityEnvelope, WebIdentitySecretKind, WebIdentityHolder, WebIdentityEnvelopeAction, WebauthnAssertionResponse, WebIdentityEnvelopeUpload, WebIdentityEnvelopeResponse, WebIdentityEnvelopePut, WebIdentityEnvelopeEstablish, } from './webIdentityCarrier';
60
54
  export { updatePlatformSchema, updateStatusSchema, updateAssetStatusSchema, sha256HexSchema, channelNameSchema, runtimeVersionSchema, rolloutPercentSchema, assetInitItemSchema, assetInitRequestSchema, assetUploadTicketSchema, assetInitResponseSchema, assetCompleteRequestSchema, assetCompleteResultItemSchema, assetCompleteResponseSchema, updateAssetRefSchema, createUpdateRequestSchema, updateSchema, createUpdateResponseSchema, rollbackToEmbeddedEntrySchema, channelSchema, channelListResponseSchema, updateListResponseSchema, rollbackRequestSchema, rollbackToEmbeddedRequestSchema, promoteRequestSchema, updateRolloutPatchSchema, } from './updates';
61
55
  export type { UpdatePlatform, UpdateStatus, UpdateAssetStatus, AssetInitItem, AssetInitRequest, AssetUploadTicket, AssetInitResponse, AssetCompleteRequest, AssetCompleteResultItem, AssetCompleteResponse, UpdateAssetRef, CreateUpdateRequest, Update, CreateUpdateResponse, RollbackToEmbeddedEntry, Channel, ChannelListResponse, UpdateListResponse, RollbackRequest, RollbackToEmbeddedRequest, PromoteRequest, UpdateRolloutPatch, } from './updates';
62
- export { webauthnRegisterOptionsRequestSchema, webauthnLoginOptionsRequestSchema, webauthnRegisterVerifyRequestSchema, webauthnLoginVerifyRequestSchema, } from './webauthn';
63
- export type { WebauthnRegisterOptionsRequest, WebauthnLoginOptionsRequest, WebauthnRegisterVerifyRequest, WebauthnLoginVerifyRequest, } from './webauthn';
56
+ export { webauthnRegisterOptionsRequestSchema, webauthnLoginOptionsRequestSchema, webauthnRegisterVerifyRequestSchema, webauthnLoginVerifyRequestSchema, webauthnCredentialIdSchema, webauthnAssertionResponseSchema, } from './webauthn';
57
+ export type { WebauthnRegisterOptionsRequest, WebauthnLoginOptionsRequest, WebauthnRegisterVerifyRequest, WebauthnLoginVerifyRequest, WebauthnAssertionResponse, } from './webauthn';
58
+ export { EMAIL_VERIFICATION_PURPOSES, EMAIL_CODE_LENGTH, EMAIL_CODE_TTL_MS, EMAIL_CODE_MAX_ATTEMPTS, EMAIL_TICKET_TTL_MS, EMAIL_VERIFICATION_ERROR_CODES, emailAddressSchema, emailTicketSchema, emailVerificationStartRequestSchema, emailVerificationStartResponseSchema, emailVerificationConfirmRequestSchema, emailVerificationConfirmResponseSchema, } from './accountEmail';
59
+ export { IDENTITY_LINK_STATUSES, IDENTITY_LINK_QR_PREFIX, identityLinkIdSchema, buildIdentityLinkQrPayload, parseIdentityLinkQrPayload, identityLinkCreateResponseSchema, identityLinkStateSchema, identityLinkProofRequestSchema, identityLinkOptionsRequestSchema, identityLinkCompleteRequestSchema, } from './identityLink';
60
+ export type { IdentityLinkStatus, IdentityLinkCreateResponse, IdentityLinkState, IdentityLinkProofRequest, IdentityLinkOptionsRequest, IdentityLinkCompleteRequest, } from './identityLink';
61
+ export type { EmailVerificationPurpose, EmailVerificationStartRequest, EmailVerificationStartResponse, EmailVerificationConfirmRequest, EmailVerificationConfirmResponse, EmailVerificationErrorCode, } from './accountEmail';
64
62
  export { transparencyCheckpointSignatureSchema, transparencyAnchorSchema, transparencyCheckpointSchema, transparencyInclusionProofSchema, transparencyCheckpointListSchema, } from './transparency';
65
63
  export type { TransparencyCheckpointSignature, TransparencyAnchor, TransparencyCheckpoint, TransparencyInclusionProof, TransparencyCheckpointList, } from './transparency';
66
64
  export { INFERENCE_CONTRACT_VERSION, } from './inference/version';