@oxyhq/contracts 0.7.0 → 0.9.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.
@@ -0,0 +1,199 @@
1
+ /**
2
+ * Device-first bootstrap & token contracts (auth centralization, wave 1).
3
+ *
4
+ * SINGLE SOURCE OF TRUTH for the wire shape of the new device-first session
5
+ * bootstrap: the top-level `#oxy_boot=…` fragment the API hands back from
6
+ * `GET /auth/device/bootstrap`, the token bundle a boot code / web-session
7
+ * fast-path exchanges into, the persisted-refresh rotation, the native
8
+ * device-token issuance, the IdP chooser's device-resolve, and the first-party
9
+ * password login result (2FA arm vs. session arm). The API validates its OUTPUT
10
+ * against these schemas; every consumer (`@oxyhq/core`'s device-boot mixin, the
11
+ * SDK cold boot, the IdP chooser) validates its INPUT against the same
12
+ * definitions, so producer and consumers cannot drift.
13
+ *
14
+ * Design anchors (from the auth-centralization plan):
15
+ * - The bootstrap fragment carries NO tokens and NO deviceId — only a
16
+ * `state` echo (CSRF), a `reason`, a short-lived single-use `code`, and an
17
+ * opaque `deviceToken`. Tokens are obtained by exchanging the `code` at
18
+ * `POST /auth/device/exchange` (origin-bound GETDEL burn).
19
+ * - Refresh is ONE rotating, single-use family shared by web and native.
20
+ * - `loginResult` mirrors what `POST /auth/login` returns today
21
+ * (`buildSessionAuthResponse` in the API's `session.controller.ts`): either a
22
+ * 2FA challenge (`{ twoFactorRequired: true, loginToken }`) or a session
23
+ * payload. The session arm matches `SessionAuthResponse` EXACTLY, plus an
24
+ * optional `refreshToken` the new server adds for the persisted-refresh lane.
25
+ *
26
+ * Nested-object response shapes are declared as explicit `interface`s with the
27
+ * runtime schema annotated `z.ZodType<Interface>` — the same rationale as
28
+ * `identity.ts` / `userResponse.ts`: a `z.infer<>` of a nested object schema can
29
+ * degrade to `{}` under a consumer's `moduleResolution: "node"` (node10), so the
30
+ * load-bearing shapes are pinned by literal interfaces. Flat request/response
31
+ * shapes (no nested-object hazard) are inferred via `z.infer<>`.
32
+ *
33
+ * Platform-agnostic — zod only, no react/react-native/expo. ESM-safe (no
34
+ * `require()`).
35
+ */
36
+ import { z } from 'zod';
37
+ import { type UserResponse } from './userResponse';
38
+ /**
39
+ * Why the bootstrap hop resolved the way it did.
40
+ * - `session` — the device cookie resolved an active session; a `code` is
41
+ * present to exchange for tokens.
42
+ * - `no_session` — the device is known but has no active session; no `code`.
43
+ * - `new_device` — first contact; the cookie was just planted, no session yet.
44
+ */
45
+ export declare const deviceBootReasonSchema: z.ZodEnum<["session", "no_session", "new_device"]>;
46
+ export type DeviceBootReason = z.infer<typeof deviceBootReasonSchema>;
47
+ /**
48
+ * The `#oxy_boot=<json>` fragment `GET /auth/device/bootstrap` appends to the
49
+ * `return_to` URL. Carries the CSRF `state` echo, the resolution `reason`, an
50
+ * optional single-use exchange `code` (present iff `reason === 'session'`), and
51
+ * the opaque `deviceToken`. NEVER carries tokens or a deviceId.
52
+ */
53
+ export declare const deviceBootFragmentSchema: z.ZodObject<{
54
+ v: z.ZodLiteral<1>;
55
+ state: z.ZodString;
56
+ reason: z.ZodEnum<["session", "no_session", "new_device"]>;
57
+ code: z.ZodOptional<z.ZodString>;
58
+ deviceToken: z.ZodString;
59
+ }, "strip", z.ZodTypeAny, {
60
+ reason: "session" | "no_session" | "new_device";
61
+ v: 1;
62
+ state: string;
63
+ deviceToken: string;
64
+ code?: string | undefined;
65
+ }, {
66
+ reason: "session" | "no_session" | "new_device";
67
+ v: 1;
68
+ state: string;
69
+ deviceToken: string;
70
+ code?: string | undefined;
71
+ }>;
72
+ export type DeviceBootFragment = z.infer<typeof deviceBootFragmentSchema>;
73
+ /** Request body for `POST /auth/device/exchange` — the single-use boot code. */
74
+ export declare const deviceExchangeRequestSchema: z.ZodObject<{
75
+ code: z.ZodString;
76
+ }, "strip", z.ZodTypeAny, {
77
+ code: string;
78
+ }, {
79
+ code: string;
80
+ }>;
81
+ export type DeviceExchangeRequest = z.infer<typeof deviceExchangeRequestSchema>;
82
+ /**
83
+ * The token bundle returned by `POST /auth/device/exchange` and
84
+ * `POST /auth/device/web-session` — the freshly-minted access token, its
85
+ * rotating refresh-family head, the owning `sessionId`, and the full canonical
86
+ * user object. `expiresAt` is an ISO string.
87
+ */
88
+ export interface AuthTokenBundle {
89
+ sessionId: string;
90
+ accessToken: string;
91
+ refreshToken: string;
92
+ expiresAt: string;
93
+ user: UserResponse;
94
+ }
95
+ export declare const authTokenBundleSchema: z.ZodType<AuthTokenBundle>;
96
+ /** Request body for `POST /auth/refresh-token` — the current refresh token. */
97
+ export declare const tokenRefreshRequestSchema: z.ZodObject<{
98
+ refreshToken: z.ZodString;
99
+ }, "strip", z.ZodTypeAny, {
100
+ refreshToken: string;
101
+ }, {
102
+ refreshToken: string;
103
+ }>;
104
+ export type TokenRefreshRequest = z.infer<typeof tokenRefreshRequestSchema>;
105
+ /**
106
+ * Wire shape of `POST /auth/refresh-token`: the rotated (single-use) family —
107
+ * a new access token, the next refresh token, the new access-token expiry, and
108
+ * the owning session id. `expiresAt` is an ISO string.
109
+ */
110
+ export declare const tokenRefreshResponseSchema: z.ZodObject<{
111
+ accessToken: z.ZodString;
112
+ refreshToken: z.ZodString;
113
+ expiresAt: z.ZodString;
114
+ sessionId: z.ZodString;
115
+ }, "strip", z.ZodTypeAny, {
116
+ expiresAt: string;
117
+ accessToken: string;
118
+ sessionId: string;
119
+ refreshToken: string;
120
+ }, {
121
+ expiresAt: string;
122
+ accessToken: string;
123
+ sessionId: string;
124
+ refreshToken: string;
125
+ }>;
126
+ export type TokenRefreshResponse = z.infer<typeof tokenRefreshResponseSchema>;
127
+ /**
128
+ * Wire shape of `POST /auth/device/token` — issues (or rotates) the opaque
129
+ * device token for the native channel. The deviceId is taken from the bearer
130
+ * JWT claims server-side; only the token comes back.
131
+ */
132
+ export declare const deviceTokenIssueResponseSchema: z.ZodObject<{
133
+ deviceToken: z.ZodString;
134
+ }, "strip", z.ZodTypeAny, {
135
+ deviceToken: string;
136
+ }, {
137
+ deviceToken: string;
138
+ }>;
139
+ export type DeviceTokenIssueResponse = z.infer<typeof deviceTokenIssueResponseSchema>;
140
+ /**
141
+ * `POST /auth/login` when the account has 2FA enabled: a short-lived login
142
+ * token to be presented at the 2FA challenge, and no session yet.
143
+ */
144
+ export interface LoginTwoFactorRequired {
145
+ twoFactorRequired: true;
146
+ loginToken: string;
147
+ }
148
+ /**
149
+ * `POST /auth/login` when authentication completed in one step. Matches the
150
+ * API's `SessionAuthResponse` EXACTLY (`buildSessionAuthResponse`), plus the
151
+ * optional `refreshToken` the persisted-refresh lane adds. `user` is the
152
+ * truncated session-user shape the login endpoint emits (NOT the full
153
+ * `userResponseSchema`).
154
+ */
155
+ export interface LoginSessionResult {
156
+ sessionId: string;
157
+ deviceId: string;
158
+ expiresAt: string;
159
+ accessToken?: string;
160
+ refreshToken?: string;
161
+ user: {
162
+ id: string;
163
+ username?: string;
164
+ avatar?: string;
165
+ };
166
+ }
167
+ /** The discriminated outcome of `POST /auth/login`. */
168
+ export type LoginResult = LoginTwoFactorRequired | LoginSessionResult;
169
+ export declare const loginResultSchema: z.ZodType<LoginResult>;
170
+ /**
171
+ * Request body for `POST /auth/device/resolve` (X-Oxy-Internal, called by the
172
+ * IdP chooser) — the device key the chooser read from the first-party
173
+ * `oxy_device` cookie.
174
+ */
175
+ export declare const deviceResolveRequestSchema: z.ZodObject<{
176
+ deviceKey: z.ZodString;
177
+ }, "strip", z.ZodTypeAny, {
178
+ deviceKey: string;
179
+ }, {
180
+ deviceKey: string;
181
+ }>;
182
+ export type DeviceResolveRequest = z.infer<typeof deviceResolveRequestSchema>;
183
+ /** One account resolved for the IdP chooser from a device's session set. */
184
+ export interface DeviceResolveAccount {
185
+ user: UserResponse;
186
+ sessionId: string;
187
+ accessToken: string;
188
+ expiresAt: string;
189
+ }
190
+ /**
191
+ * Wire shape of `POST /auth/device/resolve` — the device's active account id
192
+ * (or `null` when signed out of all) plus every account signed in on the
193
+ * device. Replaces the IdP's `/auth/refresh-all` chooser feed.
194
+ */
195
+ export interface DeviceResolveResponse {
196
+ activeAccountId: string | null;
197
+ accounts: DeviceResolveAccount[];
198
+ }
199
+ export declare const deviceResolveResponseSchema: z.ZodType<DeviceResolveResponse>;
@@ -0,0 +1,165 @@
1
+ import { z } from 'zod';
2
+ export declare const sessionAccountSchema: z.ZodObject<{
3
+ accountId: z.ZodString;
4
+ sessionId: z.ZodString;
5
+ authuser: z.ZodNumber;
6
+ operatedByUserId: z.ZodOptional<z.ZodString>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ authuser: number;
9
+ sessionId: string;
10
+ accountId: string;
11
+ operatedByUserId?: string | undefined;
12
+ }, {
13
+ authuser: number;
14
+ sessionId: string;
15
+ accountId: string;
16
+ operatedByUserId?: string | undefined;
17
+ }>;
18
+ export declare const deviceSessionStateSchema: z.ZodObject<{
19
+ deviceId: z.ZodString;
20
+ accounts: z.ZodArray<z.ZodObject<{
21
+ accountId: z.ZodString;
22
+ sessionId: z.ZodString;
23
+ authuser: z.ZodNumber;
24
+ operatedByUserId: z.ZodOptional<z.ZodString>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ authuser: number;
27
+ sessionId: string;
28
+ accountId: string;
29
+ operatedByUserId?: string | undefined;
30
+ }, {
31
+ authuser: number;
32
+ sessionId: string;
33
+ accountId: string;
34
+ operatedByUserId?: string | undefined;
35
+ }>, "many">;
36
+ activeAccountId: z.ZodNullable<z.ZodString>;
37
+ revision: z.ZodNumber;
38
+ updatedAt: z.ZodNumber;
39
+ }, "strip", z.ZodTypeAny, {
40
+ updatedAt: number;
41
+ accounts: {
42
+ authuser: number;
43
+ sessionId: string;
44
+ accountId: string;
45
+ operatedByUserId?: string | undefined;
46
+ }[];
47
+ deviceId: string;
48
+ activeAccountId: string | null;
49
+ revision: number;
50
+ }, {
51
+ updatedAt: number;
52
+ accounts: {
53
+ authuser: number;
54
+ sessionId: string;
55
+ accountId: string;
56
+ operatedByUserId?: string | undefined;
57
+ }[];
58
+ deviceId: string;
59
+ activeAccountId: string | null;
60
+ revision: number;
61
+ }>;
62
+ export declare const activeTokenSchema: z.ZodObject<{
63
+ accessToken: z.ZodString;
64
+ expiresAt: z.ZodString;
65
+ }, "strip", z.ZodTypeAny, {
66
+ expiresAt: string;
67
+ accessToken: string;
68
+ }, {
69
+ expiresAt: string;
70
+ accessToken: string;
71
+ }>;
72
+ export declare const deviceSessionSyncSchema: z.ZodObject<{
73
+ state: z.ZodObject<{
74
+ deviceId: z.ZodString;
75
+ accounts: z.ZodArray<z.ZodObject<{
76
+ accountId: z.ZodString;
77
+ sessionId: z.ZodString;
78
+ authuser: z.ZodNumber;
79
+ operatedByUserId: z.ZodOptional<z.ZodString>;
80
+ }, "strip", z.ZodTypeAny, {
81
+ authuser: number;
82
+ sessionId: string;
83
+ accountId: string;
84
+ operatedByUserId?: string | undefined;
85
+ }, {
86
+ authuser: number;
87
+ sessionId: string;
88
+ accountId: string;
89
+ operatedByUserId?: string | undefined;
90
+ }>, "many">;
91
+ activeAccountId: z.ZodNullable<z.ZodString>;
92
+ revision: z.ZodNumber;
93
+ updatedAt: z.ZodNumber;
94
+ }, "strip", z.ZodTypeAny, {
95
+ updatedAt: number;
96
+ accounts: {
97
+ authuser: number;
98
+ sessionId: string;
99
+ accountId: string;
100
+ operatedByUserId?: string | undefined;
101
+ }[];
102
+ deviceId: string;
103
+ activeAccountId: string | null;
104
+ revision: number;
105
+ }, {
106
+ updatedAt: number;
107
+ accounts: {
108
+ authuser: number;
109
+ sessionId: string;
110
+ accountId: string;
111
+ operatedByUserId?: string | undefined;
112
+ }[];
113
+ deviceId: string;
114
+ activeAccountId: string | null;
115
+ revision: number;
116
+ }>;
117
+ activeToken: z.ZodNullable<z.ZodObject<{
118
+ accessToken: z.ZodString;
119
+ expiresAt: z.ZodString;
120
+ }, "strip", z.ZodTypeAny, {
121
+ expiresAt: string;
122
+ accessToken: string;
123
+ }, {
124
+ expiresAt: string;
125
+ accessToken: string;
126
+ }>>;
127
+ }, "strip", z.ZodTypeAny, {
128
+ state: {
129
+ updatedAt: number;
130
+ accounts: {
131
+ authuser: number;
132
+ sessionId: string;
133
+ accountId: string;
134
+ operatedByUserId?: string | undefined;
135
+ }[];
136
+ deviceId: string;
137
+ activeAccountId: string | null;
138
+ revision: number;
139
+ };
140
+ activeToken: {
141
+ expiresAt: string;
142
+ accessToken: string;
143
+ } | null;
144
+ }, {
145
+ state: {
146
+ updatedAt: number;
147
+ accounts: {
148
+ authuser: number;
149
+ sessionId: string;
150
+ accountId: string;
151
+ operatedByUserId?: string | undefined;
152
+ }[];
153
+ deviceId: string;
154
+ activeAccountId: string | null;
155
+ revision: number;
156
+ };
157
+ activeToken: {
158
+ expiresAt: string;
159
+ accessToken: string;
160
+ } | null;
161
+ }>;
162
+ export type SessionAccount = z.infer<typeof sessionAccountSchema>;
163
+ export type DeviceSessionState = z.infer<typeof deviceSessionStateSchema>;
164
+ export type ActiveToken = z.infer<typeof activeTokenSchema>;
165
+ export type DeviceSessionSync = z.infer<typeof deviceSessionSyncSchema>;
@@ -41,6 +41,13 @@ export declare const fedcmTokenPayloadSchema: z.ZodObject<{
41
41
  exp: z.ZodOptional<z.ZodNumber>;
42
42
  iat: z.ZodOptional<z.ZodNumber>;
43
43
  nonce: z.ZodOptional<z.ZodString>;
44
+ /**
45
+ * An explicit central deviceId minted by the IdP, threaded through so the
46
+ * RP session can inherit a unified device id instead of deriving one from
47
+ * the (userId, RP origin) stableDeviceKey. Optional and additive — omitted
48
+ * tokens fall back to the existing stableDeviceKey/UA-IP derivation.
49
+ */
50
+ deviceId: z.ZodOptional<z.ZodString>;
44
51
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
45
52
  iss: z.ZodOptional<z.ZodString>;
46
53
  sub: z.ZodOptional<z.ZodString>;
@@ -48,6 +55,13 @@ export declare const fedcmTokenPayloadSchema: z.ZodObject<{
48
55
  exp: z.ZodOptional<z.ZodNumber>;
49
56
  iat: z.ZodOptional<z.ZodNumber>;
50
57
  nonce: z.ZodOptional<z.ZodString>;
58
+ /**
59
+ * An explicit central deviceId minted by the IdP, threaded through so the
60
+ * RP session can inherit a unified device id instead of deriving one from
61
+ * the (userId, RP origin) stableDeviceKey. Optional and additive — omitted
62
+ * tokens fall back to the existing stableDeviceKey/UA-IP derivation.
63
+ */
64
+ deviceId: z.ZodOptional<z.ZodString>;
51
65
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
52
66
  iss: z.ZodOptional<z.ZodString>;
53
67
  sub: z.ZodOptional<z.ZodString>;
@@ -55,5 +69,12 @@ export declare const fedcmTokenPayloadSchema: z.ZodObject<{
55
69
  exp: z.ZodOptional<z.ZodNumber>;
56
70
  iat: z.ZodOptional<z.ZodNumber>;
57
71
  nonce: z.ZodOptional<z.ZodString>;
72
+ /**
73
+ * An explicit central deviceId minted by the IdP, threaded through so the
74
+ * RP session can inherit a unified device id instead of deriving one from
75
+ * the (userId, RP origin) stableDeviceKey. Optional and additive — omitted
76
+ * tokens fall back to the existing stableDeviceKey/UA-IP derivation.
77
+ */
78
+ deviceId: z.ZodOptional<z.ZodString>;
58
79
  }, z.ZodTypeAny, "passthrough">>;
59
80
  export type FedcmTokenPayload = z.infer<typeof fedcmTokenPayloadSchema>;
@@ -39,19 +39,74 @@
39
39
  */
40
40
  import { z } from 'zod';
41
41
  /**
42
- * A single DID verification method. Mirrors the secp256k1 key entries the API
43
- * derives from `User.publicKey` + each `authMethods[]` of type `identity`.
44
- * `id` is a fragment reference within the DID document (e.g.
45
- * `did:web:oxy.so:u:<id>#key-1`); `controller` is the controlling DID;
46
- * `publicKeyHex` is the uncompressed/compressed secp256k1 public key in hex.
42
+ * A `EcdsaSecp256k1VerificationKey2019` verification method the canonical Oxy
43
+ * key form. Mirrors the secp256k1 key entries the API derives from
44
+ * `User.publicKey` + each `authMethods[]` of type `identity`. `id` is a fragment
45
+ * reference within the DID document (e.g. `did:web:oxy.so:u:<id>#key-1`);
46
+ * `controller` is the controlling DID; `publicKeyHex` is the (uncompressed)
47
+ * secp256k1 public key in hex.
47
48
  */
48
- export interface VerificationMethod {
49
+ export interface Secp256k1VerificationMethod {
49
50
  id: string;
50
51
  type: 'EcdsaSecp256k1VerificationKey2019';
51
52
  controller: string;
52
53
  publicKeyHex: string;
53
54
  }
54
- export declare const verificationMethodSchema: z.ZodType<VerificationMethod>;
55
+ /**
56
+ * A `Multikey` verification method — the AtProto/Bluesky key form. The SAME
57
+ * secp256k1 key as an account's {@link Secp256k1VerificationMethod}, re-encoded
58
+ * the way atproto expects: `publicKeyMultibase` is the `did:key`-style multibase
59
+ * (`base58btc`, leading `z`) of the multicodec-prefixed (`0xe7 0x01`, secp256k1)
60
+ * COMPRESSED public key. This is the verification method a foreign Bluesky
61
+ * AppView reads when it routes to the user's bridge PDS; it is additive and only
62
+ * present for atproto-bridged self-sovereign accounts.
63
+ */
64
+ export interface MultikeyVerificationMethod {
65
+ id: string;
66
+ type: 'Multikey';
67
+ controller: string;
68
+ publicKeyMultibase: string;
69
+ }
70
+ /**
71
+ * A single DID verification method — either the canonical Oxy secp256k1 form
72
+ * ({@link Secp256k1VerificationMethod}) or the atproto `Multikey` form
73
+ * ({@link MultikeyVerificationMethod}). Discriminated on `type`, so an
74
+ * `EcdsaSecp256k1VerificationKey2019` entry keeps its exact `publicKeyHex` shape
75
+ * (every document already served verifies byte-identically) and the `Multikey`
76
+ * entry carries `publicKeyMultibase`.
77
+ */
78
+ export type VerificationMethod = Secp256k1VerificationMethod | MultikeyVerificationMethod;
79
+ export declare const verificationMethodSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
80
+ id: z.ZodString;
81
+ type: z.ZodLiteral<"EcdsaSecp256k1VerificationKey2019">;
82
+ controller: z.ZodString;
83
+ publicKeyHex: z.ZodString;
84
+ }, "strip", z.ZodTypeAny, {
85
+ id: string;
86
+ type: "EcdsaSecp256k1VerificationKey2019";
87
+ controller: string;
88
+ publicKeyHex: string;
89
+ }, {
90
+ id: string;
91
+ type: "EcdsaSecp256k1VerificationKey2019";
92
+ controller: string;
93
+ publicKeyHex: string;
94
+ }>, z.ZodObject<{
95
+ id: z.ZodString;
96
+ type: z.ZodLiteral<"Multikey">;
97
+ controller: z.ZodString;
98
+ publicKeyMultibase: z.ZodString;
99
+ }, "strip", z.ZodTypeAny, {
100
+ id: string;
101
+ type: "Multikey";
102
+ controller: string;
103
+ publicKeyMultibase: string;
104
+ }, {
105
+ id: string;
106
+ type: "Multikey";
107
+ controller: string;
108
+ publicKeyMultibase: string;
109
+ }>]>;
55
110
  /**
56
111
  * A DID service entry (the `service[]` array). Oxy publishes its API root and
57
112
  * profile endpoints here so a resolver can discover where to fetch the user's
@@ -15,10 +15,10 @@ export { applicationTypeSchema, publicApplicationSchema, sessionStatusSchema, }
15
15
  export type { ApplicationTypeContract, PublicApplicationResponse, SessionStatusResponse, } from './sessionStatus';
16
16
  export { fedcmTokenPayloadSchema, } from './fedcmToken';
17
17
  export type { FedcmTokenPayload, } from './fedcmToken';
18
- export { recommendationExcludeTypeSchema, recommendationBoostSchema, recommendationSignalWeightsSchema, recommendationRequestSchema, recommendationCountSchema, recommendationItemSchema, recommendationResponseSchema, appEndorsementInputSchema, appInterestInputSchema, appUserSignalIngestSchema, } from './recommendations';
19
- export type { RecommendationExcludeType, RecommendationBoost, RecommendationSignalWeights, RecommendationRequest, RecommendationCount, RecommendationItem, RecommendationResponse, AppEndorsementInput, AppInterestInput, AppUserSignalIngest, } from './recommendations';
18
+ export { recommendationExcludeTypeSchema, recommendationBoostSchema, recommendationSignalWeightsSchema, recommendationRequestSchema, recommendationCountSchema, recommendationItemSchema, recommendationResponseSchema, appEndorsementInputSchema, appInterestInputSchema, appUserSignalIngestSchema, appAffinityEventTypeSchema, appAffinityEventSchema, appAffinityEventsIngestSchema, } from './recommendations';
19
+ export type { RecommendationExcludeType, RecommendationBoost, RecommendationSignalWeights, RecommendationRequest, RecommendationCount, RecommendationItem, RecommendationResponse, AppEndorsementInput, AppInterestInput, AppUserSignalIngest, AppAffinityEventType, AppAffinityEvent, AppAffinityEventsIngest, } from './recommendations';
20
20
  export { verificationMethodSchema, didServiceSchema, didDocumentSchema, signedRecordEnvelopeSchema, verifiedDomainSchema, domainVerificationRequestSchema, domainVerificationInstructionsSchema, authMethodEntrySchema, authMethodsResponseSchema, exportAttestationSchema, exportBundleSchema, } from './identity';
21
- export type { VerificationMethod, DidService, DidDocument, SignedRecordEnvelope, VerifiedDomain, DomainVerificationRequest, DomainVerificationInstructions, AuthMethodEntry, AuthMethodsResponse, ExportAttestation, ExportBundle, } from './identity';
21
+ export type { VerificationMethod, Secp256k1VerificationMethod, MultikeyVerificationMethod, DidService, DidDocument, SignedRecordEnvelope, VerifiedDomain, DomainVerificationRequest, DomainVerificationInstructions, AuthMethodEntry, AuthMethodsResponse, ExportAttestation, ExportBundle, } from './identity';
22
22
  export { oxySignedRecordTypeSchema, } from './oxyRecordTypes';
23
23
  export type { OxySignedRecordType, } from './oxyRecordTypes';
24
24
  export { chainHeadResponseSchema, logPageResponseSchema, } from './protocol';
@@ -27,3 +27,7 @@ export { publicCardSchema, signedPublicCardSchema, realLifeAttestationRecordSche
27
27
  export type { CardTrustTier, PersonhoodStatus, PublicCard, SignedPublicCard, RealLifeAttestationRecord, RealLifeAttestationResult, ValidationVerdict, ValidationRequestStatus, ValidationVerdictRecord, ValidationOpenRequest, ValidationOpenResult, ValidationRequestSummary, ValidationVoteResult, PersonhoodVouchRecord, PersonhoodBreakdown, PersonhoodStatusResult, VouchResult, CredentialStatus, CredentialRecord, VerifiableCredentialResponse, CredentialIssueResult, CredentialListResult, CredentialVerifyResult, } from './civic';
28
28
  export { linkPreviewSchema, linkPreviewBatchRequestSchema, linkPreviewBatchResponseSchema, linkPreviewResponseSchema, } from './links';
29
29
  export type { LinkPreviewStatus, LinkPreview, LinkPreviewBatchRequest, LinkPreviewBatchResponse, } from './links';
30
+ export { sessionAccountSchema, deviceSessionStateSchema, activeTokenSchema, deviceSessionSyncSchema, } from './deviceSession';
31
+ export type { SessionAccount, DeviceSessionState, ActiveToken, DeviceSessionSync, } from './deviceSession';
32
+ export { deviceBootReasonSchema, deviceBootFragmentSchema, deviceExchangeRequestSchema, authTokenBundleSchema, tokenRefreshRequestSchema, tokenRefreshResponseSchema, deviceTokenIssueResponseSchema, loginResultSchema, deviceResolveRequestSchema, deviceResolveResponseSchema, } from './deviceBoot';
33
+ export type { DeviceBootReason, DeviceBootFragment, DeviceExchangeRequest, AuthTokenBundle, TokenRefreshRequest, TokenRefreshResponse, DeviceTokenIssueResponse, LoginTwoFactorRequired, LoginSessionResult, LoginResult, DeviceResolveRequest, DeviceResolveAccount, DeviceResolveResponse, } from './deviceBoot';
@@ -47,6 +47,7 @@ export declare const recommendationSignalWeightsSchema: z.ZodObject<{
47
47
  interest: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
48
48
  appBoost: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
49
49
  repCandidate: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
50
+ affinity: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
50
51
  }, "strip", z.ZodTypeAny, {
51
52
  verified?: number | undefined;
52
53
  graph?: number | undefined;
@@ -55,6 +56,7 @@ export declare const recommendationSignalWeightsSchema: z.ZodObject<{
55
56
  interest?: number | undefined;
56
57
  appBoost?: number | undefined;
57
58
  repCandidate?: number | undefined;
59
+ affinity?: number | undefined;
58
60
  }, {
59
61
  verified?: number | undefined;
60
62
  graph?: number | undefined;
@@ -63,6 +65,7 @@ export declare const recommendationSignalWeightsSchema: z.ZodObject<{
63
65
  interest?: number | undefined;
64
66
  appBoost?: number | undefined;
65
67
  repCandidate?: number | undefined;
68
+ affinity?: number | undefined;
66
69
  }>;
67
70
  export type RecommendationSignalWeights = z.infer<typeof recommendationSignalWeightsSchema>;
68
71
  /**
@@ -100,6 +103,7 @@ export declare const recommendationRequestSchema: z.ZodObject<{
100
103
  interest: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
101
104
  appBoost: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
102
105
  repCandidate: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
106
+ affinity: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
103
107
  }, "strip", z.ZodTypeAny, {
104
108
  verified?: number | undefined;
105
109
  graph?: number | undefined;
@@ -108,6 +112,7 @@ export declare const recommendationRequestSchema: z.ZodObject<{
108
112
  interest?: number | undefined;
109
113
  appBoost?: number | undefined;
110
114
  repCandidate?: number | undefined;
115
+ affinity?: number | undefined;
111
116
  }, {
112
117
  verified?: number | undefined;
113
118
  graph?: number | undefined;
@@ -116,6 +121,7 @@ export declare const recommendationRequestSchema: z.ZodObject<{
116
121
  interest?: number | undefined;
117
122
  appBoost?: number | undefined;
118
123
  repCandidate?: number | undefined;
124
+ affinity?: number | undefined;
119
125
  }>>;
120
126
  }, "strip", z.ZodTypeAny, {
121
127
  clientId?: string | undefined;
@@ -136,6 +142,7 @@ export declare const recommendationRequestSchema: z.ZodObject<{
136
142
  interest?: number | undefined;
137
143
  appBoost?: number | undefined;
138
144
  repCandidate?: number | undefined;
145
+ affinity?: number | undefined;
139
146
  } | undefined;
140
147
  }, {
141
148
  clientId?: string | undefined;
@@ -156,6 +163,7 @@ export declare const recommendationRequestSchema: z.ZodObject<{
156
163
  interest?: number | undefined;
157
164
  appBoost?: number | undefined;
158
165
  repCandidate?: number | undefined;
166
+ affinity?: number | undefined;
159
167
  } | undefined;
160
168
  }>;
161
169
  export type RecommendationRequest = z.infer<typeof recommendationRequestSchema>;
@@ -443,3 +451,92 @@ export declare const appUserSignalIngestSchema: z.ZodEffects<z.ZodObject<{
443
451
  }[] | undefined;
444
452
  }>;
445
453
  export type AppUserSignalIngest = z.infer<typeof appUserSignalIngestSchema>;
454
+ /**
455
+ * The directed interaction types a consuming app may report between two users.
456
+ * Each type carries a server-side default weight (see the API's
457
+ * `AFFINITY_EVENT_WEIGHTS`); a caller may override the applied weight per event.
458
+ */
459
+ export declare const appAffinityEventTypeSchema: z.ZodEnum<["like", "reply", "boost", "follow", "mention", "profile_view", "quote", "repost"]>;
460
+ export type AppAffinityEventType = z.infer<typeof appAffinityEventTypeSchema>;
461
+ /**
462
+ * One directed interaction event: `fromUserId` interacted with `toUserId`
463
+ * (`type`) at `occurredAt`. The Oxy affinity-graph folds these into a per-app,
464
+ * time-decayed directed affinity edge (`fromUserId → toUserId`).
465
+ *
466
+ * - `weight` (optional) overrides the per-type default weight for this event.
467
+ * - `occurredAt` (optional, ISO) is the event time; absent means "now" at ingest.
468
+ * - `eventId` (optional) makes an event idempotent — a repeated `eventId` for the
469
+ * same application is folded at most once (bounded dedup window).
470
+ */
471
+ export declare const appAffinityEventSchema: z.ZodObject<{
472
+ fromUserId: z.ZodString;
473
+ toUserId: z.ZodString;
474
+ type: z.ZodEnum<["like", "reply", "boost", "follow", "mention", "profile_view", "quote", "repost"]>;
475
+ weight: z.ZodOptional<z.ZodNumber>;
476
+ occurredAt: z.ZodOptional<z.ZodString>;
477
+ eventId: z.ZodOptional<z.ZodString>;
478
+ }, "strip", z.ZodTypeAny, {
479
+ type: "like" | "reply" | "boost" | "follow" | "mention" | "profile_view" | "quote" | "repost";
480
+ fromUserId: string;
481
+ toUserId: string;
482
+ weight?: number | undefined;
483
+ occurredAt?: string | undefined;
484
+ eventId?: string | undefined;
485
+ }, {
486
+ type: "like" | "reply" | "boost" | "follow" | "mention" | "profile_view" | "quote" | "repost";
487
+ fromUserId: string;
488
+ toUserId: string;
489
+ weight?: number | undefined;
490
+ occurredAt?: string | undefined;
491
+ eventId?: string | undefined;
492
+ }>;
493
+ export type AppAffinityEvent = z.infer<typeof appAffinityEventSchema>;
494
+ /**
495
+ * Request body for `POST /app-signals/events` (service token, `signals:write`).
496
+ *
497
+ * A non-empty batch (1..1000) of directed interaction events for the requesting
498
+ * application. Self-edges (`fromUserId === toUserId`) are dropped server-side.
499
+ */
500
+ export declare const appAffinityEventsIngestSchema: z.ZodObject<{
501
+ events: z.ZodArray<z.ZodObject<{
502
+ fromUserId: z.ZodString;
503
+ toUserId: z.ZodString;
504
+ type: z.ZodEnum<["like", "reply", "boost", "follow", "mention", "profile_view", "quote", "repost"]>;
505
+ weight: z.ZodOptional<z.ZodNumber>;
506
+ occurredAt: z.ZodOptional<z.ZodString>;
507
+ eventId: z.ZodOptional<z.ZodString>;
508
+ }, "strip", z.ZodTypeAny, {
509
+ type: "like" | "reply" | "boost" | "follow" | "mention" | "profile_view" | "quote" | "repost";
510
+ fromUserId: string;
511
+ toUserId: string;
512
+ weight?: number | undefined;
513
+ occurredAt?: string | undefined;
514
+ eventId?: string | undefined;
515
+ }, {
516
+ type: "like" | "reply" | "boost" | "follow" | "mention" | "profile_view" | "quote" | "repost";
517
+ fromUserId: string;
518
+ toUserId: string;
519
+ weight?: number | undefined;
520
+ occurredAt?: string | undefined;
521
+ eventId?: string | undefined;
522
+ }>, "many">;
523
+ }, "strip", z.ZodTypeAny, {
524
+ events: {
525
+ type: "like" | "reply" | "boost" | "follow" | "mention" | "profile_view" | "quote" | "repost";
526
+ fromUserId: string;
527
+ toUserId: string;
528
+ weight?: number | undefined;
529
+ occurredAt?: string | undefined;
530
+ eventId?: string | undefined;
531
+ }[];
532
+ }, {
533
+ events: {
534
+ type: "like" | "reply" | "boost" | "follow" | "mention" | "profile_view" | "quote" | "repost";
535
+ fromUserId: string;
536
+ toUserId: string;
537
+ weight?: number | undefined;
538
+ occurredAt?: string | undefined;
539
+ eventId?: string | undefined;
540
+ }[];
541
+ }>;
542
+ export type AppAffinityEventsIngest = z.infer<typeof appAffinityEventsIngestSchema>;