@idp.global/interfaces 11.0.0 → 13.0.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,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 2026-07-16 - 13.0.0
4
+
5
+ ### Breaking Changes
6
+
7
+ - remove persisted plaintext `refreshToken` fields from `data.IJwt` and `data.ILoginSession`; login-session persistence exposes hashed refresh-token state only
8
+ - remove the compatibility-only `data.IAppLegacy` shape and replace the transfer exchange request's `appData` field with `transferTarget: data.ITransferTarget`, containing only `appUrl`
9
+ - replace `IReq_GetPublicKeyForValidation` and `IReq_PushPublicKeyForValidation` with plural `IReq_GetPublicKeysForValidation` and `IReq_PushPublicKeysForValidation` contracts using the `getPublicKeysForValidation` and `pushPublicKeysForValidation` methods
10
+ - remove the singular top-level `publicKeyPem` payload from validation-key requests and responses; callers receive and push only the complete `publicKeys` keyset
11
+
12
+ ## 2026-07-16 - 12.0.0
13
+
14
+ ### Breaking Changes
15
+
16
+ - remove the public `data.IActivityLog` persistence shape, including raw user and target identifiers, caller-authored descriptions, IP addresses, user agents, and generic metadata
17
+ - replace `dto.IActivityEventDto` with the flat discriminated `dto.TActivityEventDto` union; activity responses now expose only finite actions, timestamps, outcomes, optional fixed reason codes, fixed target types, and allowlisted action-specific facts
18
+
19
+ ### Maintenance
20
+
21
+ - update Node.js type definitions to 26.1.1
22
+
3
23
  ## 2026-07-11 - 11.0.0
4
24
 
5
25
  ### Breaking Changes
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@idp.global/interfaces',
6
- version: '11.0.0',
6
+ version: '13.0.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=
@@ -1,18 +1,16 @@
1
1
  export type TActivityAction = 'login' | 'logout' | 'session_created' | 'session_revoked' | 'passport_device_enrolled' | 'passport_device_revoked' | 'passport_challenge_approved' | 'passport_challenge_rejected' | 'org_created' | 'org_updated' | 'org_deleted' | 'org_ownership_transferred' | 'org_joined' | 'org_left' | 'role_changed' | 'org_app_role_mappings_updated' | 'profile_updated' | 'totp_enabled' | 'totp_disabled' | 'backup_codes_regenerated' | 'mfa_completed' | 'passkey_registered' | 'passkey_revoked' | 'passkey_login' | 'app_connected' | 'app_disconnected' | 'user_suspended' | 'user_unsuspended' | 'account_deletion_requested' | 'account_deletion_cancelled' | 'account_purged' | 'sso_connection_created' | 'sso_connection_updated' | 'sso_connection_deleted' | 'sso_domain_verified' | 'sso_login' | 'scim_token_created' | 'scim_token_revoked' | 'scim_user_provisioned' | 'scim_user_updated' | 'scim_user_deactivated' | 'scim_group_membership_changed' | 'oidc_authorization_granted' | 'oidc_code_exchanged' | 'oidc_refresh_rotated' | 'oidc_refresh_reuse_detected' | 'oidc_token_revoked' | 'oidc_logout' | 'oidc_client_created' | 'oidc_client_updated' | 'oidc_client_activation_changed' | 'oidc_client_deleted' | 'oidc_client_secret_rotated' | 'oidc_signing_key_rotated' | 'oidc_lifecycle_revoked' | 'org_suspended' | 'org_unsuspended';
