@oxyhq/contracts 0.11.0 → 0.12.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/deviceBoot.js +2 -0
- package/dist/cjs/deviceSession.js +28 -1
- package/dist/cjs/index.js +3 -1
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/deviceBoot.js +2 -0
- package/dist/esm/deviceSession.js +27 -0
- package/dist/esm/index.js +1 -1
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/deviceBoot.d.ts +15 -0
- package/dist/types/deviceSession.d.ts +107 -0
- package/dist/types/index.d.ts +2 -2
- package/package.json +1 -1
package/dist/esm/deviceBoot.js
CHANGED
|
@@ -91,6 +91,7 @@ export const authTokenBundleSchema = z.object({
|
|
|
91
91
|
refreshToken: z.string(),
|
|
92
92
|
expiresAt: z.string(),
|
|
93
93
|
user: userResponseSchema,
|
|
94
|
+
deviceSecret: z.string().optional(),
|
|
94
95
|
});
|
|
95
96
|
// Internal (unexported) arm schemas — PLAIN `z.object` literals (no
|
|
96
97
|
// `z.ZodType<>` annotation) so `z.discriminatedUnion` can introspect the
|
|
@@ -155,6 +156,7 @@ const loginSessionResultSchema = z.object({
|
|
|
155
156
|
expiresAt: z.string(),
|
|
156
157
|
accessToken: z.string().optional(),
|
|
157
158
|
refreshToken: z.string().optional(),
|
|
159
|
+
deviceSecret: z.string().optional(),
|
|
158
160
|
user: z.object({
|
|
159
161
|
id: z.string(),
|
|
160
162
|
username: z.string().optional(),
|
|
@@ -20,3 +20,30 @@ export const deviceSessionSyncSchema = z.object({
|
|
|
20
20
|
state: deviceSessionStateSchema,
|
|
21
21
|
activeToken: activeTokenSchema.nullable(),
|
|
22
22
|
});
|
|
23
|
+
/* -------------------------------------------------------------------------- */
|
|
24
|
+
/* Device-secret token mint (phase 2c — zero-cookie transport) */
|
|
25
|
+
/* -------------------------------------------------------------------------- */
|
|
26
|
+
/**
|
|
27
|
+
* Request body for `POST /session/device/token` — the client presents the
|
|
28
|
+
* `deviceId` it stored first-party plus the opaque `deviceSecret`. NO bearer:
|
|
29
|
+
* possession of the secret IS the proof of device ownership. The server matches
|
|
30
|
+
* `sha256(deviceSecret)` against the device's stored `secretHash` (constant-time)
|
|
31
|
+
* and mints a short access token for the device's active account.
|
|
32
|
+
*/
|
|
33
|
+
export const deviceTokenMintRequestSchema = z.object({
|
|
34
|
+
deviceId: z.string().min(1),
|
|
35
|
+
deviceSecret: z.string().min(1),
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* Wire shape of a successful `POST /session/device/token`: the freshly-minted
|
|
39
|
+
* short access token for the active account, its expiry, the NEXT rotating
|
|
40
|
+
* device secret the client must persist (rotation-in-use — the presented secret
|
|
41
|
+
* stays valid for a short grace so multi-tab races don't lock out), and the
|
|
42
|
+
* projected device-session state.
|
|
43
|
+
*/
|
|
44
|
+
export const deviceTokenMintResponseSchema = z.object({
|
|
45
|
+
accessToken: z.string(),
|
|
46
|
+
expiresAt: z.string(),
|
|
47
|
+
nextDeviceSecret: z.string(),
|
|
48
|
+
state: deviceSessionStateSchema,
|
|
49
|
+
});
|
package/dist/esm/index.js
CHANGED
|
@@ -40,7 +40,7 @@ credentialRecordSchema, verifiableCredentialResponseSchema, credentialIssueResul
|
|
|
40
40
|
export {
|
|
41
41
|
// Schemas
|
|
42
42
|
linkPreviewSchema, linkPreviewBatchRequestSchema, linkPreviewBatchResponseSchema, linkPreviewResponseSchema, } from './links.js';
|
|
43
|
-
export { sessionAccountSchema, deviceSessionStateSchema, activeTokenSchema, deviceSessionSyncSchema, } from './deviceSession.js';
|
|
43
|
+
export { sessionAccountSchema, deviceSessionStateSchema, activeTokenSchema, deviceSessionSyncSchema, deviceTokenMintRequestSchema, deviceTokenMintResponseSchema, } from './deviceSession.js';
|
|
44
44
|
export {
|
|
45
45
|
// Schemas
|
|
46
46
|
deviceBootReasonSchema, deviceBootFragmentSchema, deviceExchangeRequestSchema, authTokenBundleSchema, webSessionResultSchema, tokenRefreshRequestSchema, tokenRefreshResponseSchema, deviceTokenIssueResponseSchema, loginResultSchema, deviceResolveRequestSchema, deviceResolveResponseSchema, } from './deviceBoot.js';
|