@oxy.so/contracts 6.21.0 → 6.23.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.
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* `./client/platformSession.ts`.
|
|
15
15
|
*/
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.hostTokenValidationSchema = exports.hostTokenClaimSchema = exports.deviceAppTokenResponseSchema = exports.deviceAppTokenRequestSchema = exports.deviceAppTokenAttestationSchema = exports.devicePlatformRequestSchema = exports.platformClientSchema = exports.PLATFORM_HOSTS = exports.OXYOS_DESKTOP_ENTRY_ID_PATTERN = exports.DEVICE_APP_TOKEN_TTL_SECONDS = exports.DEVICE_APP_TOKEN_ERROR_CODES = exports.APP_TOKEN_DEVICE_ACCESS_DENIED = void 0;
|
|
17
|
+
exports.hostTokenValidationSchema = exports.hostTokenClaimSchema = exports.deviceAppTokenResponseSchema = exports.deviceAppTokenRequestSchema = exports.deviceAppTokenAttestationSchema = exports.devicePlatformRequestSchema = exports.redemptionKeySchema = exports.devicePlatformConfirmResponseSchema = exports.devicePlatformConfirmRequestSchema = exports.PLATFORM_CREDENTIAL_PENDING_MS = exports.platformClientSchema = exports.PLATFORM_HOSTS = exports.OXYOS_DESKTOP_ENTRY_ID_PATTERN = exports.DEVICE_APP_TOKEN_TTL_SECONDS = exports.DEVICE_APP_TOKEN_ERROR_CODES = exports.APP_TOKEN_DEVICE_ACCESS_DENIED = void 0;
|
|
18
18
|
const zod_1 = require("zod");
|
|
19
19
|
const appAssertions_1 = require("./appAssertions");
|
|
20
20
|
const platformSession_1 = require("./client/platformSession");
|
|
@@ -39,7 +39,35 @@ const publicClientIdSchema = zod_1.z.string().check((0, stringChecks_1.utf16MinL
|
|
|
39
39
|
exports.platformClientSchema = zod_1.z.strictObject({
|
|
40
40
|
platform: appAssertions_1.platformHostSchema,
|
|
41
41
|
clientId: publicClientIdSchema,
|
|
42
|
+
/**
|
|
43
|
+
* R8: the platform confirms every credential it receives
|
|
44
|
+
* (`POST /session/device/platform/confirm`). The credential is then PENDING
|
|
45
|
+
* until confirmed: it proves nothing, and is gone ten minutes after the QR's
|
|
46
|
+
* claim (the device-proof route) or the sign-in (the password and second
|
|
47
|
+
* factor routes); the credential the sign-in's device proof presented is
|
|
48
|
+
* retired only by the confirmation. Without it, as before R8.
|
|
49
|
+
*/
|
|
50
|
+
confirms: zod_1.z.literal(true).optional(),
|
|
42
51
|
});
|
|
52
|
+
/** How long a pending platform credential waits for its confirmation (R8). */
|
|
53
|
+
exports.PLATFORM_CREDENTIAL_PENDING_MS = 10 * 60 * 1000;
|
|
54
|
+
/**
|
|
55
|
+
* `POST /session/device/platform/confirm` (R8): the pending platform credential
|
|
56
|
+
* confirmed by its own holder proof, nothing else. Idempotent: a credential
|
|
57
|
+
* already confirmed is the same answer. Every other proof (unknown, expired,
|
|
58
|
+
* not a platform's) is one 401 `invalid_grant`.
|
|
59
|
+
*/
|
|
60
|
+
exports.devicePlatformConfirmRequestSchema = zod_1.z.strictObject(deviceSession_1.deviceProofSchema.shape);
|
|
61
|
+
/** The confirmation's answer. */
|
|
62
|
+
exports.devicePlatformConfirmResponseSchema = zod_1.z.strictObject({
|
|
63
|
+
confirmed: zod_1.z.literal(true),
|
|
64
|
+
});
|
|
65
|
+
/**
|
|
66
|
+
* The key that makes a QR redemption repeatable (ADR 0058 R7): at least 256
|
|
67
|
+
* random bits, base64url, chosen by the platform SERVICE for one setup and
|
|
68
|
+
* never shown to its setup client. Oxy keeps only its hash.
|
|
69
|
+
*/
|
|
70
|
+
exports.redemptionKeySchema = zod_1.z.string().regex(/^[A-Za-z0-9_-]{43,128}$/);
|
|
43
71
|
/**
|
|
44
72
|
* `POST /session/device/platform`: a platform's credential from the QR
|
|
45
73
|
* approval (ADR 0058 2.1, amended 2026-11-08). `device` is the holder
|
|
@@ -50,10 +78,18 @@ exports.platformClientSchema = zod_1.z.strictObject({
|
|
|
50
78
|
* proof is spent once; the answer is the password sign-in's (`LoginResult`),
|
|
51
79
|
* its `deviceSecret` the platform credential. Every proof that is not
|
|
52
80
|
* redeemable gets the same 401 (`invalid_grant`).
|
|
81
|
+
*
|
|
82
|
+
* `redemptionKey` (R7, optional): sent with the first redemption, it lets the
|
|
83
|
+
* same proof AND the same key be redeemed again within the claim's original
|
|
84
|
+
* ten minutes, should the answer be lost or the platform's own setup fail:
|
|
85
|
+
* each repetition revokes the platform credential the previous one issued and
|
|
86
|
+
* issues another. Without a key, or with another one, a spent proof is the
|
|
87
|
+
* same 401.
|
|
53
88
|
*/
|
|
54
89
|
exports.devicePlatformRequestSchema = zod_1.z.strictObject({
|
|
55
90
|
device: zod_1.z.strictObject(deviceSession_1.deviceProofSchema.shape),
|
|
56
91
|
platformClient: exports.platformClientSchema,
|
|
92
|
+
redemptionKey: exports.redemptionKeySchema.optional(),
|
|
57
93
|
});
|
|
58
94
|
/**
|
|
59
95
|
* Which application the token is for, as the platform vouches for it:
|
|
@@ -32,7 +32,35 @@ const publicClientIdSchema = z.string().check(utf16MinLength(1)).check(utf16MaxL
|
|
|
32
32
|
export const platformClientSchema = z.strictObject({
|
|
33
33
|
platform: platformHostSchema,
|
|
34
34
|
clientId: publicClientIdSchema,
|
|
35
|
+
/**
|
|
36
|
+
* R8: the platform confirms every credential it receives
|
|
37
|
+
* (`POST /session/device/platform/confirm`). The credential is then PENDING
|
|
38
|
+
* until confirmed: it proves nothing, and is gone ten minutes after the QR's
|
|
39
|
+
* claim (the device-proof route) or the sign-in (the password and second
|
|
40
|
+
* factor routes); the credential the sign-in's device proof presented is
|
|
41
|
+
* retired only by the confirmation. Without it, as before R8.
|
|
42
|
+
*/
|
|
43
|
+
confirms: z.literal(true).optional(),
|
|
35
44
|
});
|
|
45
|
+
/** How long a pending platform credential waits for its confirmation (R8). */
|
|
46
|
+
export const PLATFORM_CREDENTIAL_PENDING_MS = 10 * 60 * 1000;
|
|
47
|
+
/**
|
|
48
|
+
* `POST /session/device/platform/confirm` (R8): the pending platform credential
|
|
49
|
+
* confirmed by its own holder proof, nothing else. Idempotent: a credential
|
|
50
|
+
* already confirmed is the same answer. Every other proof (unknown, expired,
|
|
51
|
+
* not a platform's) is one 401 `invalid_grant`.
|
|
52
|
+
*/
|
|
53
|
+
export const devicePlatformConfirmRequestSchema = z.strictObject(deviceProofSchema.shape);
|
|
54
|
+
/** The confirmation's answer. */
|
|
55
|
+
export const devicePlatformConfirmResponseSchema = z.strictObject({
|
|
56
|
+
confirmed: z.literal(true),
|
|
57
|
+
});
|
|
58
|
+
/**
|
|
59
|
+
* The key that makes a QR redemption repeatable (ADR 0058 R7): at least 256
|
|
60
|
+
* random bits, base64url, chosen by the platform SERVICE for one setup and
|
|
61
|
+
* never shown to its setup client. Oxy keeps only its hash.
|
|
62
|
+
*/
|
|
63
|
+
export const redemptionKeySchema = z.string().regex(/^[A-Za-z0-9_-]{43,128}$/);
|
|
36
64
|
/**
|
|
37
65
|
* `POST /session/device/platform`: a platform's credential from the QR
|
|
38
66
|
* approval (ADR 0058 2.1, amended 2026-11-08). `device` is the holder
|
|
@@ -43,10 +71,18 @@ export const platformClientSchema = z.strictObject({
|
|
|
43
71
|
* proof is spent once; the answer is the password sign-in's (`LoginResult`),
|
|
44
72
|
* its `deviceSecret` the platform credential. Every proof that is not
|
|
45
73
|
* redeemable gets the same 401 (`invalid_grant`).
|
|
74
|
+
*
|
|
75
|
+
* `redemptionKey` (R7, optional): sent with the first redemption, it lets the
|
|
76
|
+
* same proof AND the same key be redeemed again within the claim's original
|
|
77
|
+
* ten minutes, should the answer be lost or the platform's own setup fail:
|
|
78
|
+
* each repetition revokes the platform credential the previous one issued and
|
|
79
|
+
* issues another. Without a key, or with another one, a spent proof is the
|
|
80
|
+
* same 401.
|
|
46
81
|
*/
|
|
47
82
|
export const devicePlatformRequestSchema = z.strictObject({
|
|
48
83
|
device: z.strictObject(deviceProofSchema.shape),
|
|
49
84
|
platformClient: platformClientSchema,
|
|
85
|
+
redemptionKey: redemptionKeySchema.optional(),
|
|
50
86
|
});
|
|
51
87
|
/**
|
|
52
88
|
* Which application the token is for, as the platform vouches for it:
|
|
@@ -180,7 +180,7 @@ export declare const purchaseApprovalCheck: Check<{
|
|
|
180
180
|
id: string;
|
|
181
181
|
childAccountId: string;
|
|
182
182
|
applicationId: string;
|
|
183
|
-
status: "pending" | "approved" | "rejected" | "
|
|
183
|
+
status: "pending" | "approved" | "rejected" | "confirmed" | "cancelled" | "reserved";
|
|
184
184
|
createdAt: string;
|
|
185
185
|
receiptReference: string | null;
|
|
186
186
|
}>;
|
|
@@ -202,7 +202,7 @@ export declare const purchaseApprovalListCheck: Check<{
|
|
|
202
202
|
id: string;
|
|
203
203
|
childAccountId: string;
|
|
204
204
|
applicationId: string;
|
|
205
|
-
status: "pending" | "approved" | "rejected" | "
|
|
205
|
+
status: "pending" | "approved" | "rejected" | "confirmed" | "cancelled" | "reserved";
|
|
206
206
|
createdAt: string;
|
|
207
207
|
receiptReference: string | null;
|
|
208
208
|
}[];
|
|
@@ -31,7 +31,30 @@ export declare const platformClientSchema: z.ZodObject<{
|
|
|
31
31
|
astro: "astro";
|
|
32
32
|
}>;
|
|
33
33
|
clientId: z.ZodString;
|
|
34
|
+
confirms: z.ZodOptional<z.ZodLiteral<true>>;
|
|
34
35
|
}, z.core.$strict>;
|
|
36
|
+
/** How long a pending platform credential waits for its confirmation (R8). */
|
|
37
|
+
export declare const PLATFORM_CREDENTIAL_PENDING_MS: number;
|
|
38
|
+
/**
|
|
39
|
+
* `POST /session/device/platform/confirm` (R8): the pending platform credential
|
|
40
|
+
* confirmed by its own holder proof, nothing else. Idempotent: a credential
|
|
41
|
+
* already confirmed is the same answer. Every other proof (unknown, expired,
|
|
42
|
+
* not a platform's) is one 401 `invalid_grant`.
|
|
43
|
+
*/
|
|
44
|
+
export declare const devicePlatformConfirmRequestSchema: z.ZodObject<{
|
|
45
|
+
deviceId: z.ZodString;
|
|
46
|
+
deviceSecret: z.ZodString;
|
|
47
|
+
}, z.core.$strict>;
|
|
48
|
+
/** The confirmation's answer. */
|
|
49
|
+
export declare const devicePlatformConfirmResponseSchema: z.ZodObject<{
|
|
50
|
+
confirmed: z.ZodLiteral<true>;
|
|
51
|
+
}, z.core.$strict>;
|
|
52
|
+
/**
|
|
53
|
+
* The key that makes a QR redemption repeatable (ADR 0058 R7): at least 256
|
|
54
|
+
* random bits, base64url, chosen by the platform SERVICE for one setup and
|
|
55
|
+
* never shown to its setup client. Oxy keeps only its hash.
|
|
56
|
+
*/
|
|
57
|
+
export declare const redemptionKeySchema: z.ZodString;
|
|
35
58
|
/**
|
|
36
59
|
* `POST /session/device/platform`: a platform's credential from the QR
|
|
37
60
|
* approval (ADR 0058 2.1, amended 2026-11-08). `device` is the holder
|
|
@@ -42,6 +65,13 @@ export declare const platformClientSchema: z.ZodObject<{
|
|
|
42
65
|
* proof is spent once; the answer is the password sign-in's (`LoginResult`),
|
|
43
66
|
* its `deviceSecret` the platform credential. Every proof that is not
|
|
44
67
|
* redeemable gets the same 401 (`invalid_grant`).
|
|
68
|
+
*
|
|
69
|
+
* `redemptionKey` (R7, optional): sent with the first redemption, it lets the
|
|
70
|
+
* same proof AND the same key be redeemed again within the claim's original
|
|
71
|
+
* ten minutes, should the answer be lost or the platform's own setup fail:
|
|
72
|
+
* each repetition revokes the platform credential the previous one issued and
|
|
73
|
+
* issues another. Without a key, or with another one, a spent proof is the
|
|
74
|
+
* same 401.
|
|
45
75
|
*/
|
|
46
76
|
export declare const devicePlatformRequestSchema: z.ZodObject<{
|
|
47
77
|
device: z.ZodObject<{
|
|
@@ -54,7 +84,9 @@ export declare const devicePlatformRequestSchema: z.ZodObject<{
|
|
|
54
84
|
astro: "astro";
|
|
55
85
|
}>;
|
|
56
86
|
clientId: z.ZodString;
|
|
87
|
+
confirms: z.ZodOptional<z.ZodLiteral<true>>;
|
|
57
88
|
}, z.core.$strict>;
|
|
89
|
+
redemptionKey: z.ZodOptional<z.ZodString>;
|
|
58
90
|
}, z.core.$strict>;
|
|
59
91
|
/**
|
|
60
92
|
* Which application the token is for, as the platform vouches for it:
|
|
@@ -147,6 +179,8 @@ export type PlatformHost = (typeof PLATFORM_HOSTS)[number];
|
|
|
147
179
|
export type DeviceAppTokenErrorCode = (typeof DEVICE_APP_TOKEN_ERROR_CODES)[number];
|
|
148
180
|
export type PlatformClient = z.infer<typeof platformClientSchema>;
|
|
149
181
|
export type DevicePlatformRequest = z.infer<typeof devicePlatformRequestSchema>;
|
|
182
|
+
export type DevicePlatformConfirmRequest = z.infer<typeof devicePlatformConfirmRequestSchema>;
|
|
183
|
+
export type DevicePlatformConfirmResponse = z.infer<typeof devicePlatformConfirmResponseSchema>;
|
|
150
184
|
export type DeviceAppTokenAttestation = z.infer<typeof deviceAppTokenAttestationSchema>;
|
|
151
185
|
export type DeviceAppTokenRequest = z.infer<typeof deviceAppTokenRequestSchema>;
|
|
152
186
|
export type DeviceAppTokenResponse = z.infer<typeof deviceAppTokenResponseSchema>;
|
package/dist/types/safety.d.ts
CHANGED
|
@@ -451,8 +451,8 @@ export declare const purchaseApprovalSchema: z.ZodObject<{
|
|
|
451
451
|
pending: "pending";
|
|
452
452
|
approved: "approved";
|
|
453
453
|
rejected: "rejected";
|
|
454
|
-
cancelled: "cancelled";
|
|
455
454
|
confirmed: "confirmed";
|
|
455
|
+
cancelled: "cancelled";
|
|
456
456
|
reserved: "reserved";
|
|
457
457
|
}>;
|
|
458
458
|
createdAt: z.ZodString;
|
|
@@ -479,8 +479,8 @@ export declare const purchaseApprovalSummarySchema: z.ZodObject<{
|
|
|
479
479
|
pending: "pending";
|
|
480
480
|
approved: "approved";
|
|
481
481
|
rejected: "rejected";
|
|
482
|
-
cancelled: "cancelled";
|
|
483
482
|
confirmed: "confirmed";
|
|
483
|
+
cancelled: "cancelled";
|
|
484
484
|
reserved: "reserved";
|
|
485
485
|
}>;
|
|
486
486
|
createdAt: z.ZodString;
|
|
@@ -508,8 +508,8 @@ export declare const purchaseApprovalListSchema: z.ZodObject<{
|
|
|
508
508
|
pending: "pending";
|
|
509
509
|
approved: "approved";
|
|
510
510
|
rejected: "rejected";
|
|
511
|
-
cancelled: "cancelled";
|
|
512
511
|
confirmed: "confirmed";
|
|
512
|
+
cancelled: "cancelled";
|
|
513
513
|
reserved: "reserved";
|
|
514
514
|
}>;
|
|
515
515
|
createdAt: z.ZodString;
|
package/dist/types/signIn.d.ts
CHANGED
|
@@ -130,6 +130,7 @@ export declare const passwordSignInRequestSchema: z.ZodObject<{
|
|
|
130
130
|
astro: "astro";
|
|
131
131
|
}>;
|
|
132
132
|
clientId: z.ZodString;
|
|
133
|
+
confirms: z.ZodOptional<z.ZodLiteral<true>>;
|
|
133
134
|
}, z.core.$strict>>;
|
|
134
135
|
deviceName: z.ZodOptional<z.ZodString>;
|
|
135
136
|
deviceFingerprint: z.ZodOptional<z.ZodString>;
|
|
@@ -153,6 +154,7 @@ export declare const secondFactorSignInRequestSchema: z.ZodObject<{
|
|
|
153
154
|
astro: "astro";
|
|
154
155
|
}>;
|
|
155
156
|
clientId: z.ZodString;
|
|
157
|
+
confirms: z.ZodOptional<z.ZodLiteral<true>>;
|
|
156
158
|
}, z.core.$strict>>;
|
|
157
159
|
deviceName: z.ZodOptional<z.ZodString>;
|
|
158
160
|
deviceFingerprint: z.ZodOptional<z.ZodString>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxy.so/contracts",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.23.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",
|