2
- export interface IActivityLog {
3
- id: string;
4
- data: {
5
- userId: string;
6
- action: TActivityAction;
7
- timestamp: number;
8
- metadata: {
9
- ip?: string;
10
- userAgent?: string;
11
- targetId?: string;
12
- targetType?: string;
13
- outcome?: 'pending' | 'success' | 'failure';
14
- reason?: string;
15
- description: string;
16
- };
17
- };
18
- }
2
+ export type TActivityOutcome = 'attempted' | 'succeeded' | 'denied' | 'failed';
3
+ /**
4
+ * Public failure reasons are deliberately finite and non-descriptive. They
5
+ * classify an outcome without carrying provider errors, account data, or
6
+ * caller-authored text across the public contract boundary.
7
+ */
8
+ export type TActivityReasonCode = 'account_inactive' | 'authentication_failed' | 'authorization_denied' | 'conflict' | 'expired' | 'invalid_request' | 'policy_denied' | 'rate_limited' | 'replay_detected' | 'revoked' | 'step_up_required' | 'upstream_unavailable' | 'user_cancelled';
9
+ export type TActivityTargetType = 'account' | 'application_connection' | 'mfa_method' | 'oidc_authorization' | 'oidc_client' | 'oidc_lifecycle' | 'oidc_signing_key' | 'oidc_token' | 'organization' | 'organization_membership' | 'organization_role_mapping' | 'passkey' | 'passport_challenge' | 'passport_device' | 'profile' | 'scim_group_membership' | 'scim_token' | 'scim_user' | 'session' | 'sso_connection' | 'sso_domain';
10
+ export type TActivityAuthenticationMethod = 'magic_link' | 'password';
11
+ export type TActivitySessionKind = 'browser' | 'oidc';
12
+ export type TActivityRevocationScope = 'account' | 'all_sessions' | 'application' | 'current_session' | 'organization' | 'token_family';
13
+ export type TActivityRoleChange = 'assigned' | 'removed' | 'replaced';
14
+ export type TActivityMfaFactor = 'backup_code' | 'passkey' | 'totp';
15
+ export type TActivityMembershipChange = 'added' | 'reconciled' | 'removed';
16
+ export type TActivityOidcTokenType = 'access_token' | 'refresh_token' | 'token_family';
@@ -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,10 +4,6 @@ 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[];
13
9
  transferTokenHash?: string | null;
