@oxy.so/contracts 6.22.0 → 6.24.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.redemptionKeySchema = 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.devicePlatformWindowsSchema = exports.redemptionWindowSchema = 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,6 +39,28 @@ 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(),
|
|
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),
|
|
42
64
|
});
|
|
43
65
|
/**
|
|
44
66
|
* The key that makes a QR redemption repeatable (ADR 0058 R7): at least 256
|
|
@@ -69,6 +91,32 @@ exports.devicePlatformRequestSchema = zod_1.z.strictObject({
|
|
|
69
91
|
platformClient: exports.platformClientSchema,
|
|
70
92
|
redemptionKey: exports.redemptionKeySchema.optional(),
|
|
71
93
|
});
|
|
94
|
+
/**
|
|
95
|
+
* A window of the QR's redemption (R9), as the server counts it when it
|
|
96
|
+
* answers: `expiresInSeconds` (whole seconds, never negative) is what a
|
|
97
|
+
* platform measures against its own monotonic clock from the moment the
|
|
98
|
+
* answer arrives, so neither clock's setting matters; `expiresAt` (ISO 8601)
|
|
99
|
+
* is for logs and people.
|
|
100
|
+
*/
|
|
101
|
+
exports.redemptionWindowSchema = zod_1.z.strictObject({
|
|
102
|
+
expiresAt: zod_1.z.string().datetime(),
|
|
103
|
+
expiresInSeconds: zod_1.z.number().int().nonnegative(),
|
|
104
|
+
});
|
|
105
|
+
/**
|
|
106
|
+
* What `POST /session/device/platform` adds to an answer that concerns a
|
|
107
|
+
* known proof (R9): `redemptionWindow`, when the claim's ten minutes end (the
|
|
108
|
+
* proof may be redeemed, and redeemed again with its key, until then); and,
|
|
109
|
+
* on a 200 to a platform that confirms (R8), `confirmWindow`, when the pending
|
|
110
|
+
* credential it issued must be confirmed by. The 200 carries both beside the
|
|
111
|
+
* sign-in's `LoginResult`; a 429 asked once the proof is known to sign an
|
|
112
|
+
* account in (the account's budget) carries `redemptionWindow` beside its
|
|
113
|
+
* `retryAfterSeconds`. A refusal of a proof that is not redeemable carries
|
|
114
|
+
* neither: it stays the one identical 401.
|
|
115
|
+
*/
|
|
116
|
+
exports.devicePlatformWindowsSchema = zod_1.z.object({
|
|
117
|
+
redemptionWindow: exports.redemptionWindowSchema,
|
|
118
|
+
confirmWindow: exports.redemptionWindowSchema.optional(),
|
|
119
|
+
});
|
|
72
120
|
/**
|
|
73
121
|
* Which application the token is for, as the platform vouches for it:
|
|
74
122
|
*
|
|
@@ -32,6 +32,28 @@ 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(),
|
|
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),
|
|
35
57
|
});
|
|
36
58
|
/**
|
|
37
59
|
* The key that makes a QR redemption repeatable (ADR 0058 R7): at least 256
|
|
@@ -62,6 +84,32 @@ export const devicePlatformRequestSchema = z.strictObject({
|
|
|
62
84
|
platformClient: platformClientSchema,
|
|
63
85
|
redemptionKey: redemptionKeySchema.optional(),
|
|
64
86
|
});
|
|
87
|
+
/**
|
|
88
|
+
* A window of the QR's redemption (R9), as the server counts it when it
|
|
89
|
+
* answers: `expiresInSeconds` (whole seconds, never negative) is what a
|
|
90
|
+
* platform measures against its own monotonic clock from the moment the
|
|
91
|
+
* answer arrives, so neither clock's setting matters; `expiresAt` (ISO 8601)
|
|
92
|
+
* is for logs and people.
|
|
93
|
+
*/
|
|
94
|
+
export const redemptionWindowSchema = z.strictObject({
|
|
95
|
+
expiresAt: z.string().datetime(),
|
|
96
|
+
expiresInSeconds: z.number().int().nonnegative(),
|
|
97
|
+
});
|
|
98
|
+
/**
|
|
99
|
+
* What `POST /session/device/platform` adds to an answer that concerns a
|
|
100
|
+
* known proof (R9): `redemptionWindow`, when the claim's ten minutes end (the
|
|
101
|
+
* proof may be redeemed, and redeemed again with its key, until then); and,
|
|
102
|
+
* on a 200 to a platform that confirms (R8), `confirmWindow`, when the pending
|
|
103
|
+
* credential it issued must be confirmed by. The 200 carries both beside the
|
|
104
|
+
* sign-in's `LoginResult`; a 429 asked once the proof is known to sign an
|
|
105
|
+
* account in (the account's budget) carries `redemptionWindow` beside its
|
|
106
|
+
* `retryAfterSeconds`. A refusal of a proof that is not redeemable carries
|
|
107
|
+
* neither: it stays the one identical 401.
|
|
108
|
+
*/
|
|
109
|
+
export const devicePlatformWindowsSchema = z.object({
|
|
110
|
+
redemptionWindow: redemptionWindowSchema,
|
|
111
|
+
confirmWindow: redemptionWindowSchema.optional(),
|
|
112
|
+
});
|
|
65
113
|
/**
|
|
66
114
|
* Which application the token is for, as the platform vouches for it:
|
|
67
115
|
*
|
|
@@ -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,6 +31,23 @@ export declare const platformClientSchema: z.ZodObject<{
|
|
|
31
31
|
astro: "astro";
|
|
32
32
|
}>;
|
|
33
33
|
clientId: z.ZodString;
|
|
34
|
+
confirms: z.ZodOptional<z.ZodLiteral<true>>;
|
|
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>;
|
|
34
51
|
}, z.core.$strict>;
|
|
35
52
|
/**
|
|
36
53
|
* The key that makes a QR redemption repeatable (ADR 0058 R7): at least 256
|
|
@@ -67,9 +84,42 @@ export declare const devicePlatformRequestSchema: z.ZodObject<{
|
|
|
67
84
|
astro: "astro";
|
|
68
85
|
}>;
|
|
69
86
|
clientId: z.ZodString;
|
|
87
|
+
confirms: z.ZodOptional<z.ZodLiteral<true>>;
|
|
70
88
|
}, z.core.$strict>;
|
|
71
89
|
redemptionKey: z.ZodOptional<z.ZodString>;
|
|
72
90
|
}, z.core.$strict>;
|
|
91
|
+
/**
|
|
92
|
+
* A window of the QR's redemption (R9), as the server counts it when it
|
|
93
|
+
* answers: `expiresInSeconds` (whole seconds, never negative) is what a
|
|
94
|
+
* platform measures against its own monotonic clock from the moment the
|
|
95
|
+
* answer arrives, so neither clock's setting matters; `expiresAt` (ISO 8601)
|
|
96
|
+
* is for logs and people.
|
|
97
|
+
*/
|
|
98
|
+
export declare const redemptionWindowSchema: z.ZodObject<{
|
|
99
|
+
expiresAt: z.ZodString;
|
|
100
|
+
expiresInSeconds: z.ZodNumber;
|
|
101
|
+
}, z.core.$strict>;
|
|
102
|
+
/**
|
|
103
|
+
* What `POST /session/device/platform` adds to an answer that concerns a
|
|
104
|
+
* known proof (R9): `redemptionWindow`, when the claim's ten minutes end (the
|
|
105
|
+
* proof may be redeemed, and redeemed again with its key, until then); and,
|
|
106
|
+
* on a 200 to a platform that confirms (R8), `confirmWindow`, when the pending
|
|
107
|
+
* credential it issued must be confirmed by. The 200 carries both beside the
|
|
108
|
+
* sign-in's `LoginResult`; a 429 asked once the proof is known to sign an
|
|
109
|
+
* account in (the account's budget) carries `redemptionWindow` beside its
|
|
110
|
+
* `retryAfterSeconds`. A refusal of a proof that is not redeemable carries
|
|
111
|
+
* neither: it stays the one identical 401.
|
|
112
|
+
*/
|
|
113
|
+
export declare const devicePlatformWindowsSchema: z.ZodObject<{
|
|
114
|
+
redemptionWindow: z.ZodObject<{
|
|
115
|
+
expiresAt: z.ZodString;
|
|
116
|
+
expiresInSeconds: z.ZodNumber;
|
|
117
|
+
}, z.core.$strict>;
|
|
118
|
+
confirmWindow: z.ZodOptional<z.ZodObject<{
|
|
119
|
+
expiresAt: z.ZodString;
|
|
120
|
+
expiresInSeconds: z.ZodNumber;
|
|
121
|
+
}, z.core.$strict>>;
|
|
122
|
+
}, z.core.$strip>;
|
|
73
123
|
/**
|
|
74
124
|
* Which application the token is for, as the platform vouches for it:
|
|
75
125
|
*
|
|
@@ -161,6 +211,10 @@ export type PlatformHost = (typeof PLATFORM_HOSTS)[number];
|
|
|
161
211
|
export type DeviceAppTokenErrorCode = (typeof DEVICE_APP_TOKEN_ERROR_CODES)[number];
|
|
162
212
|
export type PlatformClient = z.infer<typeof platformClientSchema>;
|
|
163
213
|
export type DevicePlatformRequest = z.infer<typeof devicePlatformRequestSchema>;
|
|
214
|
+
export type RedemptionWindow = z.infer<typeof redemptionWindowSchema>;
|
|
215
|
+
export type DevicePlatformWindows = z.infer<typeof devicePlatformWindowsSchema>;
|
|
216
|
+
export type DevicePlatformConfirmRequest = z.infer<typeof devicePlatformConfirmRequestSchema>;
|
|
217
|
+
export type DevicePlatformConfirmResponse = z.infer<typeof devicePlatformConfirmResponseSchema>;
|
|
164
218
|
export type DeviceAppTokenAttestation = z.infer<typeof deviceAppTokenAttestationSchema>;
|
|
165
219
|
export type DeviceAppTokenRequest = z.infer<typeof deviceAppTokenRequestSchema>;
|
|
166
220
|
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.24.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",
|