@oxyhq/contracts 0.13.0 → 0.13.2
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/accountGraph.js +48 -0
- package/dist/cjs/deviceSession.js +23 -1
- package/dist/cjs/index.js +11 -6
- package/dist/cjs/userResponse.js +7 -1
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/accountGraph.js +45 -0
- package/dist/esm/deviceSession.js +22 -0
- package/dist/esm/index.js +3 -5
- package/dist/esm/userResponse.js +7 -1
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/accountGraph.d.ts +83 -0
- package/dist/types/deviceSession.d.ts +45 -0
- package/dist/types/identity.d.ts +4 -4
- package/dist/types/index.d.ts +5 -5
- package/dist/types/sessionStatus.d.ts +6 -6
- package/dist/types/userResponse.d.ts +93 -11
- package/package.json +1 -1
- package/dist/cjs/fedcmToken.js +0 -66
- package/dist/esm/fedcmToken.js +0 -63
- package/dist/types/fedcmToken.d.ts +0 -90
package/dist/esm/fedcmToken.js
DELETED
|
@@ -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>;
|