@@ -1,13 +1,65 @@
1
- import type { TActivityAction } from '../data/activity.js';
2
- export interface IActivityEventDto {
3
- id: string;
4
- data: {
5
- action: TActivityAction;
6
- timestamp: number;
7
- metadata: {
8
- description: string;
9
- ip?: string;
10
- targetType?: string;
11
- };
12
- };
13
- }
1
+ import type { TActivityAction, TActivityAuthenticationMethod, TActivityMembershipChange, TActivityMfaFactor, TActivityOidcTokenType, TActivityOutcome, TActivityReasonCode, TActivityRevocationScope, TActivityRoleChange, TActivitySessionKind, TActivityTargetType } from '../data/activity.js';
2
+ import type { TOAuthClientType } from '../data/app.js';
3
+ type TActivityEventFor<TAction extends TActivityAction, TTargetType extends TActivityTargetType, TFacts> = TAction extends TActivityAction ? {
4
+ action: TAction;
5
+ timestamp: number;
6
+ outcome: TActivityOutcome;
7
+ reasonCode?: TActivityReasonCode;
8
+ targetType: TTargetType;
9
+ facts: TFacts;
10
+ } : never;
11
+ /**
12
+ * Browser-safe activity event. The action field discriminates the union, so
13
+ * every event has one fixed target type and only the explicitly allowlisted
14
+ * facts for that action. Internal event identities, actors, target identities,
15
+ * integrity data, delivery state, network data, and free text are excluded.
16
+ */
17
+ export type TActivityEventDto = TActivityEventFor<'login', 'account', {
18
+ authenticationMethod: TActivityAuthenticationMethod;
19
+ }> | TActivityEventFor<'logout', 'account', null> | TActivityEventFor<'session_created', 'session', {
20
+ sessionKind: TActivitySessionKind;
21
+ }> | TActivityEventFor<'session_revoked', 'session', {
22
+ revocationScope: TActivityRevocationScope;
23
+ }> | TActivityEventFor<'passport_device_enrolled', 'passport_device', null> | TActivityEventFor<'passport_device_revoked', 'passport_device', null> | TActivityEventFor<'passport_challenge_approved', 'passport_challenge', null> | TActivityEventFor<'passport_challenge_rejected', 'passport_challenge', null> | TActivityEventFor<'org_created', 'organization', null> | TActivityEventFor<'org_updated', 'organization', null> | TActivityEventFor<'org_deleted', 'organization', null> | TActivityEventFor<'org_ownership_transferred', 'organization', null> | TActivityEventFor<'org_joined', 'organization_membership', null> | TActivityEventFor<'org_left', 'organization_membership', null> | TActivityEventFor<'role_changed', 'organization_membership', {
24
+ roleChange: TActivityRoleChange;
25
+ }> | TActivityEventFor<'org_app_role_mappings_updated', 'organization_role_mapping', null> | TActivityEventFor<'profile_updated', 'profile', null> | TActivityEventFor<'totp_enabled', 'mfa_method', null> | TActivityEventFor<'totp_disabled', 'mfa_method', null> | TActivityEventFor<'backup_codes_regenerated', 'mfa_method', null> | TActivityEventFor<'mfa_completed', 'mfa_method', {
26
+ factor: TActivityMfaFactor;
27
+ }> | TActivityEventFor<'passkey_registered', 'passkey', null> | TActivityEventFor<'passkey_revoked', 'passkey', null> | TActivityEventFor<'passkey_login', 'passkey', null> | TActivityEventFor<'app_connected', 'application_connection', null> | TActivityEventFor<'app_disconnected', 'application_connection', null> | TActivityEventFor<'user_suspended', 'account', null> | TActivityEventFor<'user_unsuspended', 'account', null> | TActivityEventFor<'account_deletion_requested', 'account', null> | TActivityEventFor<'account_deletion_cancelled', 'account', null> | TActivityEventFor<'account_purged', 'account', null> | TActivityEventFor<'sso_connection_created', 'sso_connection', {
28
+ protocol: 'saml';
29
+ }> | TActivityEventFor<'sso_connection_updated', 'sso_connection', {
30
+ protocol: 'saml';
31
+ }> | TActivityEventFor<'sso_connection_deleted', 'sso_connection', {
32
+ protocol: 'saml';
33
+ }> | TActivityEventFor<'sso_domain_verified', 'sso_domain', {
34
+ protocol: 'saml';
35
+ }> | TActivityEventFor<'sso_login', 'session', {
36
+ protocol: 'saml';
37
+ }> | TActivityEventFor<'scim_token_created', 'scim_token', null> | TActivityEventFor<'scim_token_revoked', 'scim_token', null> | TActivityEventFor<'scim_user_provisioned', 'scim_user', null> | TActivityEventFor<'scim_user_updated', 'scim_user', null> | TActivityEventFor<'scim_user_deactivated', 'scim_user', null> | TActivityEventFor<'scim_group_membership_changed', 'scim_group_membership', {
38
+ membershipChange: TActivityMembershipChange;
39
+ }> | TActivityEventFor<'oidc_authorization_granted', 'oidc_authorization', {
40
+ grantType: 'authorization_code';
41
+ }> | TActivityEventFor<'oidc_code_exchanged', 'oidc_token', {
42
+ grantType: 'authorization_code';
43
+ }> | TActivityEventFor<'oidc_refresh_rotated', 'oidc_token', {
44
+ grantType: 'refresh_token';
45
+ }> | TActivityEventFor<'oidc_refresh_reuse_detected', 'oidc_token', {
46
+ grantType: 'refresh_token';
47
+ }> | TActivityEventFor<'oidc_token_revoked', 'oidc_token', {
48
+ tokenType: TActivityOidcTokenType;
49
+ }> | TActivityEventFor<'oidc_logout', 'session', {
50
+ revocationScope: TActivityRevocationScope;
51
+ }> | TActivityEventFor<'oidc_client_created', 'oidc_client', {
52
+ clientType: TOAuthClientType;
53
+ }> | TActivityEventFor<'oidc_client_updated', 'oidc_client', {
54
+ clientType: TOAuthClientType;
55
+ }> | TActivityEventFor<'oidc_client_activation_changed', 'oidc_client', {
56
+ clientType: TOAuthClientType;
57
+ isActive: boolean;
58
+ }> | TActivityEventFor<'oidc_client_deleted', 'oidc_client', {
59
+ clientType: TOAuthClientType;
60
+ }> | TActivityEventFor<'oidc_client_secret_rotated', 'oidc_client', {
61
+ clientType: 'confidential';
62
+ }> | TActivityEventFor<'oidc_signing_key_rotated', 'oidc_signing_key', null> | TActivityEventFor<'oidc_lifecycle_revoked', 'oidc_lifecycle', {
63
+ revocationScope: TActivityRevocationScope;
64
+ }> | TActivityEventFor<'org_suspended', 'organization', null> | TActivityEventFor<'org_unsuspended', 'organization', null>;
65
+ export {};
@@ -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;
@@ -117,7 +117,7 @@ export type TOrgExportRecord = {
117
117
  payload: dto.IScimTokenDto;
118
118
  } | {
119
119
  kind: 'activity';
120
- payload: dto.IActivityEventDto;
120
+ payload: dto.TActivityEventDto;
121
121
  };
