@oxy.so/contracts 2.0.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 (53) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/accountEmail.js +83 -0
  3. package/dist/cjs/federationInstanceFetch.js +44 -0
  4. package/dist/cjs/identityLink.js +89 -0
  5. package/dist/cjs/identityProof.js +6 -29
  6. package/dist/cjs/index.js +36 -49
  7. package/dist/cjs/linkedAccounts.js +34 -1
  8. package/dist/cjs/notifications.js +20 -1
  9. package/dist/cjs/webauthn.js +50 -21
  10. package/dist/esm/.tsbuildinfo +1 -1
  11. package/dist/esm/accountEmail.js +80 -0
  12. package/dist/esm/federationInstanceFetch.js +41 -0
  13. package/dist/esm/identityLink.js +84 -0
  14. package/dist/esm/identityProof.js +6 -29
  15. package/dist/esm/index.js +8 -10
  16. package/dist/esm/linkedAccounts.js +33 -0
  17. package/dist/esm/notifications.js +19 -0
  18. package/dist/esm/webauthn.js +49 -20
  19. package/dist/types/.tsbuildinfo +1 -1
  20. package/dist/types/accountEmail.d.ts +98 -0
  21. package/dist/types/accountGraph.d.ts +4 -4
  22. package/dist/types/agency.d.ts +2 -2
  23. package/dist/types/deviceSession.d.ts +4 -4
  24. package/dist/types/externalIdentity.d.ts +8 -8
  25. package/dist/types/federationInstanceFetch.d.ts +63 -0
  26. package/dist/types/identityLink.d.ts +210 -0
  27. package/dist/types/identityProof.d.ts +15 -42
  28. package/dist/types/index.d.ts +7 -8
  29. package/dist/types/inference/accountBilling.d.ts +2 -2
  30. package/dist/types/inference/aliaModelRelease.d.ts +8 -8
  31. package/dist/types/inference/embeddings.d.ts +16 -16
  32. package/dist/types/inference/errors.d.ts +8 -8
  33. package/dist/types/inference/inbox.d.ts +8 -8
  34. package/dist/types/inference/modelDocumentation.d.ts +8 -8
  35. package/dist/types/inference/providerConnection.d.ts +20 -20
  36. package/dist/types/inference/request.d.ts +16 -16
  37. package/dist/types/inference/streamEvents.d.ts +20 -20
  38. package/dist/types/keyRecovery.d.ts +4 -4
  39. package/dist/types/linkedAccounts.d.ts +33 -0
  40. package/dist/types/notifications.d.ts +26 -0
  41. package/dist/types/sessionStatus.d.ts +2 -2
  42. package/dist/types/userResponse.d.ts +4 -4
  43. package/dist/types/webauthn.d.ts +102 -214
  44. package/package.json +1 -1
  45. package/dist/cjs/identityMove.js +0 -156
  46. package/dist/cjs/identityRecovery.js +0 -51
  47. package/dist/cjs/webIdentityCarrier.js +0 -181
  48. package/dist/esm/identityMove.js +0 -148
  49. package/dist/esm/identityRecovery.js +0 -48
  50. package/dist/esm/webIdentityCarrier.js +0 -178
  51. package/dist/types/identityMove.d.ts +0 -185
  52. package/dist/types/identityRecovery.d.ts +0 -246
  53. package/dist/types/webIdentityCarrier.d.ts +0 -1130
@@ -12,10 +12,39 @@
12
12
  * create a second, drift-prone definition of a shape we do not own.
13
13
  */
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.webauthnLoginVerifyRequestSchema = exports.webauthnRegisterVerifyRequestSchema = exports.webauthnLoginOptionsRequestSchema = exports.webauthnRegisterOptionsRequestSchema = void 0;
15
+ exports.webauthnLoginVerifyRequestSchema = exports.webauthnRegisterVerifyRequestSchema = exports.webauthnLoginOptionsRequestSchema = exports.webauthnRegisterOptionsRequestSchema = exports.webauthnAssertionResponseSchema = exports.webauthnCredentialIdSchema = void 0;
16
16
  const zod_1 = require("zod");
