@oxyhq/contracts 0.13.0 → 0.13.1

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.
@@ -270,3 +270,48 @@ export declare const deviceTokenMintResponseSchema: z.ZodObject<{
270
270
  }>;
271
271
  export type DeviceTokenMintRequest = z.infer<typeof deviceTokenMintRequestSchema>;
272
272
  export type DeviceTokenMintResponse = z.infer<typeof deviceTokenMintResponseSchema>;
273
+ /** Request body for `POST /session/device/hub-ticket`. */
274
+ export declare const deviceHubTicketIssueRequestSchema: z.ZodObject<{
275
+ returnOrigin: z.ZodString;
276
+ }, "strip", z.ZodTypeAny, {
277
+ returnOrigin: string;
278
+ }, {
279
+ returnOrigin: string;
280
+ }>;
281
+ /** Response from `POST /session/device/hub-ticket`. */
282
+ export declare const deviceHubTicketIssueResponseSchema: z.ZodObject<{
283
+ ticket: z.ZodString;
284
+ expiresIn: z.ZodNumber;
285
+ }, "strip", z.ZodTypeAny, {
286
+ ticket: string;
287
+ expiresIn: number;
288
+ }, {
289
+ ticket: string;
290
+ expiresIn: number;
291
+ }>;
292
+ /** Request body for `POST /session/device/redeem-ticket`. */
293
+ export declare const deviceHubTicketRedeemRequestSchema: z.ZodObject<{
294
+ ticket: z.ZodString;
295
+ returnOrigin: z.ZodString;
296
+ }, "strip", z.ZodTypeAny, {
297
+ returnOrigin: string;
298
+ ticket: string;
299
+ }, {
300
+ returnOrigin: string;
301
+ ticket: string;
302
+ }>;
303
+ /** Response from `POST /session/device/redeem-ticket`. */
304
+ export declare const deviceHubTicketRedeemResponseSchema: z.ZodObject<{
305
+ deviceId: z.ZodString;
306
+ deviceSecret: z.ZodString;
307
+ }, "strip", z.ZodTypeAny, {
308
+ deviceId: string;
309
+ deviceSecret: string;
310
+ }, {
311
+ deviceId: string;
312
+ deviceSecret: string;
313
+ }>;
314
+ export type DeviceHubTicketIssueRequest = z.infer<typeof deviceHubTicketIssueRequestSchema>;
315
+ export type DeviceHubTicketIssueResponse = z.infer<typeof deviceHubTicketIssueResponseSchema>;
316
+ export type DeviceHubTicketRedeemRequest = z.infer<typeof deviceHubTicketRedeemRequestSchema>;
317
+ export type DeviceHubTicketRedeemResponse = z.infer<typeof deviceHubTicketRedeemResponseSchema>;
@@ -2,7 +2,7 @@
2
2
  * @oxyhq/contracts — single source of truth for API request/response contracts.
3
3
  *
4
4
  * Zod schemas plus their inferred types, shared by the backend (`@oxyhq/api`)
5
- * and the client SDKs (`@oxyhq/core`, `@oxyhq/auth`, `@oxyhq/services`). The
5
+ * and the client SDKs (`@oxyhq/core`, `@oxyhq/services`). The
6
6
  * producer validates its output and every consumer validates its input against
7
7
  * exactly the same definitions, so the wire shape cannot drift.
8
8
  *