122
122
  /**
123
123
  * Cursor-paged export of an organization's data (data portability /
@@ -73,7 +73,7 @@ export interface IReq_GetUserActivity extends plugins.typedRequestInterfaces.imp
73
73
  offset?: number;
74
74
  };
75
75
  response: {
76
- activities: dto.IActivityEventDto[];
76
+ activities: dto.TActivityEventDto[];
77
77
  total: number;
78
78
  };
79
79
  }
@@ -134,7 +134,7 @@ export interface IReq_ExportUserActivity extends plugins.typedRequestInterfaces.
134
134
  until?: number;
135
135
  };
136
136
  response: {
137
- activities: dto.IActivityEventDto[];
137
+ activities: dto.TActivityEventDto[];
138
138
  /** absent when the export is complete */
139
139
  nextCursor?: string;
140
140
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idp.global/interfaces",
3
- "version": "11.0.0",
3
+ "version": "13.0.0",
4
4
  "private": false,
5
5
  "description": "Shared TypeScript interfaces and TypedRequest contracts for the idp.global ecosystem.",
6
6
  "exports": {
@@ -18,7 +18,7 @@
18
18
  "@git.zone/tsdoc": "^2.1.1",
19
19
  "@git.zone/tsrun": "^2.0.5",
20
20
  "@git.zone/tstest": "^3.6.6",
21
- "@types/node": "^26.1.0"
21
+ "@types/node": "^26.1.1"
22
22
  },
