@oxy.so/contracts 6.11.0 → 6.13.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 (40) hide show
  1. package/dist/cjs/appAssertions.js +31 -2
  2. package/dist/cjs/client/appAssertions.js +10 -2
  3. package/dist/cjs/client/identityKeyHistory.js +15 -0
  4. package/dist/cjs/client/index.js +15 -4
  5. package/dist/cjs/client/platformSession.js +61 -0
  6. package/dist/cjs/client/userResponse.js +15 -1
  7. package/dist/cjs/identityKeyHistory.js +30 -0
  8. package/dist/cjs/index.js +19 -14
  9. package/dist/cjs/platformSession.js +104 -0
  10. package/dist/cjs/signIn.js +12 -2
  11. package/dist/cjs/userResponse.js +3 -1
  12. package/dist/esm/appAssertions.js +30 -1
  13. package/dist/esm/client/appAssertions.js +10 -2
  14. package/dist/esm/client/identityKeyHistory.js +12 -0
  15. package/dist/esm/client/index.js +3 -0
  16. package/dist/esm/client/platformSession.js +58 -0
  17. package/dist/esm/client/userResponse.js +14 -0
  18. package/dist/esm/identityKeyHistory.js +27 -0
  19. package/dist/esm/index.js +4 -1
  20. package/dist/esm/platformSession.js +97 -0
  21. package/dist/esm/signIn.js +12 -2
  22. package/dist/esm/userResponse.js +3 -1
  23. package/dist/types/appAssertions.d.ts +40 -1
  24. package/dist/types/client/appAssertions.d.ts +11 -4
  25. package/dist/types/client/identityKeyHistory.d.ts +13 -0
  26. package/dist/types/client/index.d.ts +6 -0
  27. package/dist/types/client/platformSession.d.ts +50 -0
  28. package/dist/types/client/userResponse.d.ts +7 -0
  29. package/dist/types/identityKeyHistory.d.ts +22 -0
  30. package/dist/types/index.d.ts +5 -1
  31. package/dist/types/inference/embeddings.d.ts +4 -4
  32. package/dist/types/inference/errors.d.ts +4 -4
  33. package/dist/types/inference/inbox.d.ts +2 -2
  34. package/dist/types/inference/realtime.d.ts +4 -4
  35. package/dist/types/inference/streamEvents.d.ts +4 -4
  36. package/dist/types/oxyRecordTypes.d.ts +1 -1
  37. package/dist/types/platformSession.d.ts +129 -0
  38. package/dist/types/signIn.d.ts +23 -2
  39. package/dist/types/userResponse.d.ts +18 -0
  40. package/package.json +2 -2
@@ -29,6 +29,13 @@ export declare const appAssertionPlatformSchema: z.ZodEnum<{
29
29
  web: "web";
30
30
  android: "android";
31
31
  ios: "ios";
32
+ oxyos: "oxyos";
33
+ astro: "astro";
34
+ }>;
35
+ /** A platform that holds the Oxy session for the applications it runs (ADR 0058). */
36
+ export declare const platformHostSchema: z.ZodEnum<{
37
+ oxyos: "oxyos";
38
+ astro: "astro";
32
39
  }>;
