@idp.global/interfaces 12.0.0 → 13.1.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/changelog.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 2026-07-16 - 13.1.0
4
+
5
+ ### Features
6
+
7
+ - add `data.ILoginSession.data.transferTargetHash` so an outstanding transfer token, its expiry, and its canonical authorized target binding can be persisted and cleared atomically without storing a raw target URL
8
+ - document and test that `IReq_ExchangeRefreshTokenAndTransferToken` requires `transferTarget` for both transfer-token issue and consume requests
9
+
10
+ ## 2026-07-16 - 13.0.0
11
+
12
+ ### Breaking Changes
13
+
14
+ - remove persisted plaintext `refreshToken` fields from `data.IJwt` and `data.ILoginSession`; login-session persistence exposes hashed refresh-token state only
15
+ - remove the compatibility-only `data.IAppLegacy` shape and replace the transfer exchange request's `appData` field with `transferTarget: data.ITransferTarget`, containing only `appUrl`
16
+ - replace `IReq_GetPublicKeyForValidation` and `IReq_PushPublicKeyForValidation` with plural `IReq_GetPublicKeysForValidation` and `IReq_PushPublicKeysForValidation` contracts using the `getPublicKeysForValidation` and `pushPublicKeysForValidation` methods
17
+ - remove the singular top-level `publicKeyPem` payload from validation-key requests and responses; callers receive and push only the complete `publicKeys` keyset
18
+
3
19
  ## 2026-07-16 - 12.0.0
4
20
 
5
21
  ### Breaking Changes
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@idp.global/interfaces',
6
- version: '12.0.0',
6
+ version: '13.1.0',
7
7
  description: 'Shared TypeScript interfaces and TypedRequest contracts for the idp.global ecosystem.'
8
8
  };
9
9
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx3QkFBd0I7SUFDOUIsT0FBTyxFQUFFLFFBQVE7SUFDakIsV0FBVyxFQUFFLHVGQUF1RjtDQUNyRyxDQUFBIn0=
@@ -66,20 +66,9 @@ export interface ICustomOidcApp {
66
66
  }
67
67
  export type IApp = IGlobalApp | IPartnerApp | ICustomOidcApp;
68
68
  /**
69
- * Legacy interface for backwards compatibility with existing code
70
- * that expects a flat app structure (e.g., idpclient, transfermanager)
69
+ * Browser destination used by the refresh/transfer-token exchange flow.
71
70
  */