23
23
  "files": [
24
24
  "ts/**/*",
package/readme.md CHANGED
@@ -35,7 +35,7 @@ export {
35
35
 
36
36
  Use `data` for durable and transportable idp.global object shapes.
37
37
 
38
- Common data contracts include users, JWTs, login sessions, registration sessions, organizations, roles, invitations, billing plans, apps, app connections, activity logs, alerts, alert rules, abuse windows, passport devices, passport challenges, passport nonces, and OIDC payloads.
38
+ Common data contracts include users, JWTs, login sessions, registration sessions, organizations, roles, invitations, billing plans, apps, app connections, finite activity classifications, alerts, alert rules, abuse windows, passport devices, passport challenges, passport nonces, and OIDC payloads.
39
39
 
40
40
  ```ts
41
41
  import { data } from '@idp.global/interfaces';
@@ -52,6 +52,11 @@ const organization: data.IOrganization = {
52
52
  };
53
53
  ```
54
54
 
55
+ Persisted `data.IJwt` and `data.ILoginSession` shapes never contain plaintext
56
+ refresh tokens. Session persistence exposes only refresh-token hashes and
57
+ rotation history; opaque refresh tokens remain limited to the request and
58
+ response contracts that transport them.
59
+
55
60
  ## TypedRequest Contracts
56
61
 
57
62
  Use `request` when registering handlers or creating typed clients with `@api.global/typedrequest` or `@api.global/typedsocket`.
@@ -67,6 +72,20 @@ const payload: LoginRequest['request'] = {
67
72
  };
68
73
  ```
69
74
 
75
+ JWT verification-key distribution is keyset-only and uses plural method names:
76
+
77
+ ```ts
78
+ type GetValidationKeys = request.IReq_GetPublicKeysForValidation;
79
+ type PushValidationKeys = request.IReq_PushPublicKeysForValidation;
80
+
81
+ const transferRequest: request.IReq_ExchangeRefreshTokenAndTransferToken['request'] = {
82
+ refreshToken: 'opaque-refresh-token',
83
+ transferTarget: {
84
+ appUrl: 'https://app.example/',
85
+ },
86
+ };
87
+ ```
88
+
70
89
  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
90
 
72
91
  OIDC app contracts expose only client configuration and safe credential
@@ -76,7 +95,19 @@ remain backend-internal; protocol request and response values remain public.
76
95
 
77
96
  ## DTO Contracts
78
97
 
79
- Use `dto` for normalized transfer objects grouped by activity, alerts, apps, billing, invitations, MFA, organizations, passport, and users. Public OIDC support includes `data.IOidcSettings` and redacted `data.IJwtVerificationKey` records.
98
+ Use `dto` for normalized transfer objects grouped by activity, alerts, apps, billing, invitations, MFA, organizations, passport, and users. `dto.TActivityEventDto` is a discriminated structured event: it exposes only a finite action, timestamp, outcome, optional reason code, fixed target type, and allowlisted action-specific facts. It never carries event, actor, or target identifiers; free text; network data; integrity material; or delivery state. Public OIDC support includes `data.IOidcSettings` and redacted `data.IJwtVerificationKey` records.
99
+
100
+ ```ts
101
+ const activity: dto.TActivityEventDto = {
102
+ action: 'login',
103
+ timestamp: Date.now(),
104
+ outcome: 'succeeded',
105
+ targetType: 'account',
106
+ facts: {
107
+ authenticationMethod: 'password',
108
+ },
109
+ };
110
+ ```
80
111
 
81
112
  ## Scope
82
113
 
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@idp.global/interfaces',
6
- version: '11.0.0',
6
+ version: '13.0.0',
7
7
  description: 'Shared TypeScript interfaces and TypedRequest contracts for the idp.global ecosystem.'
8
8
  }
@@ -57,20 +57,61 @@ export type TActivityAction =
57
57
  | 'org_suspended'
58
58
  | 'org_unsuspended';
59
59
 
60
- export interface IActivityLog {
61
- id: string;
62
- data: {
63
- userId: string;
64
- action: TActivityAction;
65
- timestamp: number;
66
- metadata: {
67
- ip?: string;
68
- userAgent?: string;
69
- targetId?: string;
70
- targetType?: string;
71
- outcome?: 'pending' | 'success' | 'failure';
72
- reason?: string;
73
- description: string;
74
- };
75
- };
76
- }
60
+ export type TActivityOutcome = 'attempted' | 'succeeded' | 'denied' | 'failed';
61
+
62
+ /**
63
+ * Public failure reasons are deliberately finite and non-descriptive. They
64
+ * classify an outcome without carrying provider errors, account data, or
65
+ * caller-authored text across the public contract boundary.
66
+ */
67
+ export type TActivityReasonCode =
68
+ | 'account_inactive'
69
+ | 'authentication_failed'
70
+ | 'authorization_denied'
71
+ | 'conflict'
72
+ | 'expired'
73
+ | 'invalid_request'
74
+ | 'policy_denied'
75
+ | 'rate_limited'
76
+ | 'replay_detected'
77
+ | 'revoked'
78
+ | 'step_up_required'
79
+ | 'upstream_unavailable'
80
+ | 'user_cancelled';
81
+
82
+ export type TActivityTargetType =
83
+ | 'account'
84
+ | 'application_connection'
85
+ | 'mfa_method'
86
+ | 'oidc_authorization'
87
+ | 'oidc_client'
88
+ | 'oidc_lifecycle'
89
+ | 'oidc_signing_key'
90
+ | 'oidc_token'
91
+ | 'organization'
92
+ | 'organization_membership'
93
+ | 'organization_role_mapping'
94
+ | 'passkey'
95
+ | 'passport_challenge'
96
+ | 'passport_device'
97
+ | 'profile'
98
+ | 'scim_group_membership'
99
+ | 'scim_token'
100
+ | 'scim_user'
101
+ | 'session'
102
+ | 'sso_connection'
103
+ | 'sso_domain';
104
+
105
+ export type TActivityAuthenticationMethod = 'magic_link' | 'password';
106
+ export type TActivitySessionKind = 'browser' | 'oidc';
107
+ export type TActivityRevocationScope =
108
+ | 'account'
109
+ | 'all_sessions'
110
+ | 'application'
111
+ | 'current_session'
112
+ | 'organization'
113
+ | 'token_family';
114
+ export type TActivityRoleChange = 'assigned' | 'removed' | 'replaced';
115
+ export type TActivityMfaFactor = 'backup_code' | 'passkey' | 'totp';
116
+ export type TActivityMembershipChange = 'added' | 'reconciled' | 'removed';
117
+ export type TActivityOidcTokenType = 'access_token' | 'refresh_token' | 'token_family';
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,10 +4,6 @@ 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[];
13
9
  transferTokenHash?: string | null;
@@ -1,14 +1,142 @@
1
- import type { TActivityAction } from '../data/activity.js';
1
+ import type {
2
+ TActivityAction,
3
+ TActivityAuthenticationMethod,
4
+ TActivityMembershipChange,
5
+ TActivityMfaFactor,
6
+ TActivityOidcTokenType,
7
+ TActivityOutcome,
8
+ TActivityReasonCode,
9
+ TActivityRevocationScope,
10
+ TActivityRoleChange,
11
+ TActivitySessionKind,
12
+ TActivityTargetType,
13
+ } from '../data/activity.js';
14
+ import type { TOAuthClientType } from '../data/app.js';
2
15
 
3
- export interface IActivityEventDto {
4
- id: string;
5
- data: {
6
- action: TActivityAction;
7
- timestamp: number;
8
- metadata: {
9
- description: string;
10
- ip?: string;
11
- targetType?: string;
12
- };
13
- };
14
- }
16
+ type TActivityEventFor<
17
+ TAction extends TActivityAction,
18
+ TTargetType extends TActivityTargetType,
19
+ TFacts,
20
+ > = TAction extends TActivityAction
21
+ ? {
22
+ action: TAction;
23
+ timestamp: number;
24
+ outcome: TActivityOutcome;
25
+ reasonCode?: TActivityReasonCode;
26
+ targetType: TTargetType;
27
+ facts: TFacts;
28
+ }
29
+ : never;
30
+
31
+ /**
32
+ * Browser-safe activity event. The action field discriminates the union, so
33
+ * every event has one fixed target type and only the explicitly allowlisted
34
+ * facts for that action. Internal event identities, actors, target identities,
35
+ * integrity data, delivery state, network data, and free text are excluded.
36
+ */
37
+ export type TActivityEventDto =
38
+ | TActivityEventFor<
39
+ 'login',
40
+ 'account',
41
+ { authenticationMethod: TActivityAuthenticationMethod }
42
+ >
43
+ | TActivityEventFor<'logout', 'account', null>
44
+ | TActivityEventFor<'session_created', 'session', { sessionKind: TActivitySessionKind }>
45
+ | TActivityEventFor<
46
+ 'session_revoked',
47
+ 'session',
48
+ { revocationScope: TActivityRevocationScope }
49
+ >
50
+ | TActivityEventFor<'passport_device_enrolled', 'passport_device', null>
51
+ | TActivityEventFor<'passport_device_revoked', 'passport_device', null>
52
+ | TActivityEventFor<'passport_challenge_approved', 'passport_challenge', null>
53
+ | TActivityEventFor<'passport_challenge_rejected', 'passport_challenge', null>
54
+ | TActivityEventFor<'org_created', 'organization', null>
55
+ | TActivityEventFor<'org_updated', 'organization', null>
56
+ | TActivityEventFor<'org_deleted', 'organization', null>
57
+ | TActivityEventFor<'org_ownership_transferred', 'organization', null>
58
+ | TActivityEventFor<'org_joined', 'organization_membership', null>
59
+ | TActivityEventFor<'org_left', 'organization_membership', null>
60
+ | TActivityEventFor<
61
+ 'role_changed',
62
+ 'organization_membership',
63
+ { roleChange: TActivityRoleChange }
64
+ >
65
+ | TActivityEventFor<'org_app_role_mappings_updated', 'organization_role_mapping', null>
66
+ | TActivityEventFor<'profile_updated', 'profile', null>
67
+ | TActivityEventFor<'totp_enabled', 'mfa_method', null>
68
+ | TActivityEventFor<'totp_disabled', 'mfa_method', null>
69
+ | TActivityEventFor<'backup_codes_regenerated', 'mfa_method', null>
70
+ | TActivityEventFor<'mfa_completed', 'mfa_method', { factor: TActivityMfaFactor }>
71
+ | TActivityEventFor<'passkey_registered', 'passkey', null>
72
+ | TActivityEventFor<'passkey_revoked', 'passkey', null>
73
+ | TActivityEventFor<'passkey_login', 'passkey', null>
74
+ | TActivityEventFor<'app_connected', 'application_connection', null>
75
+ | TActivityEventFor<'app_disconnected', 'application_connection', null>
76
+ | TActivityEventFor<'user_suspended', 'account', null>
77
+ | TActivityEventFor<'user_unsuspended', 'account', null>
78
+ | TActivityEventFor<'account_deletion_requested', 'account', null>
79
+ | TActivityEventFor<'account_deletion_cancelled', 'account', null>
80
+ | TActivityEventFor<'account_purged', 'account', null>
81
+ | TActivityEventFor<'sso_connection_created', 'sso_connection', { protocol: 'saml' }>
82
+ | TActivityEventFor<'sso_connection_updated', 'sso_connection', { protocol: 'saml' }>
83
+ | TActivityEventFor<'sso_connection_deleted', 'sso_connection', { protocol: 'saml' }>
84
+ | TActivityEventFor<'sso_domain_verified', 'sso_domain', { protocol: 'saml' }>
85
+ | TActivityEventFor<'sso_login', 'session', { protocol: 'saml' }>
86
+ | TActivityEventFor<'scim_token_created', 'scim_token', null>
87
+ | TActivityEventFor<'scim_token_revoked', 'scim_token', null>
88
+ | TActivityEventFor<'scim_user_provisioned', 'scim_user', null>
89
+ | TActivityEventFor<'scim_user_updated', 'scim_user', null>
90
+ | TActivityEventFor<'scim_user_deactivated', 'scim_user', null>
91
+ | TActivityEventFor<
92
+ 'scim_group_membership_changed',
93
+ 'scim_group_membership',
94
+ { membershipChange: TActivityMembershipChange }
95
+ >
96
+ | TActivityEventFor<
97
+ 'oidc_authorization_granted',
98
+ 'oidc_authorization',
99
+ { grantType: 'authorization_code' }
100
+ >
101
+ | TActivityEventFor<
102
+ 'oidc_code_exchanged',
103
+ 'oidc_token',
104
+ { grantType: 'authorization_code' }
105
+ >
106
+ | TActivityEventFor<'oidc_refresh_rotated', 'oidc_token', { grantType: 'refresh_token' }>
107
+ | TActivityEventFor<
108
+ 'oidc_refresh_reuse_detected',
109
+ 'oidc_token',
110
+ { grantType: 'refresh_token' }
111
+ >
112
+ | TActivityEventFor<
113
+ 'oidc_token_revoked',
114
+ 'oidc_token',
115
+ { tokenType: TActivityOidcTokenType }
116
+ >
117
+ | TActivityEventFor<
118
+ 'oidc_logout',
119
+ 'session',
120
+ { revocationScope: TActivityRevocationScope }
121
+ >
122
+ | TActivityEventFor<'oidc_client_created', 'oidc_client', { clientType: TOAuthClientType }>
123
+ | TActivityEventFor<'oidc_client_updated', 'oidc_client', { clientType: TOAuthClientType }>
124
+ | TActivityEventFor<
125
+ 'oidc_client_activation_changed',
126
+ 'oidc_client',
127
+ { clientType: TOAuthClientType; isActive: boolean }
128
+ >
129
+ | TActivityEventFor<'oidc_client_deleted', 'oidc_client', { clientType: TOAuthClientType }>
130
+ | TActivityEventFor<
131
+ 'oidc_client_secret_rotated',
132
+ 'oidc_client',
133
+ { clientType: 'confidential' }
134
+ >
135
+ | TActivityEventFor<'oidc_signing_key_rotated', 'oidc_signing_key', null>
136
+ | TActivityEventFor<
137
+ 'oidc_lifecycle_revoked',
138
+ 'oidc_lifecycle',
139
+ { revocationScope: TActivityRevocationScope }
140
+ >
141
+ | TActivityEventFor<'org_suspended', 'organization', null>
142
+ | TActivityEventFor<'org_unsuspended', 'organization', null>;
package/ts/readme.md CHANGED
@@ -48,7 +48,7 @@ The `data` export includes types for:
48
48
  - JWT payloads
49
49
  - login sessions
50
50
  - devices
51
- - activity logs
51
+ - finite activity classifications
52
52
  - alerts and alert rules
53
53
  - apps and app connections
54
54
  - billing plans and Paddle checkout data
@@ -67,13 +67,13 @@ 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
 
74
74
  ### `dto`
75
75
 
76
- The `dto` export includes normalized transfer objects for activity, alerts, apps, billing, invitations, MFA, organizations, passport, and users.
76
+ The `dto` export includes normalized transfer objects for activity, alerts, apps, billing, invitations, MFA, organizations, passport, and users. Activity responses use the discriminated `TActivityEventDto` union, which contains only finite classifications and allowlisted per-action facts. Persistence identities, actor and target identities, free text, network data, integrity fields, and sink delivery state are backend-private.
77
77
 
78
78
  ### `tags`
79
79
 
@@ -113,8 +113,15 @@ 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
121
+ tokens. Transfer-token exchange uses the minimal `data.ITransferTarget`
122
+ contract with an `appUrl`; it does not expose the removed flat legacy app
123
+ shape.
124
+
118
125
  Public app contracts contain client type, callback and post-logout URIs,
119
126
  allowed scopes, grant types, and bounded token lifetime settings. Secret hashes,
120
127
  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;
@@ -140,7 +140,7 @@ export type TOrgExportRecord =
140
140
  | { kind: 'invitation'; payload: dto.IUserInvitationDto }
141
141
  | { kind: 'ssoConnection'; payload: dto.ISsoConnectionDto }
142
142
  | { kind: 'scimToken'; payload: dto.IScimTokenDto }
143
- | { kind: 'activity'; payload: dto.IActivityEventDto };
143
+ | { kind: 'activity'; payload: dto.TActivityEventDto };
144
144
 
145
145
  /**
146
146
  * Cursor-paged export of an organization's data (data portability /
@@ -104,7 +104,7 @@ export interface IReq_GetUserActivity
104
104
  offset?: number;
105
105
  };
106
106
  response: {
107
- activities: dto.IActivityEventDto[];
107
+ activities: dto.TActivityEventDto[];
108
108
  total: number;
109
109
  };
110
110
  }
@@ -180,7 +180,7 @@ export interface IReq_ExportUserActivity
180
180
  until?: number;
181
181
  };
182
182
  response: {
183
- activities: dto.IActivityEventDto[];
183
+ activities: dto.TActivityEventDto[];
184
184
  /** absent when the export is complete */
185
185
  nextCursor?: string;
186
186
  };