33
40
  export declare const appAssertionErrorCodeSchema: z.ZodEnum<{
34
41
  application_unavailable: "application_unavailable";
@@ -44,6 +51,7 @@ export declare const appAssertionErrorCodeSchema: z.ZodEnum<{
44
51
  attestation_invalid: "attestation_invalid";
45
52
  assertion_invalid: "assertion_invalid";
46
53
  signing_unavailable: "signing_unavailable";
54
+ app_token_mismatch: "app_token_mismatch";
47
55
  }>;
48
56
  /** True for an exact origin: `https:`, no path, query, fragment or credentials, in canonical form. */
49
57
  export declare function isExactHttpsOrigin(value: string): boolean;
@@ -57,6 +65,8 @@ export declare const signingCertSha256Schema: z.ZodString;
57
65
  export declare const appleTeamIdSchema: z.ZodString;
58
66
  /** An Apple bundle id. */
59
67
  export declare const appleBundleIdSchema: z.ZodString;
68
+ /** An OxyOS desktop entry id (`so.oxy.dropsea`), the id OxyOS launches the application by. */
69
+ export declare const oxyosDesktopEntryIdSchema: z.ZodString;
60
70
  export declare const applicationAndroidRecognitionSchema: z.ZodObject<{
61
71
  packageName: z.ZodString;
62
72
  signingCertSha256: z.ZodArray<z.ZodString>;
@@ -68,6 +78,15 @@ export declare const applicationIosRecognitionSchema: z.ZodObject<{
68
78
  /**
69
79
  * What Oxy staff write for an application: the whole declaration, replaced at
70
80
  * once. `null` and `[]` declare nothing for that platform.
81
+ *
82
+ * ADR 0058 adds two fields a writer may omit, and an omitted one is left as
83
+ * the registry holds it (a writer that predates them cannot erase them):
84
+ *
85
+ * - `platformHost`: this application IS a platform that holds the Oxy session
86
+ * (OxyOS, Astro). Its public client id is the one a platform's own sign-in
87
+ * names (`platformClient`), and only an Oxy application may declare it.
88
+ * - `oxyosDesktopEntryIds`: the OxyOS desktop entry ids that launch this
89
+ * application, each naming one application only, as a web origin does.
71
90
  */
72
91
  export declare const applicationRecognitionWriteSchema: z.ZodObject<{
73
92
  webOrigins: z.ZodArray<z.ZodString>;
@@ -79,6 +98,11 @@ export declare const applicationRecognitionWriteSchema: z.ZodObject<{
79
98
  teamId: z.ZodString;
80
99
  bundleId: z.ZodString;
81
100
  }, z.core.$strict>>;
101
+ platformHost: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
102
+ oxyos: "oxyos";
103
+ astro: "astro";
104
+ }>>>;
105
+ oxyosDesktopEntryIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
82
106
  }, z.core.$strict>;
83
107
  /** An application's recognition as the registry holds it; `updatedAt` is `null` when none was written. */
84
108
  export declare const applicationRecognitionSchema: z.ZodObject<{
@@ -92,6 +116,11 @@ export declare const applicationRecognitionSchema: z.ZodObject<{
92
116
  bundleId: z.ZodString;
93
117
  }, z.core.$strict>>;
94
118
  applicationId: z.ZodString;
119
+ platformHost: z.ZodNullable<z.ZodEnum<{
120
+ oxyos: "oxyos";
121
+ astro: "astro";
122
+ }>>;
123
+ oxyosDesktopEntryIds: z.ZodArray<z.ZodString>;
95
124
  updatedAt: z.ZodNullable<z.ZodString>;
96
125
  }, z.core.$strict>;
97
126
  /** `POST /apps/assertions/challenge`: a single-use challenge for a device proof. */
@@ -134,11 +163,19 @@ export declare const appAttestKeyResponseSchema: z.ZodObject<{
134
163
  * `POST /apps/assertions`. The body names the application and the platform;
135
164
  * the proof is the platform's: none on the web (the browser's `Origin` is), a
136
165
  * Play Integrity token on Android, an App Attest assertion on iOS, each over a
137
- * challenge minted for `assertion`.
166
+ * challenge minted for `assertion`. On `oxyos` and `astro` the bearer is the
167
+ * proof: an application token that platform minted for this application
168
+ * (ADR 0058).
138
169
  */
139
170
  export declare const appAssertionRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
140
171
  applicationId: z.ZodString;
141
172
  platform: z.ZodLiteral<"web">;
173
+ }, z.core.$strict>, z.ZodObject<{
174
+ applicationId: z.ZodString;
175
+ platform: z.ZodLiteral<"oxyos">;
176
+ }, z.core.$strict>, z.ZodObject<{
177
+ applicationId: z.ZodString;
178
+ platform: z.ZodLiteral<"astro">;
142
179
  }, z.core.$strict>, z.ZodObject<{
143
180
  applicationId: z.ZodString;
144
181
  platform: z.ZodLiteral<"android">;
@@ -163,6 +200,8 @@ export declare const appAssertionResponseSchema: z.ZodObject<{
163
200
  web: "web";
164
201
  android: "android";
165
202
  ios: "ios";
203
+ oxyos: "oxyos";
204
+ astro: "astro";
166
205
  }>;
167
206
  expiresAt: z.ZodString;
168
207
  }, z.core.$strict>;
@@ -9,8 +9,12 @@
9
9
  *
10
10
  * Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
11
11
  */
12
- /** How an app proves itself: the browser's origin, Play Integrity, or App Attest. */
13
- export declare const APP_ASSERTION_PLATFORMS: readonly ["web", "android", "ios"];
12
+ /**
13
+ * How an app proves itself: the browser's origin, Play Integrity, App Attest,
14
+ * or (`oxyos`, `astro`) an application token the platform holding the session
15
+ * minted for it (ADR 0058), whose bearer is the proof.
16
+ */
17
+ export declare const APP_ASSERTION_PLATFORMS: readonly ["web", "android", "ios", "oxyos", "astro"];
14
18
  /**
15
19
  * What a device challenge is spent on: an assertion, or (iOS only) registering
16
20
  * an App Attest key. A challenge minted for one is refused for the other.
@@ -41,8 +45,11 @@ export declare const OXY_APP_ASSERTION_TTL_SECONDS = 300;
41
45
  * - `attestation_invalid`: the App Attest attestation does not verify.
42
46
  * - `assertion_invalid`: the App Attest assertion does not verify, or its counter did not advance.
43
47
  * - `signing_unavailable`: Oxy cannot sign (503).
48
+ * - `app_token_mismatch`: an `oxyos` or `astro` assertion needs an application token that
49
+ * platform minted for this application; an application token gets an assertion for its own
50
+ * application and platform only.
44
51
  */
45
- export declare const APP_ASSERTION_ERROR_CODES: readonly ["application_unavailable", "session_other_application", "platform_not_registered", "origin_not_registered", "challenge_invalid", "integrity_refused", "integrity_unconfigured", "integrity_unavailable", "attest_key_unknown", "attest_key_exists", "attestation_invalid", "assertion_invalid", "signing_unavailable"];
52
+ export declare const APP_ASSERTION_ERROR_CODES: readonly ["application_unavailable", "session_other_application", "platform_not_registered", "origin_not_registered", "challenge_invalid", "integrity_refused", "integrity_unconfigured", "integrity_unavailable", "attest_key_unknown", "attest_key_exists", "attestation_invalid", "assertion_invalid", "signing_unavailable", "app_token_mismatch"];
46
53
  export declare const appAssertionChallengeResponseCheck: import("./check").Check<{
47
54
  challenge: string;
48
55
  requestHash: string;
@@ -55,6 +62,6 @@ export declare const appAttestKeyResponseCheck: import("./check").Check<{
55
62
  export declare const appAssertionResponseCheck: import("./check").Check<{
56
63
  assertion: string;
57
64
  applicationId: string;
58
- platform: "web" | "android" | "ios";
65
+ platform: "web" | "android" | "ios" | "oxyos" | "astro";
59
66
  expiresAt: string;
60
67
  }>;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * A personal account's key history (`GET /identity/key-history`), without Zod.
3
+ * Schema: `../identityKeyHistory.ts`.
4
+ *
5
+ * Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
6
+ */
7
+ export declare const identityKeyHistoryCheck: import("./check").Check<{
8
+ publicKey: string | null;
9
+ retired: {
10
+ publicKey: string;
11
+ retiredAt: string;
12
+ }[];
13
+ }>;
@@ -28,6 +28,8 @@ export { signedRecordEnvelopeCheck } from './identity';
28
28
  export { DOMAIN_NAME_MAX_LENGTH, normalizeDomainName } from './domainName';
29
29
  export { deviceActivateResponseCheck, deviceDirectoryCheck, deviceDirectorySyncCheck, } from './deviceDirectory';
30
30
  export { SESSION_ACCOUNTS_CHANGED_EVENT, activeTokenCheck, deviceBackgroundCredentialResponseCheck, deviceContextTokenV1RequestCheck, deviceContextTokenV1ResponseCheck, holderContextEvidenceV1RequestCheck, holderContextEvidenceV1ResponseCheck, deviceJoinCodeResponseCheck, deviceJoinResponseCheck, deviceRegisterResponseCheck, deviceSessionStateCheck, deviceSessionSyncCheck, deviceTokenMintResponseCheck, sessionAccountsChangedEventCheck, } from './deviceSession';
31
+ export { identityKeyHistoryCheck } from './identityKeyHistory';
32
+ export type { IdentityKeyHistory } from '../identityKeyHistory';
31
33
  export { IDENTITY_LINK_QR_PREFIX, IDENTITY_LINK_STATUSES, buildIdentityLinkQrPayload, identityLinkCreateResponseCheck, identityLinkStateCheck, parseIdentityLinkQrPayload, } from './identityLink';
32
34
  export { IDENTITY_ERROR_CODES, IDENTITY_PROOF_ACTIONS, IDENTITY_PROOF_ACTION_VALUES, IDENTITY_PROOF_AUDIENCE, IDENTITY_PROOF_CHALLENGE_TTL_MS, IDENTITY_PROOF_DOMAIN, IDENTITY_PROOF_VERSION, buildIdentityProofMessage, canonicalJson, } from './identityProof';
33
35
  export { ORGANIZATION_ALIAS_KINDS, ORGANIZATION_CLAIM_DECISIONS, ORGANIZATION_CLAIM_STATUSES, ORGANIZATION_ERROR_CODES, ORGANIZATION_NAME_MAX_LENGTH, ORGANIZATION_STATUSES, ORGANIZATION_TYPES, createOrganizationCheck, organizationBatchCheck, organizationCheck, organizationClaimCheck, organizationClaimDetailCheck, organizationClaimInputCheck, organizationClaimListCheck, organizationClaimReviewCheck, organizationCurationResultCheck, organizationExternalCheck, organizationExternalResolutionCheck, organizationImportBatchResultCheck, organizationListCheck, organizationNameCheck, updateOrganizationCheck, } from './organizations';
@@ -40,8 +42,12 @@ export { CONSOLE_TERMS_VERSION, CONSOLE_USE_CASES, type ConsoleUseCaseId, } from
40
42
  export { EMAIL_ACCOUNTS_MAX, EMAIL_SIGNIN_CHOICE_TTL_MS, EMAIL_SIGNIN_LINK_TTL_MS, EMAIL_SIGNIN_LONG_CODE_ALPHABET, EMAIL_SIGNIN_LONG_CODE_LENGTH, PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, REAUTH_ACTIONS, SECOND_FACTOR_CODE_MAX_LENGTH, SIGN_IN_IDENTIFIER_MAX_LENGTH, SIGNIN_SECOND_FACTOR_MAX_ATTEMPTS, SIGNIN_SECOND_FACTOR_TTL_MS, SIGN_IN_ERROR_CODES, TOTP_BACKUP_CODE_COUNT, TOTP_DIGITS, TOTP_PERIOD_SECONDS, emailSignInChooseAccountCheck, emailSignInLinkResponseCheck, emailSignInPendingCheck, emailSignInStartResponseCheck, isEmailSignInChooseAccount, isSecondFactorRequired, normalizeEmailSignInCode, reauthProofCheck, secondFactorRequiredCheck, signInMethodsCheck, totpBackupCodesResponseCheck, totpEnrollResponseCheck, } from './signIn';
41
43
  export { BOT_USERNAME_INVALID_MESSAGE, BOT_USERNAME_SUFFIX, NUMERIC_USERNAME_MESSAGE, RESERVED_USERNAMES, RESERVED_USERNAME_MESSAGE, USERNAME_INVALID_MESSAGE, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, USERNAME_PATTERN_SOURCE, applyBotUsernameSuffix, botUsernameCheck, stripDisallowedUsernameCharacters, usernameCheck, usernameCheckForAccountKind, } from './username';
42
44
  export { userNameCheck, PROFILE_LINKS_MAX, PROFILE_LINK_TITLE_MAX } from './userResponse';
45
+ export { PRONOUNS } from './userResponse';
46
+ export type { Pronouns } from './userResponse';
43
47
  export { CLAIMANT_RELATIONSHIPS, CLOSED_CONTENT_CLAIM_STATES, CONTENT_CLAIM_COUNTER_NOTICE_LIMITS, CONTENT_CLAIM_ERROR_CODES, CONTENT_CLAIM_KINDS, CONTENT_CLAIM_LIMITS, CONTENT_CLAIM_REFERENCE_PATTERN, CONTENT_CLAIM_STATES, COUNTER_NOTICE_STATEMENT_VERSION, COUNTER_NOTICE_STATEMENTS, ERASURE_REQUEST_DEADLINE_DAYS, OPEN_CONTENT_CLAIM_STATES, isErasureRequest, isRightsClaim, } from './contentClaims';
44
48
  export { APP_ASSERTION_CHALLENGE_PURPOSES, APP_ASSERTION_ERROR_CODES, APP_ASSERTION_PLATFORMS, OXY_APP_ASSERTION_AUDIENCE, OXY_APP_ASSERTION_HEADER, OXY_APP_ASSERTION_TTL_SECONDS, OXY_APP_ASSERTION_TYPE, appAssertionChallengeResponseCheck, appAssertionResponseCheck, appAttestKeyResponseCheck, } from './appAssertions';
49
+ export { APP_TOKEN_DEVICE_ACCESS_DENIED, DEVICE_APP_TOKEN_ERROR_CODES, DEVICE_APP_TOKEN_TTL_SECONDS, OXYOS_DESKTOP_ENTRY_ID_PATTERN, PLATFORM_HOSTS, deviceAppTokenResponseCheck, } from './platformSession';
50
+ export type { DeviceAppTokenErrorCode, DeviceAppTokenResponse, PlatformClient, PlatformHost, } from '../platformSession';
45
51
  export { USER_PROFILE_COLORS, USER_PROFILE_COLOR_PRESETS, FREE_USER_PROFILE_COLOR_PRESETS, } from '../profileColors.generated';
46
52
  export * from '../products/one';
47
53
  export { CAMPAIGN_LABEL_MAX_LENGTH, CAMPAIGN_CLICK_ID_MAX_LENGTH, hasCampaignControlCharacters, } from './campaignAttribution';
@@ -0,0 +1,50 @@
1
+ /**
2
+ * A platform that holds the Oxy session (ADR 0058), without Zod. Schemas:
3
+ * `../platformSession.ts`.
4
+ *
5
+ * OxyOS and Astro hold the person's Oxy session themselves, on a PLATFORM
6
+ * CREDENTIAL, and ask Oxy for a short token named for each application they
7
+ * run (`POST /session/device/app-token`). Applications hold no credential.
8
+ *
9
+ * Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
10
+ */
11
+ /** The platforms that hold the Oxy session for the applications they run. */
12
+ export declare const PLATFORM_HOSTS: readonly ["oxyos", "astro"];
13
+ /**
14
+ * An OxyOS desktop entry id (`so.oxy.dropsea`): the reverse-DNS id OxyOS names
15
+ * an application by in its registry and launch records. Lowercase, at least two
16
+ * segments, unique across applications like a web origin.
17
+ */
18
+ export declare const OXYOS_DESKTOP_ENTRY_ID_PATTERN: RegExp;
19
+ /** An application token lives exactly this long (ADR 0058 2.3). */
20
+ export declare const DEVICE_APP_TOKEN_TTL_SECONDS = 300;
21
+ /**
22
+ * Why `POST /session/device/app-token` refused. The API answers `{ error: <code> }`.
23
+ *
24
+ * - `invalid_request` (400): the body is not the contract's.
25
+ * - `browser_not_allowed` (403): the request carries a web `Origin` (or
26
+ * `Sec-Fetch-Site`); only a platform's own native service mints.
27
+ * - `invalid_device_secret` (401): the secret proves no PLATFORM credential of
28
+ * that device. A wrong secret counts toward the device-secret lockout.
29
+ * - `application_not_recognised` (403): the credential is another platform's,
30
+ * or the attestation names no active Oxy application recognised for this
31
+ * platform (an unknown desktop entry id, an origin that is not the
32
+ * application's, auth.oxy.so's application, a third-party application, a
33
+ * `clientId` of another application).
34
+ * - `no_active_session` / `account_not_on_device` (401): as
35
+ * `POST /session/device/token`: nothing live to mint for, or the pinned
36
+ * account is not live on the device.
37
+ */
38
+ export declare const DEVICE_APP_TOKEN_ERROR_CODES: readonly ["invalid_request", "browser_not_allowed", "invalid_device_secret", "application_not_recognised", "no_active_session", "account_not_on_device"];
39
+ /**
40
+ * Every bearer-authenticated `/session/device/*` route answers an application
41
+ * token (one carrying `host`) with `403 { error: APP_TOKEN_DEVICE_ACCESS_DENIED }`:
42
+ * the device is the platform's, never an application's.
43
+ */
44
+ export declare const APP_TOKEN_DEVICE_ACCESS_DENIED = "app_token_device_access_denied";
45
+ export declare const deviceAppTokenResponseCheck: import("./check").Check<{
46
+ accessToken: string;
47
+ expiresAt: string;
48
+ applicationId: string;
49
+ accountId: string;
50
+ }>;
@@ -9,6 +9,13 @@ export declare const userNameCheck: import("./check").Check<UserNameResponse>;
9
9
  * Most links a profile may show. Enforced by the server on every write that
10
10
  * carries `linksMetadata` (see `user.service.ts`), and by the editor.
11
11
  */
12
+ /**
13
+ * How an account names its pronouns: one of a closed list, never free text. A
14
+ * federated account's source value is mapped onto it; a value that maps to none
15
+ * of these is `unspecified`.
16
+ */
17
+ export declare const PRONOUNS: readonly ["unspecified", "he_him", "she_her", "they_them", "he_they", "she_they", "it_its"];
18
+ export type Pronouns = (typeof PRONOUNS)[number];
12
19
  export declare const PROFILE_LINKS_MAX = 10;
13
20
  /**
14
21
  * Longest title an editor may give a profile link, in characters. Not enforced
@@ -0,0 +1,22 @@
1
+ /**
2
+ * A personal account's key history: `GET /identity/key-history`.
3
+ *
4
+ * The current root (`null` without one) and every root a rotation replaced,
5
+ * oldest first. Commons reads it to accept a previous recovery phrase only when
6
+ * it derives a key that WAS this account's root, and keeps that key to spend
7
+ * what it received. A retired root is never any account's again (ADR 0061 D2).
8
+ *
9
+ * Keys are canonical: uncompressed, lowercase (`04` + 128 hex). No private key
10
+ * or phrase crosses this contract.
11
+ *
12
+ * The Zod-free check is `./client/identityKeyHistory.ts`.
13
+ */
14
+ import { z } from 'zod';
15
+ export declare const identityKeyHistorySchema: z.ZodObject<{
16
+ publicKey: z.ZodNullable<z.ZodString>;
17
+ retired: z.ZodArray<z.ZodObject<{
18
+ publicKey: z.ZodString;
19
+ retiredAt: z.ZodString;
20
+ }, z.core.$strict>>;
21
+ }, z.core.$strict>;
22
+ export type IdentityKeyHistory = z.infer<typeof identityKeyHistorySchema>;
@@ -18,7 +18,8 @@ export type { AvatarCharacter } from './avatarCharacter';
18
18
  export { ACCOUNT_ACTOR_NATURES, ACCOUNT_SUBJECT_CONTRACT_VERSION, FINANCIAL_EFFECT_DIRECTIONS, KIND_INDEPENDENT_ACCOUNT_DIMENSIONS, accountActorChainFromSession, accountActorChainSchema, accountActorNatureSchema, accountKindActorNature, accountKindActsAsItself, attributeFinancialEffect, financialEffectAttributionSchema, } from './accountSubject';
19
19
  export type { AccountActorChain, AccountActorNature, FinancialEffectAttribution, FinancialEffectDirection, KindIndependentAccountDimension, } from './accountSubject';
20
20
  export { usernameSchema, usernameSchemaForAccountKind, isValidUsername, stripDisallowedUsernameCharacters, applyBotUsernameSuffix, USERNAME_MIN_LENGTH, USERNAME_MAX_LENGTH, USERNAME_INVALID_MESSAGE, BOT_USERNAME_INVALID_MESSAGE, RESERVED_USERNAME_MESSAGE, NUMERIC_USERNAME_MESSAGE, } from './username';
21
- export { PROFILE_LINKS_MAX, PROFILE_LINK_TITLE_MAX } from './client/userResponse';
21
+ export { PRONOUNS, PROFILE_LINKS_MAX, PROFILE_LINK_TITLE_MAX } from './client/userResponse';
22
+ export type { Pronouns } from './client/userResponse';
22
23
  export { userNameSchema, userRelationshipSchema, themePreferenceSchema, dateOfBirthSchema, userResponseSchema, userProfileUpdateSchema, currentUserResponseSchema, deviceLinkedSessionSchema, deviceLinkedSessionsResponseSchema, resolveUserId, safeParseContract, } from './userResponse';
23
24
  export type { UserNameResponse, UserRelationship, ThemePreference, UserResponse, UserProfileUpdate, CurrentUserResponseContract, DeviceLinkedSessionResponse, DeviceLinkedSessionsResponseContract, } from './userResponse';
24
25
  export { applicationTypeSchema, publicApplicationSchema, sessionStatusSchema, } from './sessionStatus';
@@ -56,6 +57,8 @@ export { loginResultSchema, } from './deviceBoot';
56
57
  export type { LoginSessionResult, LoginResult, SecurityAlert, SecurityAlertAnomaly, } from './deviceBoot';
57
58
  export { rotateKeyChallengeResponseSchema, rotateKeyCompleteRequestSchema, rotateKeyCompleteResponseSchema, } from './keyRotation';
58
59
  export type { RotateKeyChallengeResponse, RotateKeyCompleteRequest, RotateKeyCompleteResponse, } from './keyRotation';
60
+ export { identityKeyHistorySchema } from './identityKeyHistory';
61
+ export type { IdentityKeyHistory } from './identityKeyHistory';
59
62
  export { backupLookupIdSchema, encryptedBackupEnvelopeSchema, backupUploadRequestSchema, backupStatusResponseSchema, } from './keyRecovery';
60
63
  export type { EncryptedBackupEnvelope, BackupUploadRequest, BackupStatusResponse, } from './keyRecovery';
61
64
  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';
@@ -138,6 +141,7 @@ export * from './serviceToken';
138
141
  export * from './applicationRoles';
139
142
  export * from './contentClaims';
140
143
  export * from './appAssertions';
144
+ export * from './platformSession';
141
145
  export * from './products/one';
142
146
  export { USER_PROFILE_COLORS, USER_PROFILE_COLOR_PRESETS, FREE_USER_PROFILE_COLOR_PRESETS, } from './profileColors.generated';
143
147
  export { utf16MinLength, utf16MaxLength, utf16Length, isoDateTime, urlCheck, } from './stringChecks';
@@ -30,8 +30,8 @@ export declare const embeddingFailureSchema: z.ZodObject<{
30
30
  rate_limited: "rate_limited";
31
31
  internal_error: "internal_error";
32
32
  service_unavailable: "service_unavailable";
33
- cancelled: "cancelled";
34
33
  invalid_request: "invalid_request";
34
+ cancelled: "cancelled";
35
35
  authentication_failed: "authentication_failed";
36
36
  permission_denied: "permission_denied";
37
37
  insufficient_scope: "insufficient_scope";
@@ -63,8 +63,8 @@ export declare const embeddingFailureSchema: z.ZodObject<{
63
63
  param: z.ZodOptional<z.ZodString>;
64
64
  upstreamCategory: z.ZodOptional<z.ZodEnum<{
65
65
  unknown: "unknown";
66
- authentication: "authentication";
67
66
  invalid_request: "invalid_request";
67
+ authentication: "authentication";
68
68
  rate_limit: "rate_limit";
69
69
  quota: "quota";
70
70
  timeout: "timeout";
@@ -102,8 +102,8 @@ export declare const embeddingResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
102
102
  rate_limited: "rate_limited";
103
103
  internal_error: "internal_error";
104
104
  service_unavailable: "service_unavailable";
105
- cancelled: "cancelled";
106
105
  invalid_request: "invalid_request";
106
+ cancelled: "cancelled";
107
107
  authentication_failed: "authentication_failed";
108
108
  permission_denied: "permission_denied";
109
109
  insufficient_scope: "insufficient_scope";
@@ -135,8 +135,8 @@ export declare const embeddingResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
135
135
  param: z.ZodOptional<z.ZodString>;
136
136
  upstreamCategory: z.ZodOptional<z.ZodEnum<{
137
137
  unknown: "unknown";
138
- authentication: "authentication";
139
138
  invalid_request: "invalid_request";
139
+ authentication: "authentication";
140
140
  rate_limit: "rate_limit";
141
141
  quota: "quota";
142
142
  timeout: "timeout";
@@ -48,8 +48,8 @@ export declare const inferenceErrorCodeSchema: z.ZodEnum<{
48
48
  rate_limited: "rate_limited";
49
49
  internal_error: "internal_error";
50
50
  service_unavailable: "service_unavailable";
51
- cancelled: "cancelled";
52
51
  invalid_request: "invalid_request";
52
+ cancelled: "cancelled";
53
53
  authentication_failed: "authentication_failed";
54
54
  permission_denied: "permission_denied";
55
55
  insufficient_scope: "insufficient_scope";
@@ -138,8 +138,8 @@ export declare const safeErrorTextSchema: z.ZodString;
138
138
  */
139
139
  export declare const upstreamErrorCategorySchema: z.ZodEnum<{
140
140
  unknown: "unknown";
141
- authentication: "authentication";
142
141
  invalid_request: "invalid_request";
142
+ authentication: "authentication";
143
143
  rate_limit: "rate_limit";
144
144
  quota: "quota";
145
145
  timeout: "timeout";
@@ -175,8 +175,8 @@ export declare const inferenceErrorSchema: z.ZodObject<{
175
175
  rate_limited: "rate_limited";
176
176
  internal_error: "internal_error";
177
177
  service_unavailable: "service_unavailable";
178
- cancelled: "cancelled";
179
178
  invalid_request: "invalid_request";
179
+ cancelled: "cancelled";
180
180
  authentication_failed: "authentication_failed";
181
181
  permission_denied: "permission_denied";
182
182
  insufficient_scope: "insufficient_scope";
@@ -208,8 +208,8 @@ export declare const inferenceErrorSchema: z.ZodObject<{
208
208
  param: z.ZodOptional<z.ZodString>;
209
209
  upstreamCategory: z.ZodOptional<z.ZodEnum<{
210
210
  unknown: "unknown";
211
- authentication: "authentication";
212
211
  invalid_request: "invalid_request";
212
+ authentication: "authentication";
213
213
  rate_limit: "rate_limit";
214
214
  quota: "quota";
215
215
  timeout: "timeout";
@@ -146,8 +146,8 @@ export declare const inboxInferenceStreamEventSchema: z.ZodDiscriminatedUnion<[z
146
146
  rate_limited: "rate_limited";
147
147
  internal_error: "internal_error";
148
148
  service_unavailable: "service_unavailable";
149
- cancelled: "cancelled";
150
149
  invalid_request: "invalid_request";
150
+ cancelled: "cancelled";
151
151
  authentication_failed: "authentication_failed";
152
152
  permission_denied: "permission_denied";
153
153
  insufficient_scope: "insufficient_scope";
@@ -179,8 +179,8 @@ export declare const inboxInferenceStreamEventSchema: z.ZodDiscriminatedUnion<[z
179
179
  param: z.ZodOptional<z.ZodString>;
180
180
  upstreamCategory: z.ZodOptional<z.ZodEnum<{
181
181
  unknown: "unknown";
182
- authentication: "authentication";
183
182
  invalid_request: "invalid_request";
183
+ authentication: "authentication";
184
184
  rate_limit: "rate_limit";
185
185
  quota: "quota";
186
186
  timeout: "timeout";
@@ -1468,8 +1468,8 @@ export declare const realtimeErrorEventSchema: z.ZodObject<{
1468
1468
  rate_limited: "rate_limited";
1469
1469
  internal_error: "internal_error";
1470
1470
  service_unavailable: "service_unavailable";
1471
- cancelled: "cancelled";
1472
1471
  invalid_request: "invalid_request";
1472
+ cancelled: "cancelled";
1473
1473
  authentication_failed: "authentication_failed";
1474
1474
  permission_denied: "permission_denied";
1475
1475
  insufficient_scope: "insufficient_scope";
@@ -1501,8 +1501,8 @@ export declare const realtimeErrorEventSchema: z.ZodObject<{
1501
1501
  param: z.ZodOptional<z.ZodString>;
1502
1502
  upstreamCategory: z.ZodOptional<z.ZodEnum<{
1503
1503
  unknown: "unknown";
1504
- authentication: "authentication";
1505
1504
  invalid_request: "invalid_request";
1505
+ authentication: "authentication";
1506
1506
  rate_limit: "rate_limit";
1507
1507
  quota: "quota";
1508
1508
  timeout: "timeout";
@@ -2040,8 +2040,8 @@ export declare const realtimeServerEventSchema: z.ZodDiscriminatedUnion<[z.ZodOb
2040
2040
  rate_limited: "rate_limited";
2041
2041
  internal_error: "internal_error";
2042
2042
  service_unavailable: "service_unavailable";
2043
- cancelled: "cancelled";
2044
2043
  invalid_request: "invalid_request";
2044
+ cancelled: "cancelled";
2045
2045
  authentication_failed: "authentication_failed";
2046
2046
  permission_denied: "permission_denied";
2047
2047
  insufficient_scope: "insufficient_scope";
@@ -2073,8 +2073,8 @@ export declare const realtimeServerEventSchema: z.ZodDiscriminatedUnion<[z.ZodOb
2073
2073
  param: z.ZodOptional<z.ZodString>;
2074
2074
  upstreamCategory: z.ZodOptional<z.ZodEnum<{
2075
2075
  unknown: "unknown";
2076
- authentication: "authentication";
2077
2076
  invalid_request: "invalid_request";
2077
+ authentication: "authentication";
2078
2078
  rate_limit: "rate_limit";
2079
2079
  quota: "quota";
2080
2080
  timeout: "timeout";
@@ -256,8 +256,8 @@ export declare const inferenceStreamErrorEventSchema: z.ZodObject<{
256
256
  rate_limited: "rate_limited";
257
257
  internal_error: "internal_error";
258
258
  service_unavailable: "service_unavailable";
259
- cancelled: "cancelled";
260
259
  invalid_request: "invalid_request";
260
+ cancelled: "cancelled";
261
261
  authentication_failed: "authentication_failed";
262
262
  permission_denied: "permission_denied";
263
263
  insufficient_scope: "insufficient_scope";
@@ -289,8 +289,8 @@ export declare const inferenceStreamErrorEventSchema: z.ZodObject<{
289
289
  param: z.ZodOptional<z.ZodString>;
290
290
  upstreamCategory: z.ZodOptional<z.ZodEnum<{
291
291
  unknown: "unknown";
292
- authentication: "authentication";
293
292
  invalid_request: "invalid_request";
293
+ authentication: "authentication";
294
294
  rate_limit: "rate_limit";
295
295
  quota: "quota";
296
296
  timeout: "timeout";
@@ -470,8 +470,8 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodO
470
470
  rate_limited: "rate_limited";
471
471
  internal_error: "internal_error";
472
472
  service_unavailable: "service_unavailable";
473
- cancelled: "cancelled";
474
473
  invalid_request: "invalid_request";
474
+ cancelled: "cancelled";
475
475
  authentication_failed: "authentication_failed";
476
476
  permission_denied: "permission_denied";
477
477
  insufficient_scope: "insufficient_scope";
@@ -503,8 +503,8 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodO
503
503
  param: z.ZodOptional<z.ZodString>;
504
504
  upstreamCategory: z.ZodOptional<z.ZodEnum<{
505
505
  unknown: "unknown";
506
- authentication: "authentication";
507
506
  invalid_request: "invalid_request";
507
+ authentication: "authentication";
508
508
  rate_limit: "rate_limit";
509
509
  quota: "quota";
510
510
  timeout: "timeout";
@@ -54,8 +54,8 @@
54
54
  */
55
55
  import { z } from 'zod';
56
56
  export declare const oxySignedRecordTypeSchema: z.ZodEnum<{
57
- identity: "identity";
58
57
  credential: "credential";
58
+ identity: "identity";
59
59
  profile: "profile";
60
60
  reputation_attestation: "reputation_attestation";
61
61
  real_life_attestation: "real_life_attestation";
@@ -0,0 +1,129 @@
1
+ /**
2
+ * A platform that holds the Oxy session (ADR 0058).
3
+ *
4
+ * OxyOS (`oxyos-accountd`) and Astro hold the person's Oxy session on a
5
+ * PLATFORM CREDENTIAL: a device holder credential issued to the platform's own
6
+ * sign-in, the one that names it with {@link platformClientSchema}
7
+ * (`POST /auth/signin/password`, completed by `POST /auth/signin/second-factor`).
8
+ * Applications they run hold nothing; the platform asks
9
+ * `POST /session/device/app-token` for a five-minute token named for each one
10
+ * (`azp`, and the `host` claim naming the platform and its credential).
11
+ *
12
+ * The Zod-free half (vocabularies, the response check) is
13
+ * `./client/platformSession.ts`.
14
+ */
15
+ import { z } from 'zod';
16
+ import { APP_TOKEN_DEVICE_ACCESS_DENIED, DEVICE_APP_TOKEN_ERROR_CODES, DEVICE_APP_TOKEN_TTL_SECONDS, OXYOS_DESKTOP_ENTRY_ID_PATTERN, PLATFORM_HOSTS } from './client/platformSession';
17
+ export { APP_TOKEN_DEVICE_ACCESS_DENIED, DEVICE_APP_TOKEN_ERROR_CODES, DEVICE_APP_TOKEN_TTL_SECONDS, OXYOS_DESKTOP_ENTRY_ID_PATTERN, PLATFORM_HOSTS, };
18
+ /**
19
+ * Names the platform on its own password sign-in, and on the second factor
20
+ * completing it. Honoured only when the request has NO web `Origin` and
21
+ * `clientId` is a live public client id of an active Oxy application whose
22
+ * registry entry declares `platformHost` equal to `platform`; anything else is
23
+ * refused with the ordinary invalid-request answer before any account lookup or
24
+ * password work. When honoured, the device credential the sign-in returns is a
25
+ * platform credential, and a credential the sign-in's `device` proof presented
26
+ * is retired.
27
+ */
28
+ export declare const platformClientSchema: z.ZodObject<{
29
+ platform: z.ZodEnum<{
30
+ oxyos: "oxyos";
31
+ astro: "astro";
32
+ }>;
33
+ clientId: z.ZodString;
34
+ }, z.core.$strict>;
35
+ /**
36
+ * Which application the token is for, as the platform vouches for it:
37
+ *
38
+ * - `{ platform: 'oxyos', desktopEntryId }`: an application OxyOS launched,
39
+ * by the desktop entry id its registry entry declares;
40
+ * - `{ platform, self: true }`: the platform's own application (OxyOS's
41
+ * Settings and shell, Astro's chrome);
42
+ * - `{ platform: 'astro', origin, clientId }`: an Oxy web application Astro
43
+ * shows, by the exact origin it committed and the application's client id.
44
+ */
45
+ export declare const deviceAppTokenAttestationSchema: z.ZodUnion<readonly [z.ZodObject<{
46
+ platform: z.ZodLiteral<"oxyos">;
47
+ desktopEntryId: z.ZodString;
48
+ }, z.core.$strict>, z.ZodObject<{
49
+ platform: z.ZodEnum<{
50
+ oxyos: "oxyos";
51
+ astro: "astro";
52
+ }>;
53
+ self: z.ZodLiteral<true>;
54
+ }, z.core.$strict>, z.ZodObject<{
55
+ platform: z.ZodLiteral<"astro">;
56
+ origin: z.ZodString;
57
+ clientId: z.ZodString;
58
+ }, z.core.$strict>]>;
59
+ /**
60
+ * `POST /session/device/app-token`: the platform credential (no bearer;
61
+ * possession is the proof, as at `POST /session/device/token`), the
62
+ * attestation, and optionally `accountId` (pins the account, as that mint's
63
+ * does) and `clientId` (when given, a public client id of the SAME application
64
+ * the attestation names).
65
+ */
66
+ export declare const deviceAppTokenRequestSchema: z.ZodObject<{
67
+ deviceId: z.ZodString;
68
+ deviceSecret: z.ZodString;
69
+ accountId: z.ZodOptional<z.ZodString>;
70
+ clientId: z.ZodOptional<z.ZodString>;
71
+ attestation: z.ZodUnion<readonly [z.ZodObject<{
72
+ platform: z.ZodLiteral<"oxyos">;
73
+ desktopEntryId: z.ZodString;
74
+ }, z.core.$strict>, z.ZodObject<{
75
+ platform: z.ZodEnum<{
76
+ oxyos: "oxyos";
77
+ astro: "astro";
78
+ }>;
79
+ self: z.ZodLiteral<true>;
80
+ }, z.core.$strict>, z.ZodObject<{
81
+ platform: z.ZodLiteral<"astro">;
82
+ origin: z.ZodString;
83
+ clientId: z.ZodString;
84
+ }, z.core.$strict>]>;
85
+ }, z.core.$strict>;
86
+ /**
87
+ * The application's token: a fresh access token of the device's shared session
88
+ * for `accountId`, named for `applicationId` (`azp`, its public client id) and
89
+ * carrying `host`. `expiresAt` is the token's own `exp`
90
+ * ({@link DEVICE_APP_TOKEN_TTL_SECONDS} after it was minted).
91
+ */
92
+ export declare const deviceAppTokenResponseSchema: z.ZodObject<{
93
+ accessToken: z.ZodString;
94
+ expiresAt: z.ZodString;
95
+ applicationId: z.ZodString;
96
+ accountId: z.ZodString;
97
+ }, z.core.$strip>;
98
+ /**
99
+ * The `host` claim of an application token: the platform that vouched for the
100
+ * application and the id of its platform credential. Oxy re-checks both on
101
+ * every request (the credential is live and the platform's, `azp` is a live
102
+ * public client of an active Oxy application).
103
+ */
104
+ export declare const hostTokenClaimSchema: z.ZodObject<{
105
+ platform: z.ZodEnum<{
106
+ oxyos: "oxyos";
107
+ astro: "astro";
108
+ }>;
109
+ credential: z.ZodString;
110
+ }, z.core.$strict>;
111
+ /**
112
+ * What `GET /session/validate-header/:sessionId` adds for an application token:
113
+ * the application it is named for and the platform that vouched for it.
114
+ */
115
+ export declare const hostTokenValidationSchema: z.ZodObject<{
116
+ applicationId: z.ZodString;
117
+ platform: z.ZodEnum<{
118
+ oxyos: "oxyos";
119
+ astro: "astro";
120
+ }>;
121
+ }, z.core.$strip>;
122
+ export type PlatformHost = (typeof PLATFORM_HOSTS)[number];
123
+ export type DeviceAppTokenErrorCode = (typeof DEVICE_APP_TOKEN_ERROR_CODES)[number];
124
+ export type PlatformClient = z.infer<typeof platformClientSchema>;
125
+ export type DeviceAppTokenAttestation = z.infer<typeof deviceAppTokenAttestationSchema>;
126
+ export type DeviceAppTokenRequest = z.infer<typeof deviceAppTokenRequestSchema>;
127
+ export type DeviceAppTokenResponse = z.infer<typeof deviceAppTokenResponseSchema>;
128
+ export type HostTokenClaim = z.infer<typeof hostTokenClaimSchema>;
129
+ export type HostTokenValidation = z.infer<typeof hostTokenValidationSchema>;