@oxyhq/contracts 0.10.0 → 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.
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/fedcmToken.js +10 -0
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/sessionStatus.js +10 -6
- package/dist/cjs/userResponse.js +5 -6
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/fedcmToken.js +10 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/sessionStatus.js +10 -6
- package/dist/esm/userResponse.js +4 -5
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/deviceBoot.d.ts +1 -1
- package/dist/types/fedcmToken.d.ts +10 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/sessionStatus.d.ts +24 -6
- package/dist/types/userResponse.d.ts +6 -7
- package/package.json +1 -1
|
@@ -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
|
|
248
|
+
* device. Replaces the IdP's legacy cookie-based chooser feed.
|
|
249
249
|
*/
|
|
250
250
|
export interface DeviceResolveResponse {
|
|
251
251
|
activeAccountId: string | null;
|
|
@@ -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
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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, currentUserResponseSchema,
|
|
13
|
-
export type { UserNameResponse, UserResponse, UserProfileUpdate, CurrentUserResponseContract,
|
|
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`, `
|
|
23
|
-
* absent (never serialized as `null`), so
|
|
24
|
-
* `.nullable()`. `type` is the `Application.type`
|
|
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` / `
|
|
52
|
-
* value is absent — it never writes `null`
|
|
53
|
-
* attached for non-official apps when a name
|
|
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
|
}>;
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
*
|
|
17
17
|
* Faithful to the producers:
|
|
18
18
|
* - `packages/api/src/utils/userTransform.ts` `formatUserResponse` — the
|
|
19
|
-
* canonical serialization used by
|
|
19
|
+
* canonical serialization used by the device-first bootstrap/exchange
|
|
20
|
+
* endpoints (`deviceAuth.ts`), login/signup, device sessions, etc.
|
|
20
21
|
* Emits `id` (NOT `_id`), forwards `username` verbatim (may be absent), and
|
|
21
22
|
* emits `name` as the structured `{ first, last, full, displayName }`
|
|
22
23
|
* subdocument.
|
|
@@ -24,8 +25,6 @@
|
|
|
24
25
|
* `''`; `full` and `displayName` are Mongoose VIRTUALS. Formatted API
|
|
25
26
|
* responses compose both fields, while raw-document responses may omit the
|
|
26
27
|
* virtuals if the query did not materialise them.
|
|
27
|
-
* - The `/auth/refresh-all` handler in `packages/api/src/routes/auth.ts`, whose
|
|
28
|
-
* per-slot `authuser` is the numeric `oxy_rt_${authuser}` cookie slot.
|
|
29
28
|
*
|
|
30
29
|
* Platform-agnostic — zod only, no react/react-native/expo. ESM-safe (no
|
|
31
30
|
* `require()`).
|
|
@@ -457,7 +456,7 @@ export type CurrentUserResponseContract = z.infer<typeof currentUserResponseSche
|
|
|
457
456
|
* session). Backs the multi-account chooser. The embedded user mirrors
|
|
458
457
|
* `formatUserResponse`; it is nullable on slots that lost their user document.
|
|
459
458
|
*/
|
|
460
|
-
export declare const
|
|
459
|
+
export declare const deviceLinkedSessionSchema: z.ZodObject<{
|
|
461
460
|
sessionId: z.ZodString;
|
|
462
461
|
isCurrent: z.ZodOptional<z.ZodBoolean>;
|
|
463
462
|
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
@@ -615,9 +614,9 @@ export declare const deviceSessionAccountSchema: z.ZodObject<{
|
|
|
615
614
|
verifiedDomains: z.ZodOptional<z.ZodArray<z.ZodType<import("./identity").VerifiedDomain, z.ZodTypeDef, import("./identity").VerifiedDomain>, "many">>;
|
|
616
615
|
}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
617
616
|
}>;
|
|
618
|
-
export type
|
|
617
|
+
export type DeviceLinkedSessionResponse = z.infer<typeof deviceLinkedSessionSchema>;
|
|
619
618
|
/** Wire shape of `GET /session/device/sessions/:sessionId` (an array). */
|
|
620
|
-
export declare const
|
|
619
|
+
export declare const deviceLinkedSessionsResponseSchema: z.ZodArray<z.ZodObject<{
|
|
621
620
|
sessionId: z.ZodString;
|
|
622
621
|
isCurrent: z.ZodOptional<z.ZodBoolean>;
|
|
623
622
|
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
@@ -775,7 +774,7 @@ export declare const deviceSessionsResponseSchema: z.ZodArray<z.ZodObject<{
|
|
|
775
774
|
verifiedDomains: z.ZodOptional<z.ZodArray<z.ZodType<import("./identity").VerifiedDomain, z.ZodTypeDef, import("./identity").VerifiedDomain>, "many">>;
|
|
776
775
|
}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
777
776
|
}>, "many">;
|
|
778
|
-
export type
|
|
777
|
+
export type DeviceLinkedSessionsResponseContract = z.infer<typeof deviceLinkedSessionsResponseSchema>;
|
|
779
778
|
/**
|
|
780
779
|
* Safely parse a value against a contract schema. Returns the parsed (typed)
|
|
781
780
|
* value, or `null` when validation fails — the same ergonomics the auth app's
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxyhq/contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "OxyHQ API contracts — single source of truth for request/response Zod schemas and inferred types, shared by the backend and the client SDKs",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|