17
- const identityProof_1 = require("./identityProof");
18
- const webIdentityCarrier_1 = require("./webIdentityCarrier");
17
+ const accountEmail_1 = require("./accountEmail");
18
+ /** A WebAuthn credential id, base64url as the browser reports it. */
19
+ exports.webauthnCredentialIdSchema = zod_1.z
20
+ .string()
21
+ .trim()
22
+ .min(16)
23
+ .max(1024)
24
+ .regex(/^[A-Za-z0-9_-]+$/, 'credentialId must be base64url');
25
+ /**
26
+ * A WebAuthn assertion by one of the account's EXISTING passkeys over a server
27
+ * challenge — the fresh use of the factor the account already has (linking
28
+ * Commons to a passkey account, deleting a passkey account). The API verifies
29
+ * it with `@simplewebauthn/server`; this only bounds its shape.
30
+ */
31
+ exports.webauthnAssertionResponseSchema = zod_1.z
32
+ .object({
33
+ id: exports.webauthnCredentialIdSchema,
34
+ rawId: zod_1.z.string().min(1).max(2048),
35
+ type: zod_1.z.literal('public-key'),
36
+ response: zod_1.z
37
+ .object({
38
+ clientDataJSON: zod_1.z.string().min(1).max(8192),
39
+ authenticatorData: zod_1.z.string().min(1).max(8192),
40
+ signature: zod_1.z.string().min(1).max(2048),
41
+ userHandle: zod_1.z.string().max(2048).optional(),
42
+ })
43
+ .passthrough(),
44
+ clientExtensionResults: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
45
+ authenticatorAttachment: zod_1.z.string().optional(),
46
+ })
47
+ .passthrough();
19
48
  /**
20
49
  * Device-session options shared by every first-party sign-in body
21
50
  * (`deviceName`/`deviceFingerprint`). Mirrors what
@@ -36,13 +65,16 @@ const deviceSessionEnvelope = {
36
65
  deviceFingerprint: zod_1.z.string().trim().min(1).max(256).optional(),
37
66
  };
38
67
  /**
39
- * `POST /webauthn/register/options` — request registration options. With a bearer
40
- * token the caller links a passkey to their signed-in account and `username` is
41
- * ignored; without one it is a prospective signup and `username` is the desired
42
- * (not-yet-created) handle.
68
+ * `POST /webauthn/register/options` — request registration options. Three flows:
69
+ *
70
+ * - a bearer: the caller adds a passkey to their signed-in account;
71
+ * - `recoveryTicket` (no bearer): a new passkey for the account a recovery code
72
+ * was confirmed for (`POST /auth/email/verify/confirm`, purpose `recovery`);
73
+ * - `username` (no bearer): a prospective sign-up; the handle is not created yet.
43
74
  */
44
75
  exports.webauthnRegisterOptionsRequestSchema = zod_1.z.object({
45
76
  username: zod_1.z.string().trim().min(1).max(60).optional(),
77
+ recoveryTicket: accountEmail_1.emailTicketSchema.optional(),
46
78
  });
47
79
  /**
48
80
  * `POST /webauthn/login/options` — request authentication options. When
@@ -56,23 +88,20 @@ exports.webauthnLoginOptionsRequestSchema = zod_1.z.object({
56
88
  /**
57
89
  * `POST /webauthn/register/verify` — the outer envelope. The browser
58
90
  * `RegistrationResponseJSON` travels alongside these fields under `response` and
59
- * is validated by `@simplewebauthn/server`, not here. `username` is required only
60
- * for the prospective-signup branch (no bearer); the linking branch ignores it.
91
+ * is validated by `@simplewebauthn/server`, not here.
92
+ *
93
+ * - Sign-up (no bearer, ADR 0029 D3): `username`, the recovery `email` and the
94
+ * `emailTicket` its code was confirmed with. The account is created with the
95
+ * passkey and that verified email, and no key.
96
+ * - Recovery (no bearer): `recoveryTicket`; the passkey is added to its account
97
+ * and a session minted.
98
+ * - A bearer: the passkey is added to the signed-in account.
61
99
  */
62
100
  exports.webauthnRegisterVerifyRequestSchema = zod_1.z.object({
63
101
  username: zod_1.z.string().trim().min(1).max(60).optional(),
64
- /**
65
- * Sign-up only (ADR 0024 D4): the account's root, created on the holder BEFORE
66
- * this request — sealed under the passkey being registered — and a root proof
67
- * (`enroll_identity`) whose challenge is the registration challenge. The
68
- * account, passkey, root and envelope are then created in one transaction.
69
- */
70
- identity: zod_1.z
71
- .object({
72
- envelope: webIdentityCarrier_1.webIdentityEnvelopeSchema,
73
- proof: identityProof_1.identityProofSchema,
74
- })
75
- .optional(),
102
+ email: accountEmail_1.emailAddressSchema.optional(),
103
+ emailTicket: accountEmail_1.emailTicketSchema.optional(),
104
+ recoveryTicket: accountEmail_1.emailTicketSchema.optional(),
76
105
  ...deviceSessionEnvelope,
77
106
  });
78
107
  /**