@oxyhq/contracts 0.9.1 → 0.11.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.
@@ -169,13 +169,13 @@ export declare const tokenRefreshResponseSchema: z.ZodObject<{
169
169
  sessionId: z.ZodString;
170
170
  }, "strip", z.ZodTypeAny, {
171
171
  expiresAt: string;
172
- accessToken: string;
173
172
  sessionId: string;
173
+ accessToken: string;
174
174
  refreshToken: string;
175
175
  }, {
176
176
  expiresAt: string;
177
- accessToken: string;
178
177
  sessionId: string;
178
+ accessToken: string;
179
179
  refreshToken: string;
180
180
  }>;
181
181
  export type TokenRefreshResponse = z.infer<typeof tokenRefreshResponseSchema>;
@@ -245,7 +245,7 @@ export interface DeviceResolveAccount {
245
245
  /**
246
246
  * Wire shape of `POST /auth/device/resolve` — the device's active account id
247
247
  * (or `null` when signed out of all) plus every account signed in on the
248
- * device. Replaces the IdP's `/auth/refresh-all` chooser feed.
248
+ * device. Replaces the IdP's legacy cookie-based chooser feed.
249
249
  */
250
250
  export interface DeviceResolveResponse {
251
251
  activeAccountId: string | null;
@@ -5,14 +5,14 @@ export declare const sessionAccountSchema: z.ZodObject<{
5
5
  authuser: z.ZodNumber;
6
6
  operatedByUserId: z.ZodOptional<z.ZodString>;
7
7
  }, "strip", z.ZodTypeAny, {
8
- authuser: number;
9
8
  sessionId: string;
10
9
  accountId: string;
10
+ authuser: number;
11
11
  operatedByUserId?: string | undefined;
12
12
  }, {
13
- authuser: number;
14
13
  sessionId: string;
15
14
  accountId: string;
15
+ authuser: number;
16
16
  operatedByUserId?: string | undefined;
17
17
  }>;
18
18
  export declare const deviceSessionStateSchema: z.ZodObject<{
@@ -23,14 +23,14 @@ export declare const deviceSessionStateSchema: z.ZodObject<{
23
23
  authuser: z.ZodNumber;
24
24
  operatedByUserId: z.ZodOptional<z.ZodString>;
25
25
  }, "strip", z.ZodTypeAny, {
26
- authuser: number;
27
26
  sessionId: string;
28
27
  accountId: string;
28
+ authuser: number;
29
29
  operatedByUserId?: string | undefined;
30
30
  }, {
31
- authuser: number;
32
31
  sessionId: string;
33
32
  accountId: string;
33
+ authuser: number;
34
34
  operatedByUserId?: string | undefined;
35
35
  }>, "many">;
36
36
  activeAccountId: z.ZodNullable<z.ZodString>;
@@ -38,25 +38,25 @@ export declare const deviceSessionStateSchema: z.ZodObject<{
38
38
  updatedAt: z.ZodNumber;
39
39
  }, "strip", z.ZodTypeAny, {
40
40
  updatedAt: number;
41
+ deviceId: string;
42
+ activeAccountId: string | null;
41
43
  accounts: {
42
- authuser: number;
43
44
  sessionId: string;
44
45
  accountId: string;
46
+ authuser: number;
45
47
  operatedByUserId?: string | undefined;
46
48
  }[];
47
- deviceId: string;
48
- activeAccountId: string | null;
49
49
  revision: number;
50
50
  }, {
51
51
  updatedAt: number;
52
+ deviceId: string;
53
+ activeAccountId: string | null;
52
54
  accounts: {
53
- authuser: number;
54
55
  sessionId: string;
55
56
  accountId: string;
57
+ authuser: number;
56
58
  operatedByUserId?: string | undefined;
57
59
  }[];
58
- deviceId: string;
59
- activeAccountId: string | null;
60
60
  revision: number;
61
61
  }>;
62
62
  export declare const activeTokenSchema: z.ZodObject<{
@@ -78,14 +78,14 @@ export declare const deviceSessionSyncSchema: z.ZodObject<{
78
78
  authuser: z.ZodNumber;
79
79
  operatedByUserId: z.ZodOptional<z.ZodString>;
80
80
  }, "strip", z.ZodTypeAny, {
81
- authuser: number;
82
81
  sessionId: string;
83
82
  accountId: string;
83
+ authuser: number;
84
84
  operatedByUserId?: string | undefined;
85
85
  }, {
86
- authuser: number;
87
86
  sessionId: string;
88
87
  accountId: string;
88
+ authuser: number;
89
89
  operatedByUserId?: string | undefined;
90
90
  }>, "many">;
91
91
  activeAccountId: z.ZodNullable<z.ZodString>;
@@ -93,25 +93,25 @@ export declare const deviceSessionSyncSchema: z.ZodObject<{
93
93
  updatedAt: z.ZodNumber;
94
94
  }, "strip", z.ZodTypeAny, {
95
95
  updatedAt: number;
96
+ deviceId: string;
97
+ activeAccountId: string | null;
96
98
  accounts: {
97
- authuser: number;
98
99
  sessionId: string;
99
100
  accountId: string;
101
+ authuser: number;
100
102
  operatedByUserId?: string | undefined;
101
103
  }[];
102
- deviceId: string;
103
- activeAccountId: string | null;
104
104
  revision: number;
105
105
  }, {
106
106
  updatedAt: number;
107
+ deviceId: string;
108
+ activeAccountId: string | null;
107
109
  accounts: {
108
- authuser: number;
109
110
  sessionId: string;
110
111
  accountId: string;
112
+ authuser: number;
111
113
  operatedByUserId?: string | undefined;
112
114
  }[];
113
- deviceId: string;
114
- activeAccountId: string | null;
115
115
  revision: number;
116
116
  }>;
117
117
  activeToken: z.ZodNullable<z.ZodObject<{
@@ -127,14 +127,14 @@ export declare const deviceSessionSyncSchema: z.ZodObject<{
127
127
  }, "strip", z.ZodTypeAny, {
128
128
  state: {
129
129
  updatedAt: number;
130
+ deviceId: string;
131
+ activeAccountId: string | null;
130
132
  accounts: {
131
- authuser: number;
132
133
  sessionId: string;
133
134
  accountId: string;
135
+ authuser: number;
134
136
  operatedByUserId?: string | undefined;
135
137
  }[];
136
- deviceId: string;
137
- activeAccountId: string | null;
138
138
  revision: number;
139
139
  };
140
140
  activeToken: {
@@ -144,14 +144,14 @@ export declare const deviceSessionSyncSchema: z.ZodObject<{
144
144
  }, {
145
145
  state: {
146
146
  updatedAt: number;
147
+ deviceId: string;
148
+ activeAccountId: string | null;
147
149
  accounts: {
148
- authuser: number;
149
150
  sessionId: string;
150
151
  accountId: string;
152
+ authuser: number;
151
153
  operatedByUserId?: string | undefined;
152
154
  }[];
153
- deviceId: string;
154
- activeAccountId: string | null;
155
155
  revision: number;
156
156
  };
157
157
  activeToken: {
@@ -1,6 +1,16 @@
1
1
  /**
2
2
  * Canonical contract for the FedCM ID-token JWT payload.
3
3
  *
4
+ * DEAD SINCE THE WAVE-2 FEDCM DELETION (found during the comment sweep, not
5
+ * fixed here — this is a published `@oxyhq/contracts` export, so removing it
6
+ * is a breaking change/major-version decision, out of scope for a comment
7
+ * fix): `POST /fedcm/exchange`, `fedcm.service.exchangeIdToken`, and
8
+ * `packages/auth/server/index.ts`'s `mintSessionForClient` — every consumer
9
+ * and producer this file describes — are all deleted. No current code
10
+ * imports `fedcmTokenPayloadSchema` / `FedcmTokenPayload` outside this
11
+ * package. Flag for a follow-up major-version cleanup.
12
+ *
13
+ * Original doc (historical, describes the now-deleted system):
4
14
  * SINGLE SOURCE OF TRUTH for the decoded claims of the HS256 ID token the auth
5
15
  * IdP (`auth.oxy.so`) signs and `POST /fedcm/exchange` consumes. The API decodes
6
16
  * the JWT, verifies its signature, then validates the resulting claim object
@@ -9,8 +9,8 @@
9
9
  * Platform-agnostic — zod is the only runtime dependency. No react/react-native/
10
10
  * expo, no `require()` in the ESM build.
11
11
  */
12
- export { userNameSchema, userResponseSchema, userProfileUpdateSchema, refreshAllAccountSchema, refreshAllResponseSchema, currentUserResponseSchema, deviceSessionAccountSchema, deviceSessionsResponseSchema, resolveUserId, safeParseContract, } from './userResponse';
13
- export type { UserNameResponse, UserResponse, UserProfileUpdate, RefreshAllAccountResponse, RefreshAllResponseContract, CurrentUserResponseContract, DeviceSessionAccountResponse, DeviceSessionsResponseContract, } from './userResponse';
12
+ export { userNameSchema, userResponseSchema, userProfileUpdateSchema, currentUserResponseSchema, deviceLinkedSessionSchema, deviceLinkedSessionsResponseSchema, resolveUserId, safeParseContract, } from './userResponse';
13
+ export type { UserNameResponse, UserResponse, UserProfileUpdate, CurrentUserResponseContract, DeviceLinkedSessionResponse, DeviceLinkedSessionsResponseContract, } from './userResponse';
14
14
  export { applicationTypeSchema, publicApplicationSchema, sessionStatusSchema, } from './sessionStatus';
15
15
  export type { ApplicationTypeContract, PublicApplicationResponse, SessionStatusResponse, } from './sessionStatus';
16
16
  export { fedcmTokenPayloadSchema, } from './fedcmToken';
@@ -19,9 +19,10 @@
19
19
  * Faithful to the producers:
20
20
  * - `packages/api/src/utils/serializeApplication.ts` `serializePublicApplication`
21
21
  * — the ONLY shape returned to an unauthenticated consent UI. Optional fields
22
- * (`description`, `icon`, `websiteUrl`, `developerName`) are OMITTED when
23
- * absent (never serialized as `null`), so they are `.optional()` — NOT
24
- * `.nullable()`. `type` is the `Application.type` enum.
22
+ * (`description`, `icon`, `websiteUrl`, `privacyPolicyUrl`, `termsUrl`,
23
+ * `developerName`) are OMITTED when absent (never serialized as `null`), so
24
+ * they are `.optional()` — NOT `.nullable()`. `type` is the `Application.type`
25
+ * enum.
25
26
  * - `packages/api/src/routes/auth.ts` `GET /session/status/:sessionToken` — the
26
27
  * inner object of the API's `{ data: ... }` success envelope. The handler
27
28
  * ALWAYS emits `status`, `authorized` (`status === 'authorized'`),
@@ -48,9 +49,10 @@ export type ApplicationTypeContract = z.infer<typeof applicationTypeSchema>;
48
49
  * `GET /auth/oauth/client/:clientId` (OAuth code flow).
49
50
  *
50
51
  * Optional fields are `.optional()` (NOT `.nullable()`): the serializer OMITS
51
- * `description` / `icon` / `websiteUrl` / `developerName` when the underlying
52
- * value is absent — it never writes `null` for them. `developerName` is only
53
- * attached for non-official apps when a name could be resolved.
52
+ * `description` / `icon` / `websiteUrl` / `privacyPolicyUrl` / `termsUrl` /
53
+ * `developerName` when the underlying value is absent — it never writes `null`
54
+ * for them. `developerName` is only attached for non-official apps when a name
55
+ * could be resolved.
54
56
  */
55
57
  export declare const publicApplicationSchema: z.ZodObject<{
56
58
  id: z.ZodString;
@@ -58,6 +60,8 @@ export declare const publicApplicationSchema: z.ZodObject<{
58
60
  description: z.ZodOptional<z.ZodString>;
59
61
  icon: z.ZodOptional<z.ZodString>;
60
62
  websiteUrl: z.ZodOptional<z.ZodString>;
63
+ privacyPolicyUrl: z.ZodOptional<z.ZodString>;
64
+ termsUrl: z.ZodOptional<z.ZodString>;
61
65
  type: z.ZodEnum<["first_party", "third_party", "internal", "system"]>;
62
66
  isOfficial: z.ZodBoolean;
63
67
  isInternal: z.ZodBoolean;
@@ -73,6 +77,8 @@ export declare const publicApplicationSchema: z.ZodObject<{
73
77
  description?: string | undefined;
74
78
  icon?: string | undefined;
75
79
  websiteUrl?: string | undefined;
80
+ privacyPolicyUrl?: string | undefined;
81
+ termsUrl?: string | undefined;
76
82
  developerName?: string | undefined;
77
83
  }, {
78
84
  id: string;
@@ -84,6 +90,8 @@ export declare const publicApplicationSchema: z.ZodObject<{
84
90
  description?: string | undefined;
85
91
  icon?: string | undefined;
86
92
  websiteUrl?: string | undefined;
93
+ privacyPolicyUrl?: string | undefined;
94
+ termsUrl?: string | undefined;
87
95
  developerName?: string | undefined;
88
96
  }>;
89
97
  export type PublicApplicationResponse = z.infer<typeof publicApplicationSchema>;
@@ -116,6 +124,8 @@ export declare const sessionStatusSchema: z.ZodObject<{
116
124
  description: z.ZodOptional<z.ZodString>;
117
125
  icon: z.ZodOptional<z.ZodString>;
118
126
  websiteUrl: z.ZodOptional<z.ZodString>;
127
+ privacyPolicyUrl: z.ZodOptional<z.ZodString>;
128
+ termsUrl: z.ZodOptional<z.ZodString>;
119
129
  type: z.ZodEnum<["first_party", "third_party", "internal", "system"]>;
120
130
  isOfficial: z.ZodBoolean;
121
131
  isInternal: z.ZodBoolean;
@@ -131,6 +141,8 @@ export declare const sessionStatusSchema: z.ZodObject<{
131
141
  description?: string | undefined;
132
142
  icon?: string | undefined;
133
143
  websiteUrl?: string | undefined;
144
+ privacyPolicyUrl?: string | undefined;
145
+ termsUrl?: string | undefined;
134
146
  developerName?: string | undefined;
135
147
  }, {
136
148
  id: string;
@@ -142,6 +154,8 @@ export declare const sessionStatusSchema: z.ZodObject<{
142
154
  description?: string | undefined;
143
155
  icon?: string | undefined;
144
156
  websiteUrl?: string | undefined;
157
+ privacyPolicyUrl?: string | undefined;
158
+ termsUrl?: string | undefined;
145
159
  developerName?: string | undefined;
146
160
  }>>>;
147
161
  expiresAt: z.ZodOptional<z.ZodString>;
@@ -166,6 +180,8 @@ export declare const sessionStatusSchema: z.ZodObject<{
166
180
  description?: string | undefined;
167
181
  icon?: string | undefined;
168
182
  websiteUrl?: string | undefined;
183
+ privacyPolicyUrl?: string | undefined;
184
+ termsUrl?: string | undefined;
169
185
  developerName?: string | undefined;
170
186
  } | null | undefined;
171
187
  }, {
@@ -186,6 +202,8 @@ export declare const sessionStatusSchema: z.ZodObject<{
186
202
  description?: string | undefined;
187
203
  icon?: string | undefined;
188
204
  websiteUrl?: string | undefined;
205
+ privacyPolicyUrl?: string | undefined;
206
+ termsUrl?: string | undefined;
189
207
  developerName?: string | undefined;
190
208
  } | null | undefined;
191
209
  }>;