72
- export interface IAppLegacy {
73
- /**
74
- * must be unique
75
- */
76
- id: string;
77
- /**
78
- * should be unique
79
- */
80
- name: string;
81
- description: string;
82
- logoUrl: string;
71
+ export interface ITransferTarget {
83
72
  appUrl: string;
84
73
  }
85
74
  /**
@@ -29,10 +29,6 @@ export interface IJwt {
29
29
  * an interval in millis to recheck token invalidation
30
30
  */
31
31
  refreshEvery: number;
32
- /**
33
- * legacy field kept for compatibility with already-issued jwt documents
34
- */
35
- refreshToken?: string;
36
32
  /**
37
33
  * just for looks/debugging
38
34
  */
@@ -4,14 +4,30 @@ export interface ILoginSession {
4
4
  userId: string | null;
5
5
  validUntil: number;
6
6
  invalidated: boolean;
7
- /**
8
- * legacy plaintext refresh token field kept so existing sessions can migrate on first use
9
- */
10
- refreshToken?: string | null;
11
7
  refreshTokenHash?: string | null;
12
8
  rotatedRefreshTokenHashes?: string[];
9
+ /**
10
+ * Hash of the single outstanding opaque transfer token.
11
+ *
12
+ * This field, `transferTokenExpiresAt`, and `transferTargetHash` describe
13
+ * one transfer grant and must be set, replaced, and cleared together in a
14
+ * single atomic persistence operation.
15
+ */
13
16
  transferTokenHash?: string | null;
17
+ /**
18
+ * Absolute expiry time, in Unix epoch milliseconds, for the outstanding
19
+ * transfer grant.
20
+ */
14
21
  transferTokenExpiresAt?: number | null;
22
+ /**
23
+ * Server-derived binding hash of the canonical, authorized
24
+ * `ITransferTarget.appUrl` for the outstanding transfer grant.
25
+ *
26
+ * Implementations must never persist the raw target URL in login-session
27
+ * data. This field must be set, replaced, and cleared atomically with
28
+ * `transferTokenHash` and `transferTokenExpiresAt`.
29
+ */
30
+ transferTargetHash?: string | null;
15
31
  /**
16
32
  * a device id that can be used to share the login session
17
33
  * in different contexts on the same device
@@ -1,39 +1,37 @@
1
1
  import * as data from '../data/index.js';
2
2
  import * as plugins from '../plugins.js';
3
3
  /**
4
- * Request to get the public key for JWT validation.
4
+ * Request to get the public keyset for JWT validation.
5
5
  *
6
6
  * **Direction:** Client → idp.global
7
7
  * **Requester:** Backend services that need to verify JWTs
8
8
  * **Handler:** idp.global
9
9
  *
10
- * Use this to fetch the current public key for verifying JWT signatures.
10
+ * Use this to fetch every currently accepted public key for verifying JWT signatures.
11
11
  * The backend token authenticates the requesting service.
12
12
  */
13
- export interface IReq_GetPublicKeyForValidation extends plugins.typedRequestInterfaces.implementsTR<plugins.typedRequestInterfaces.ITypedRequest, IReq_GetPublicKeyForValidation> {
14
- method: 'getPublicKeyForValidation';
13
+ export interface IReq_GetPublicKeysForValidation extends plugins.typedRequestInterfaces.implementsTR<plugins.typedRequestInterfaces.ITypedRequest, IReq_GetPublicKeysForValidation> {
14
+ method: 'getPublicKeysForValidation';
15
15
  request: {
16
16
  backendToken: string;
17
17
  };
18
18
  response: {
19
- publicKeyPem: string;
20
19
  publicKeys: data.IJwtVerificationKey[];
21
20
  };
22
21
  }
23
22
  /**
24
- * Push public key to connected backend services for JWT validation.
23
+ * Push the complete public keyset to connected backend services for JWT validation.
25
24
  *
26
25
  * **Direction:** idp.global → Client
27
26
  * **Requester:** idp.global (pushes when the JWT signing key rotates)
28
27
  * **Handler:** Backend services - must register a TypedHandler for this method
29
28
  *
30
- * Backend services should register a handler using `IdpClient.onPublicKeyPush()`
31
- * to receive key rotation updates and update their local key cache.
29
+ * Backend services must register a matching handler to receive key-rotation
30
+ * updates and replace their local verification keyset.
32
31
  */
33
- export interface IReq_PushPublicKeyForValidation extends plugins.typedRequestInterfaces.implementsTR<plugins.typedRequestInterfaces.ITypedRequest, IReq_PushPublicKeyForValidation> {
34
- method: 'pushPublicKeyForValidation';
32
+ export interface IReq_PushPublicKeysForValidation extends plugins.typedRequestInterfaces.implementsTR<plugins.typedRequestInterfaces.ITypedRequest, IReq_PushPublicKeysForValidation> {
33
+ method: 'pushPublicKeysForValidation';
35
34
  request: {
36
- publicKeyPem: string;
37
35
  publicKeys: data.IJwtVerificationKey[];
38
36
  };
39
37
  response: {};
@@ -62,7 +62,7 @@ export interface IReq_ExchangeRefreshTokenAndTransferToken extends plugins.typed
62
62
  request: {
63
63
  transferToken?: string;
64
64
  refreshToken?: string;
65
- appData: data.IAppLegacy;
65
+ transferTarget: data.ITransferTarget;
66
66
  };
67
67
  response: {
68
68
  refreshToken?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idp.global/interfaces",
3
- "version": "12.0.0",
3
+ "version": "13.1.0",
4
4
  "private": false,
5
5
  "description": "Shared TypeScript interfaces and TypedRequest contracts for the idp.global ecosystem.",
6
6
  "exports": {
package/readme.md CHANGED
@@ -52,6 +52,15 @@ const organization: data.IOrganization = {
52
52
  };
53
53
  ```
54
54
 
55
+ Persisted `data.IJwt` and `data.ILoginSession` shapes never contain plaintext
56
+ refresh or transfer tokens. Session persistence exposes only refresh-token
57
+ hashes, refresh-token rotation history, and the atomic transfer-grant tuple
58
+ `transferTokenHash`, `transferTokenExpiresAt`, and `transferTargetHash`.
59
+ The target hash is derived server-side from the canonical, authorized
60
+ `ITransferTarget.appUrl`; the raw target URL is never persisted in session
61
+ data. Opaque tokens and the transfer target remain limited to the request and
62
+ response contracts that transport them.
63
+
55
64
  ## TypedRequest Contracts
56
65
 
57
66
  Use `request` when registering handlers or creating typed clients with `@api.global/typedrequest` or `@api.global/typedsocket`.
@@ -67,6 +76,25 @@ const payload: LoginRequest['request'] = {
67
76
  };
68
77
  ```
69
78
 
79
+ JWT verification-key distribution is keyset-only and uses plural method names:
80
+
81
+ ```ts
82
+ type GetValidationKeys = request.IReq_GetPublicKeysForValidation;
83
+ type PushValidationKeys = request.IReq_PushPublicKeysForValidation;
84
+
85
+ const transferRequest: request.IReq_ExchangeRefreshTokenAndTransferToken['request'] = {
86
+ refreshToken: 'opaque-refresh-token',
87
+ transferTarget: {
88
+ appUrl: 'https://app.example/',
89
+ },
90
+ };
91
+ ```
92
+
93
+ `transferTarget` is required both when a refresh token issues a transfer token
94
+ and when a transfer token is consumed. The server authorizes and canonicalizes
95
+ the target before binding its server-derived hash to the outstanding transfer
96
+ token.
97
+
70
98
  Request groups cover login, registration, JWT refresh, user/session queries, organization membership, invitations, apps, billing, admin actions, alerts, passport device flows, password reset, device IDs, and OIDC authorization.
71
99
 
72
100
  OIDC app contracts expose only client configuration and safe credential
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@idp.global/interfaces',
6
- version: '12.0.0',
6
+ version: '13.1.0',
7
7
  description: 'Shared TypeScript interfaces and TypedRequest contracts for the idp.global ecosystem.'
8
8
  }
package/ts/data/app.ts CHANGED
@@ -79,20 +79,9 @@ export interface ICustomOidcApp {
79
79
  export type IApp = IGlobalApp | IPartnerApp | ICustomOidcApp;
80
80
 
81
81
  /**
82
- * Legacy interface for backwards compatibility with existing code
83
- * that expects a flat app structure (e.g., idpclient, transfermanager)
82
+ * Browser destination used by the refresh/transfer-token exchange flow.
84
83
  */
85
- export interface IAppLegacy {
86
- /**
87
- * must be unique
88
- */
89
- id: string;
90
- /**
91
- * should be unique
92
- */
93
- name: string;
94
- description: string;
95
- logoUrl: string;
84
+ export interface ITransferTarget {
96
85
  appUrl: string;
97
86
  }
98
87
 
package/ts/data/jwt.ts CHANGED
@@ -34,11 +34,6 @@ export interface IJwt {
34
34
  */
35
35
  refreshEvery: number;
36
36
 
37
- /**
38
- * legacy field kept for compatibility with already-issued jwt documents
39
- */
40
- refreshToken?: string;
41
-
42
37
  /**
43
38
  * just for looks/debugging
44
39
  */
@@ -4,14 +4,30 @@ export interface ILoginSession {
4
4
  userId: string | null;
5
5
  validUntil: number;
6
6
  invalidated: boolean;
7
- /**
8
- * legacy plaintext refresh token field kept so existing sessions can migrate on first use
9
- */
10
- refreshToken?: string | null;
11
7
  refreshTokenHash?: string | null;
12
8
  rotatedRefreshTokenHashes?: string[];
9
+ /**
10
+ * Hash of the single outstanding opaque transfer token.
11
+ *
12
+ * This field, `transferTokenExpiresAt`, and `transferTargetHash` describe
13
+ * one transfer grant and must be set, replaced, and cleared together in a
14
+ * single atomic persistence operation.
15
+ */
13
16
  transferTokenHash?: string | null;
17
+ /**
18
+ * Absolute expiry time, in Unix epoch milliseconds, for the outstanding
19
+ * transfer grant.
20
+ */
14
21
  transferTokenExpiresAt?: number | null;
22
+ /**
23
+ * Server-derived binding hash of the canonical, authorized
24
+ * `ITransferTarget.appUrl` for the outstanding transfer grant.
25
+ *
26
+ * Implementations must never persist the raw target URL in login-session
27
+ * data. This field must be set, replaced, and cleared atomically with
28
+ * `transferTokenHash` and `transferTokenExpiresAt`.
29
+ */
30
+ transferTargetHash?: string | null;
15
31
  /**
16
32
  * a device id that can be used to share the login session
17
33
  * in different contexts on the same device
package/ts/readme.md CHANGED
@@ -67,7 +67,7 @@ The `request` export includes typed request contracts for:
67
67
  - organization CRUD-style requests
68
68
  - invitations and membership changes
69
69
  - app and admin actions
70
- - billing and JWT validation support
70
+ - billing and JWT validation-keyset support
71
71
  - alert and passport approval flows
72
72
  - OIDC authorization preparation and completion
73
73
 
@@ -113,8 +113,19 @@ type TSessions = request.IReq_GetUserSessions['response']['sessions'];
113
113
  type TUserInfo = data.IUserInfoResponse;
114
114
  type TOidcSettings = data.IOidcSettings;
115
115
  type TJwtVerificationKey = data.IJwtVerificationKey;
116
+ type TGetValidationKeys = request.IReq_GetPublicKeysForValidation;
117
+ type TPushValidationKeys = request.IReq_PushPublicKeysForValidation;
116
118
  ```
117
119
 
120
+ Persisted JWT and login-session data contracts contain no plaintext refresh or
121
+ transfer tokens. Transfer-token exchange requires the minimal
122
+ `data.ITransferTarget` contract with an `appUrl` for both issue and consume; it
123
+ does not expose the removed flat legacy app shape. A session persists only the
124
+ atomic `transferTokenHash`, `transferTokenExpiresAt`, and `transferTargetHash`
125
+ tuple for an outstanding transfer grant. The target hash is derived
126
+ server-side from the canonical, authorized URL, and the raw URL is never
127
+ persisted in session data.
128
+
118
129
  Public app contracts contain client type, callback and post-logout URIs,
119
130
  allowed scopes, grant types, and bounded token lifetime settings. Secret hashes,
120
131
  private signing keys, and persistence records for authorization codes, access
package/ts/request/jwt.ts CHANGED
@@ -2,48 +2,46 @@ import * as data from '../data/index.js';
2
2
  import * as plugins from '../plugins.js';
3
3
 
4
4
  /**
5
- * Request to get the public key for JWT validation.
5
+ * Request to get the public keyset for JWT validation.
6
6
  *
7
7
  * **Direction:** Client → idp.global
8
8
  * **Requester:** Backend services that need to verify JWTs
9
9
  * **Handler:** idp.global
10
10
  *
11
- * Use this to fetch the current public key for verifying JWT signatures.
11
+ * Use this to fetch every currently accepted public key for verifying JWT signatures.
12
12
  * The backend token authenticates the requesting service.
13
13
  */
14
- export interface IReq_GetPublicKeyForValidation
14
+ export interface IReq_GetPublicKeysForValidation
15
15
  extends plugins.typedRequestInterfaces.implementsTR<
16
16
  plugins.typedRequestInterfaces.ITypedRequest,
17
- IReq_GetPublicKeyForValidation
17
+ IReq_GetPublicKeysForValidation
18
18
  > {
19
- method: 'getPublicKeyForValidation';
19
+ method: 'getPublicKeysForValidation';
20
20
  request: {
21
21
  backendToken: string;
22
22
  };
23
23
  response: {
24
- publicKeyPem: string;
25
24
  publicKeys: data.IJwtVerificationKey[];
26
25
  };
27
26
  }
28
27
 
29
28
  /**
30
- * Push public key to connected backend services for JWT validation.
29
+ * Push the complete public keyset to connected backend services for JWT validation.
31
30
  *
32
31
  * **Direction:** idp.global → Client
33
32
  * **Requester:** idp.global (pushes when the JWT signing key rotates)
34
33
  * **Handler:** Backend services - must register a TypedHandler for this method
35
34
  *
36
- * Backend services should register a handler using `IdpClient.onPublicKeyPush()`
37
- * to receive key rotation updates and update their local key cache.
35
+ * Backend services must register a matching handler to receive key-rotation
36
+ * updates and replace their local verification keyset.
38
37
  */
39
- export interface IReq_PushPublicKeyForValidation
38
+ export interface IReq_PushPublicKeysForValidation
40
39
  extends plugins.typedRequestInterfaces.implementsTR<
41
40
  plugins.typedRequestInterfaces.ITypedRequest,
42
- IReq_PushPublicKeyForValidation
41
+ IReq_PushPublicKeysForValidation
43
42
  > {
44
- method: 'pushPublicKeyForValidation';
43
+ method: 'pushPublicKeysForValidation';
45
44
  request: {
46
- publicKeyPem: string;
47
45
  publicKeys: data.IJwtVerificationKey[];
48
46
  };
49
47
  response: {};
@@ -92,7 +92,7 @@ export interface IReq_ExchangeRefreshTokenAndTransferToken
92
92
  request: {
93
93
  transferToken?: string;
94
94
  refreshToken?: string;
95
- appData: data.IAppLegacy;
95
+ transferTarget: data.ITransferTarget;
96
96
  };
97
97
  response: {
98
98
  refreshToken?: string;