@@ -13,8 +13,6 @@ export { userNameSchema, userResponseSchema, userProfileUpdateSchema, currentUse
13
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
- export { fedcmTokenPayloadSchema, } from './fedcmToken';
17
- export type { FedcmTokenPayload, } from './fedcmToken';
18
16
  export { recommendationExcludeTypeSchema, recommendationBoostSchema, recommendationSignalWeightsSchema, recommendationRequestSchema, recommendationCountSchema, recommendationItemSchema, recommendationResponseSchema, appEndorsementInputSchema, appInterestInputSchema, appUserSignalIngestSchema, appAffinityEventTypeSchema, appAffinityEventSchema, appAffinityEventsIngestSchema, } from './recommendations';
19
17
  export type { RecommendationExcludeType, RecommendationBoost, RecommendationSignalWeights, RecommendationRequest, RecommendationCount, RecommendationItem, RecommendationResponse, AppEndorsementInput, AppInterestInput, AppUserSignalIngest, AppAffinityEventType, AppAffinityEvent, AppAffinityEventsIngest, } from './recommendations';
20
18
  export { verificationMethodSchema, didServiceSchema, didDocumentSchema, signedRecordEnvelopeSchema, verifiedDomainSchema, domainVerificationRequestSchema, domainVerificationInstructionsSchema, authMethodEntrySchema, authMethodsResponseSchema, exportAttestationSchema, exportBundleSchema, } from './identity';
@@ -27,7 +25,7 @@ export { publicCardSchema, signedPublicCardSchema, realLifeAttestationRecordSche
27
25
  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
26
  export { linkPreviewSchema, linkPreviewBatchRequestSchema, linkPreviewBatchResponseSchema, linkPreviewResponseSchema, } from './links';
29
27
  export type { LinkPreviewStatus, LinkPreview, LinkPreviewBatchRequest, LinkPreviewBatchResponse, } from './links';
30
- export { sessionAccountSchema, deviceSessionStateSchema, activeTokenSchema, deviceSessionSyncSchema, deviceTokenMintRequestSchema, deviceTokenMintResponseSchema, } from './deviceSession';
31
- export type { SessionAccount, DeviceSessionState, ActiveToken, DeviceSessionSync, DeviceTokenMintRequest, DeviceTokenMintResponse, } from './deviceSession';
28
+ export { sessionAccountSchema, deviceSessionStateSchema, activeTokenSchema, deviceSessionSyncSchema, deviceTokenMintRequestSchema, deviceTokenMintResponseSchema, deviceHubTicketIssueRequestSchema, deviceHubTicketIssueResponseSchema, deviceHubTicketRedeemRequestSchema, deviceHubTicketRedeemResponseSchema, } from './deviceSession';
29
+ export type { SessionAccount, DeviceSessionState, ActiveToken, DeviceSessionSync, DeviceTokenMintRequest, DeviceTokenMintResponse, DeviceHubTicketIssueRequest, DeviceHubTicketIssueResponse, DeviceHubTicketRedeemRequest, DeviceHubTicketRedeemResponse, } from './deviceSession';
32
30
  export { loginResultSchema, } from './deviceBoot';
33
31
  export type { LoginTwoFactorRequired, LoginSessionResult, LoginResult, SecurityAlert, SecurityAlertAnomaly, } from './deviceBoot';
@@ -11,7 +11,7 @@
11
11
  *
12
12
  * This package (`@oxyhq/contracts`) is the dedicated, zero-dependency home for
13
13
  * these contracts so the backend (`@oxyhq/api`) and the client SDKs
14
- * (`@oxyhq/core`, `@oxyhq/auth`, `@oxyhq/services`) can all depend on it without
14
+ * (`@oxyhq/core`, `@oxyhq/services`) can all depend on it without
15
15
  * the backend having to depend on a client SDK to obtain its schemas.
16
16
  *
17
17
  * Faithful to the producers:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxyhq/contracts",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
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",
@@ -1,66 +0,0 @@
1
- "use strict";
2
- /**
3
- * Canonical contract for the FedCM ID-token JWT payload.
4
- *
5
- * DEAD SINCE THE WAVE-2 FEDCM DELETION (found during the comment sweep, not
6
- * fixed here — this is a published `@oxyhq/contracts` export, so removing it
7
- * is a breaking change/major-version decision, out of scope for a comment
8
- * fix): `POST /fedcm/exchange`, `fedcm.service.exchangeIdToken`, and
9
- * `packages/auth/server/index.ts`'s `mintSessionForClient` — every consumer
10
- * and producer this file describes — are all deleted. No current code
11
- * imports `fedcmTokenPayloadSchema` / `FedcmTokenPayload` outside this
12
- * package. Flag for a follow-up major-version cleanup.
13
- *
14
- * Original doc (historical, describes the now-deleted system):
15
- * SINGLE SOURCE OF TRUTH for the decoded claims of the HS256 ID token the auth
16
- * IdP (`auth.oxy.so`) signs and `POST /fedcm/exchange` consumes. The API decodes
17
- * the JWT, verifies its signature, then validates the resulting claim object
18
- * against this schema before trusting any field — a malformed payload (e.g. a
19
- * forged token whose signature happened to match but whose body is the wrong
20
- * shape) is rejected at the boundary instead of being cast and used.
21
- *
22
- * Validation philosophy — match the existing exchange behaviour exactly:
23
- * - This schema validates the STRUCTURAL shape of the decoded claims only
24
- * (types of the fields, not their presence or business-rule validity).
25
- * - `sub` / `aud` / `nonce` / `iss` / `exp` presence + value checks remain in
26
- * `fedcm.service.exchangeIdToken`, which returns the specific
27
- * `missing_required_fields` / `invalid_issuer` / `token_expired` errors. So
28
- * every field is `.optional()` here: a token missing `nonce` must still reach
29
- * the `missing_required_fields` branch, not be rejected as a malformed token.
30
- * - `.passthrough()` preserves any additional claims the IdP may add without a
31
- * coordinated contract bump.
32
- *
33
- * Faithful to the producer:
34
- * - `packages/auth/server/index.ts` `mintSessionForClient` — builds the
35
- * assertion with `iss` (central issuer), `sub` (user id), `aud` (RP origin),
36
- * `exp` / `iat` (numeric epoch seconds), and `nonce` (the server-minted,
37
- * origin-bound nonce).
38
- *
39
- * Platform-agnostic — zod only, no react/react-native/expo. ESM-safe (no
40
- * `require()`).
41
- */
42
- Object.defineProperty(exports, "__esModule", { value: true });
43
- exports.fedcmTokenPayloadSchema = void 0;
44
- const zod_1 = require("zod");
45
- /**
46
- * Decoded FedCM ID-token claims. Every field is optional because presence is
47
- * enforced downstream (see module doc); the schema's job is to guarantee that
48
- * any present claim has the correct primitive type before it is read.
49
- */
50
- exports.fedcmTokenPayloadSchema = zod_1.z
51
- .object({
52
- iss: zod_1.z.string().optional(),
53
- sub: zod_1.z.string().optional(),
54
- aud: zod_1.z.string().optional(),
55
- exp: zod_1.z.number().optional(),
56
- iat: zod_1.z.number().optional(),
57
- nonce: zod_1.z.string().optional(),
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: zod_1.z.string().optional(),
65
- })
66
- .passthrough();
@@ -1,63 +0,0 @@
1
- /**
2
- * Canonical contract for the FedCM ID-token JWT payload.
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):
14
- * SINGLE SOURCE OF TRUTH for the decoded claims of the HS256 ID token the auth
15
- * IdP (`auth.oxy.so`) signs and `POST /fedcm/exchange` consumes. The API decodes
16
- * the JWT, verifies its signature, then validates the resulting claim object
17
- * against this schema before trusting any field — a malformed payload (e.g. a
18
- * forged token whose signature happened to match but whose body is the wrong
19
- * shape) is rejected at the boundary instead of being cast and used.
20
- *
21
- * Validation philosophy — match the existing exchange behaviour exactly:
22
- * - This schema validates the STRUCTURAL shape of the decoded claims only
23
- * (types of the fields, not their presence or business-rule validity).
24
- * - `sub` / `aud` / `nonce` / `iss` / `exp` presence + value checks remain in
25
- * `fedcm.service.exchangeIdToken`, which returns the specific
26
- * `missing_required_fields` / `invalid_issuer` / `token_expired` errors. So
27
- * every field is `.optional()` here: a token missing `nonce` must still reach
28
- * the `missing_required_fields` branch, not be rejected as a malformed token.
29
- * - `.passthrough()` preserves any additional claims the IdP may add without a
30
- * coordinated contract bump.
31
- *
32
- * Faithful to the producer:
33
- * - `packages/auth/server/index.ts` `mintSessionForClient` — builds the
34
- * assertion with `iss` (central issuer), `sub` (user id), `aud` (RP origin),
35
- * `exp` / `iat` (numeric epoch seconds), and `nonce` (the server-minted,
36
- * origin-bound nonce).
37
- *
38
- * Platform-agnostic — zod only, no react/react-native/expo. ESM-safe (no
39
- * `require()`).
40
- */
41
- import { z } from 'zod';
42
- /**
43
- * Decoded FedCM ID-token claims. Every field is optional because presence is
44
- * enforced downstream (see module doc); the schema's job is to guarantee that
45
- * any present claim has the correct primitive type before it is read.
46
- */
47
- export const fedcmTokenPayloadSchema = z
48
- .object({
49
- iss: z.string().optional(),
50
- sub: z.string().optional(),
51
- aud: z.string().optional(),
52
- exp: z.number().optional(),
53
- iat: z.number().optional(),
54
- nonce: z.string().optional(),
55
- /**
56
- * An explicit central deviceId minted by the IdP, threaded through so the
57
- * RP session can inherit a unified device id instead of deriving one from
58
- * the (userId, RP origin) stableDeviceKey. Optional and additive — omitted
59
- * tokens fall back to the existing stableDeviceKey/UA-IP derivation.
60
- */
61
- deviceId: z.string().optional(),
62
- })
63
- .passthrough();
@@ -1,90 +0,0 @@
1
- /**
2
- * Canonical contract for the FedCM ID-token JWT payload.
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):
14
- * SINGLE SOURCE OF TRUTH for the decoded claims of the HS256 ID token the auth
15
- * IdP (`auth.oxy.so`) signs and `POST /fedcm/exchange` consumes. The API decodes
16
- * the JWT, verifies its signature, then validates the resulting claim object
17
- * against this schema before trusting any field — a malformed payload (e.g. a
18
- * forged token whose signature happened to match but whose body is the wrong
19
- * shape) is rejected at the boundary instead of being cast and used.
20
- *
21
- * Validation philosophy — match the existing exchange behaviour exactly:
22
- * - This schema validates the STRUCTURAL shape of the decoded claims only
23
- * (types of the fields, not their presence or business-rule validity).
24
- * - `sub` / `aud` / `nonce` / `iss` / `exp` presence + value checks remain in
25
- * `fedcm.service.exchangeIdToken`, which returns the specific
26
- * `missing_required_fields` / `invalid_issuer` / `token_expired` errors. So
27
- * every field is `.optional()` here: a token missing `nonce` must still reach
28
- * the `missing_required_fields` branch, not be rejected as a malformed token.
29
- * - `.passthrough()` preserves any additional claims the IdP may add without a
30
- * coordinated contract bump.
31
- *
32
- * Faithful to the producer:
33
- * - `packages/auth/server/index.ts` `mintSessionForClient` — builds the
34
- * assertion with `iss` (central issuer), `sub` (user id), `aud` (RP origin),
35
- * `exp` / `iat` (numeric epoch seconds), and `nonce` (the server-minted,
36
- * origin-bound nonce).
37
- *
38
- * Platform-agnostic — zod only, no react/react-native/expo. ESM-safe (no
39
- * `require()`).
40
- */
41
- import { z } from 'zod';
42
- /**
43
- * Decoded FedCM ID-token claims. Every field is optional because presence is
44
- * enforced downstream (see module doc); the schema's job is to guarantee that
45
- * any present claim has the correct primitive type before it is read.
46
- */
47
- export declare const fedcmTokenPayloadSchema: z.ZodObject<{
48
- iss: z.ZodOptional<z.ZodString>;
49
- sub: z.ZodOptional<z.ZodString>;
50
- aud: z.ZodOptional<z.ZodString>;
51
- exp: z.ZodOptional<z.ZodNumber>;
52
- iat: z.ZodOptional<z.ZodNumber>;
53
- nonce: z.ZodOptional<z.ZodString>;
54
- /**
55
- * An explicit central deviceId minted by the IdP, threaded through so the
56
- * RP session can inherit a unified device id instead of deriving one from
57
- * the (userId, RP origin) stableDeviceKey. Optional and additive — omitted
58
- * tokens fall back to the existing stableDeviceKey/UA-IP derivation.
59
- */
60
- deviceId: z.ZodOptional<z.ZodString>;
61
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
62
- iss: z.ZodOptional<z.ZodString>;
63
- sub: z.ZodOptional<z.ZodString>;
64
- aud: z.ZodOptional<z.ZodString>;
65
- exp: z.ZodOptional<z.ZodNumber>;
66
- iat: z.ZodOptional<z.ZodNumber>;
67
- nonce: z.ZodOptional<z.ZodString>;
68
- /**
69
- * An explicit central deviceId minted by the IdP, threaded through so the
70
- * RP session can inherit a unified device id instead of deriving one from
71
- * the (userId, RP origin) stableDeviceKey. Optional and additive — omitted
72
- * tokens fall back to the existing stableDeviceKey/UA-IP derivation.
73
- */
74
- deviceId: z.ZodOptional<z.ZodString>;
75
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
76
- iss: z.ZodOptional<z.ZodString>;
77
- sub: z.ZodOptional<z.ZodString>;
78
- aud: z.ZodOptional<z.ZodString>;
79
- exp: z.ZodOptional<z.ZodNumber>;
80
- iat: z.ZodOptional<z.ZodNumber>;
81
- nonce: z.ZodOptional<z.ZodString>;
82
- /**
83
- * An explicit central deviceId minted by the IdP, threaded through so the
84
- * RP session can inherit a unified device id instead of deriving one from
85
- * the (userId, RP origin) stableDeviceKey. Optional and additive — omitted
86
- * tokens fall back to the existing stableDeviceKey/UA-IP derivation.
87
- */
88
- deviceId: z.ZodOptional<z.ZodString>;
89
- }, z.ZodTypeAny, "passthrough">>;
90
- export type FedcmTokenPayload = z.infer<typeof fedcmTokenPayloadSchema>;