@idp.global/interfaces 9.1.0 → 9.3.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-10 - 9.3.0
4
+
5
+ ### Features
6
+
7
+ - add SSO domain verification contracts (sso)
8
+ - Define SSO domain verification status, DNS TXT challenge, and globally unique domain claim interfaces.
9
+ - Expose optional domainVerifications on SSO connection DTOs.
10
+ - Add verifySsoDomain typed request contract and sso_domain_verified activity type.
11
+ - Update pnpm workspace package manager and build approval configuration.
12
+
13
+ ## 2026-07-08 - 9.2.0
14
+
15
+ ### Features
16
+
17
+ - add account deletion and org export contracts (governance)
18
+ - IReq_DeleteAccount: self-service deletion with re-authentication (password, or confirmEmail for passwordless accounts), 7-day grace window before purge; org ownership blocks deletion
19
+ - IReq_DeleteSuspendedUser: immediate admin purge of suspended accounts
20
+ - IReq_ExportOrgData: owner-only cursor-paged export streaming redacted DTOs (TOrgExportRecord union)
21
+ - IUser gains optional deletion {requestedAt, purgeAt}; TActivityAction gains account_deletion_requested/account_deletion_cancelled/account_purged
22
+
3
23
  ## 2026-07-08 - 9.1.0
4
24
 
5
25
  ### Features
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@idp.global/interfaces',
6
- version: '9.1.0',
6
+ version: '9.3.0',
7
7
  description: 'Shared TypeScript interfaces and TypedRequest contracts for the idp.global ecosystem.'
8
8
  };
9
9
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx3QkFBd0I7SUFDOUIsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLHVGQUF1RjtDQUNyRyxDQUFBIn0=
@@ -1,4 +1,4 @@
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' | 'sso_connection_created' | 'sso_connection_updated' | 'sso_connection_deleted' | 'sso_login' | 'scim_token_created' | 'scim_token_revoked' | 'scim_user_provisioned' | 'scim_user_updated' | 'scim_user_deactivated' | 'scim_group_membership_changed';
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';
2
2
  export interface IActivityLog {
3
3
  id: string;
4
4
  data: {
@@ -5,6 +5,20 @@
5
5
  * - jit-and-scim: both paths are allowed
6
6
  */
7
7
  export type TSsoProvisioningMode = 'jit' | 'scim-only' | 'jit-and-scim';
8
+ export type TSsoDomainVerificationStatus = 'pending' | 'verified';
9
+ /**
10
+ * DNS TXT ownership proof for one email domain claimed by an SSO connection.
11
+ * The TXT challenge is public material and may be shown to organization admins.
12
+ */
13
+ export interface ISsoDomainVerification {
14
+ domain: string;
15
+ status: TSsoDomainVerificationStatus;
16
+ dnsTxtName: string;
17
+ dnsTxtValue: string;
18
+ createdAt: number;
19
+ lastCheckedAt?: number;
20
+ verifiedAt?: number;
21
+ }
8
22
  /**
9
23
  * Maps an IdP-side group name to org roles on idp.global.
10
24
  * Used both for SAML group attributes and SCIM group memberships.
@@ -37,8 +51,8 @@ export interface ISsoConnection {
37
51
  displayName: string;
38
52
  status: 'active' | 'disabled';
39
53
  /**
40
- * Email domains routed to this connection during home-realm discovery.
41
- * Globally unique across all connections.
54
+ * Email domains claimed by this connection. Claims are globally unique,
55
+ * but only verified claims may enable home-realm discovery or SAML login.
42
56
  */
43
57
  emailDomains: string[];
44
58
  idp: {
@@ -65,6 +79,17 @@ export interface ISsoConnection {
65
79
  updatedAt: number;
66
80
  };
67
81
  }
82
+ /**
83
+ * Authoritative globally unique email-domain claim. This is persisted
84
+ * separately from the SSO connection so concurrent claims cannot race.
85
+ */
86
+ export interface ISsoDomainClaim {
87
+ id: string;
88
+ data: ISsoDomainVerification & {
89
+ organizationId: string;
90
+ connectionId: string;
91
+ };
92
+ }
68
93
  /**
69
94
  * Internal persisted SCIM bearer token record. Never return this shape to
70
95
  * clients; the plaintext token is shown exactly once at creation.
@@ -22,6 +22,15 @@ export interface IUser {
22
22
  * field existed (derive from the Mongo ObjectId timestamp when missing)
23
23
  */
24
24
  createdAt?: number;
25
+ /**
26
+ * present while an account deletion is pending: the account is locked
27
+ * (status 'deleted') and housekeeping purges it after purgeAt.
28
+ * A global admin can cancel by reactivating the account within the window.
29
+ */
30
+ deletion?: {
31
+ requestedAt: number;
32
+ purgeAt: number;
33
+ };
25
34
  /**
26
35
  * a quick ref for which organizations might have roles for this user
27
36
  * speeds up lookup
@@ -1,4 +1,4 @@
1
- import type { TSsoProvisioningMode, IGroupRoleMapping, ISsoAttributeMapping } from '../data/ssoconnection.js';
1
+ import type { TSsoProvisioningMode, IGroupRoleMapping, ISsoAttributeMapping, ISsoDomainVerification } from '../data/ssoconnection.js';
2
2
  /**
3
3
  * Client-facing SSO connection shape. IdP signing certificates are public
4
4
  * material and stay included; the raw metadata XML is omitted.
@@ -11,6 +11,8 @@ export interface ISsoConnectionDto {
11
11
  displayName: string;
12
12
  status: 'active' | 'disabled';
13
13
  emailDomains: string[];
14
+ /** Present on servers that enforce DNS ownership verification. */
15
+ domainVerifications?: ISsoDomainVerification[];
14
16
  idp: {
15
17
  entityId: string;
16
18
  ssoUrl: string;
@@ -94,3 +94,50 @@ export interface IReq_DeleteOrgRoleDefinition extends plugins.typedRequestInterf
94
94
  message?: string;
95
95
  };
96
96
  }
97
+ /**
98
+ * One typed record of an organization data export.
99
+ */
100
+ export type TOrgExportRecord = {
101
+ kind: 'organization';
102
+ payload: dto.IOrganizationDto;
103
+ } | {
104
+ kind: 'member';
105
+ payload: {
106
+ user: dto.IUserProfileDto;
107
+ roles: string[];
108
+ };
109
+ } | {
110
+ kind: 'invitation';
111
+ payload: dto.IUserInvitationDto;
112
+ } | {
113
+ kind: 'ssoConnection';
114
+ payload: dto.ISsoConnectionDto;
115
+ } | {
116
+ kind: 'scimToken';
117
+ payload: dto.IScimTokenDto;
118
+ } | {
119
+ kind: 'activity';
120
+ payload: dto.IActivityEventDto;
121
+ };
122
+ /**
123
+ * Cursor-paged export of an organization's data (data portability /
124
+ * compliance evidence). Owner-only. Streams redacted DTOs — never token
125
+ * hashes, certificates' private material, or member credentials. Iterate
126
+ * until nextCursor is absent.
127
+ */
128
+ export interface IReq_ExportOrgData extends plugins.typedRequestInterfaces.implementsTR<plugins.typedRequestInterfaces.ITypedRequest, IReq_ExportOrgData> {
129
+ method: 'exportOrgData';
130
+ request: {
131
+ jwt: string;
132
+ organizationId: string;
133
+ /** opaque cursor from the previous page */
134
+ cursor?: string;
135
+ /** page size, capped server-side */
136
+ limit?: number;
137
+ };
138
+ response: {
139
+ records: TOrgExportRecord[];
140
+ /** absent when the export is complete */
141
+ nextCursor?: string;
142
+ };
143
+ }
@@ -100,6 +100,22 @@ export interface IReq_GetSsoSpDetails extends plugins.typedRequestInterfaces.imp
100
100
  spDetails: dto.ISsoSpDetailsDto;
101
101
  };
102
102
  }
103
+ /**
104
+ * Check the DNS TXT ownership challenge for an SSO email domain (org admin only).
105
+ * The domain must already be claimed by the specified connection.
106
+ */
107
+ export interface IReq_VerifySsoDomain extends plugins.typedRequestInterfaces.implementsTR<plugins.typedRequestInterfaces.ITypedRequest, IReq_VerifySsoDomain> {
108
+ method: 'verifySsoDomain';
109
+ request: {
110
+ jwt: string;
111
+ connectionId: string;
112
+ domain: string;
113
+ };
114
+ response: {
115
+ verified: boolean;
116
+ connection: dto.ISsoConnectionDto;
117
+ };
118
+ }
103
119
  /**
104
120
  * Create a SCIM bearer token for an organization (org admin only).
105
121
  * The plaintext token is returned exactly once.
@@ -77,6 +77,44 @@ export interface IReq_GetUserActivity extends plugins.typedRequestInterfaces.imp
77
77
  total: number;
78
78
  };
79
79
  }
80
+ /**
81
+ * Self-service account deletion. Requires re-authentication: the account
82
+ * password when one is set (SSO/passkey-only accounts pass confirmEmail
83
+ * instead). Owning any organization blocks deletion until ownership is
84
+ * transferred or the organization is deleted. On success the account is
85
+ * locked immediately (all sessions and JWTs revoked, sign-in rejected) and
86
+ * purged after a 7-day grace window; a global admin can cancel within the
87
+ * window by reactivating the account.
88
+ */
89
+ export interface IReq_DeleteAccount extends plugins.typedRequestInterfaces.implementsTR<plugins.typedRequestInterfaces.ITypedRequest, IReq_DeleteAccount> {
90
+ method: 'deleteAccount';
91
+ request: {
92
+ jwt: string;
93
+ /** required when the account has a password */
94
+ password?: string;
95
+ /** required when the account has no password: must equal the account email */
96
+ confirmEmail?: string;
97
+ };
98
+ response: {
99
+ success: boolean;
100
+ /** epoch ms when the account will be purged */
101
+ purgeAt: number;
102
+ };
103
+ }
104
+ /**
105
+ * Immediate, irreversible purge of a suspended account (global admin only).
106
+ * The target must currently be suspended or in a pending-deletion state.
107
+ */
108
+ export interface IReq_DeleteSuspendedUser extends plugins.typedRequestInterfaces.implementsTR<plugins.typedRequestInterfaces.ITypedRequest, IReq_DeleteSuspendedUser> {
109
+ method: 'deleteSuspendedUser';
110
+ request: {
111
+ jwt: string;
112
+ userId: string;
113
+ };
114
+ response: {
115
+ success: boolean;
116
+ };
117
+ }
80
118
  /**
81
119
  * Cursor-paged export of the authenticated user's full activity trail
82
120
  * (SOC2 audit evidence / data portability). Iterate until nextCursor is
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idp.global/interfaces",
3
- "version": "9.1.0",
3
+ "version": "9.3.0",
4
4
  "private": false,
5
5
  "description": "Shared TypeScript interfaces and TypedRequest contracts for the idp.global ecosystem.",
6
6
  "exports": {
@@ -16,7 +16,7 @@
16
16
  "devDependencies": {
17
17
  "@git.zone/tsbuild": "^4.4.2",
18
18
  "@git.zone/tsdoc": "^2.1.1",
19
- "@git.zone/tsrun": "^2.0.4",
19
+ "@git.zone/tsrun": "^2.0.5",
20
20
  "@git.zone/tstest": "^3.6.6",
21
21
  "@types/node": "^26.0.0"
22
22
  },
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@idp.global/interfaces',
6
- version: '9.1.0',
6
+ version: '9.3.0',
7
7
  description: 'Shared TypeScript interfaces and TypedRequest contracts for the idp.global ecosystem.'
8
8
  }
@@ -27,9 +27,13 @@ export type TActivityAction =
27
27
  | 'app_disconnected'
28
28
  | 'user_suspended'
29
29
  | 'user_unsuspended'
30
+ | 'account_deletion_requested'
31
+ | 'account_deletion_cancelled'
32
+ | 'account_purged'
30
33
  | 'sso_connection_created'
31
34
  | 'sso_connection_updated'
32
35
  | 'sso_connection_deleted'
36
+ | 'sso_domain_verified'
33
37
  | 'sso_login'
34
38
  | 'scim_token_created'
35
39
  | 'scim_token_revoked'
@@ -6,6 +6,22 @@
6
6
  */
7
7
  export type TSsoProvisioningMode = 'jit' | 'scim-only' | 'jit-and-scim';
8
8
 
9
+ export type TSsoDomainVerificationStatus = 'pending' | 'verified';
10
+
11
+ /**
12
+ * DNS TXT ownership proof for one email domain claimed by an SSO connection.
13
+ * The TXT challenge is public material and may be shown to organization admins.
14
+ */
15
+ export interface ISsoDomainVerification {
16
+ domain: string;
17
+ status: TSsoDomainVerificationStatus;
18
+ dnsTxtName: string;
19
+ dnsTxtValue: string;
20
+ createdAt: number;
21
+ lastCheckedAt?: number;
22
+ verifiedAt?: number;
23
+ }
24
+
9
25
  /**
10
26
  * Maps an IdP-side group name to org roles on idp.global.
11
27
  * Used both for SAML group attributes and SCIM group memberships.
@@ -40,8 +56,8 @@ export interface ISsoConnection {
40
56
  displayName: string;
41
57
  status: 'active' | 'disabled';
42
58
  /**
43
- * Email domains routed to this connection during home-realm discovery.
44
- * Globally unique across all connections.
59
+ * Email domains claimed by this connection. Claims are globally unique,
60
+ * but only verified claims may enable home-realm discovery or SAML login.
45
61
  */
46
62
  emailDomains: string[];
47
63
  idp: {
@@ -69,6 +85,18 @@ export interface ISsoConnection {
69
85
  };
70
86
  }
71
87
 
88
+ /**
89
+ * Authoritative globally unique email-domain claim. This is persisted
90
+ * separately from the SSO connection so concurrent claims cannot race.
91
+ */
92
+ export interface ISsoDomainClaim {
93
+ id: string;
94
+ data: ISsoDomainVerification & {
95
+ organizationId: string;
96
+ connectionId: string;
97
+ };
98
+ }
99
+
72
100
  /**
73
101
  * Internal persisted SCIM bearer token record. Never return this shape to
74
102
  * clients; the plaintext token is shown exactly once at creation.
package/ts/data/user.ts CHANGED
@@ -26,6 +26,15 @@ export interface IUser {
26
26
  * field existed (derive from the Mongo ObjectId timestamp when missing)
27
27
  */
28
28
  createdAt?: number;
29
+ /**
30
+ * present while an account deletion is pending: the account is locked
31
+ * (status 'deleted') and housekeeping purges it after purgeAt.
32
+ * A global admin can cancel by reactivating the account within the window.
33
+ */
34
+ deletion?: {
35
+ requestedAt: number;
36
+ purgeAt: number;
37
+ };
29
38
  /**
30
39
  * a quick ref for which organizations might have roles for this user
31
40
  * speeds up lookup
@@ -1,4 +1,9 @@
1
- import type { TSsoProvisioningMode, IGroupRoleMapping, ISsoAttributeMapping } from '../data/ssoconnection.js';
1
+ import type {
2
+ TSsoProvisioningMode,
3
+ IGroupRoleMapping,
4
+ ISsoAttributeMapping,
5
+ ISsoDomainVerification,
6
+ } from '../data/ssoconnection.js';
2
7
 
3
8
  /**
4
9
  * Client-facing SSO connection shape. IdP signing certificates are public
@@ -12,6 +17,8 @@ export interface ISsoConnectionDto {
12
17
  displayName: string;
13
18
  status: 'active' | 'disabled';
14
19
  emailDomains: string[];
20
+ /** Present on servers that enforce DNS ownership verification. */
21
+ domainVerifications?: ISsoDomainVerification[];
15
22
  idp: {
16
23
  entityId: string;
17
24
  ssoUrl: string;
@@ -130,3 +130,41 @@ export interface IReq_DeleteOrgRoleDefinition
130
130
  message?: string;
131
131
  };
132
132
  }
133
+
134
+ /**
135
+ * One typed record of an organization data export.
136
+ */
137
+ export type TOrgExportRecord =
138
+ | { kind: 'organization'; payload: dto.IOrganizationDto }
139
+ | { kind: 'member'; payload: { user: dto.IUserProfileDto; roles: string[] } }
140
+ | { kind: 'invitation'; payload: dto.IUserInvitationDto }
141
+ | { kind: 'ssoConnection'; payload: dto.ISsoConnectionDto }
142
+ | { kind: 'scimToken'; payload: dto.IScimTokenDto }
143
+ | { kind: 'activity'; payload: dto.IActivityEventDto };
144
+
145
+ /**
146
+ * Cursor-paged export of an organization's data (data portability /
147
+ * compliance evidence). Owner-only. Streams redacted DTOs — never token
148
+ * hashes, certificates' private material, or member credentials. Iterate
149
+ * until nextCursor is absent.
150
+ */
151
+ export interface IReq_ExportOrgData
152
+ extends plugins.typedRequestInterfaces.implementsTR<
153
+ plugins.typedRequestInterfaces.ITypedRequest,
154
+ IReq_ExportOrgData
155
+ > {
156
+ method: 'exportOrgData';
157
+ request: {
158
+ jwt: string;
159
+ organizationId: string;
160
+ /** opaque cursor from the previous page */
161
+ cursor?: string;
162
+ /** page size, capped server-side */
163
+ limit?: number;
164
+ };
165
+ response: {
166
+ records: TOrgExportRecord[];
167
+ /** absent when the export is complete */
168
+ nextCursor?: string;
169
+ };
170
+ }
@@ -126,6 +126,27 @@ export interface IReq_GetSsoSpDetails
126
126
  };
127
127
  }
128
128
 
129
+ /**
130
+ * Check the DNS TXT ownership challenge for an SSO email domain (org admin only).
131
+ * The domain must already be claimed by the specified connection.
132
+ */
133
+ export interface IReq_VerifySsoDomain
134
+ extends plugins.typedRequestInterfaces.implementsTR<
135
+ plugins.typedRequestInterfaces.ITypedRequest,
136
+ IReq_VerifySsoDomain
137
+ > {
138
+ method: 'verifySsoDomain';
139
+ request: {
140
+ jwt: string;
141
+ connectionId: string;
142
+ domain: string;
143
+ };
144
+ response: {
145
+ verified: boolean;
146
+ connection: dto.ISsoConnectionDto;
147
+ };
148
+ }
149
+
129
150
  /**
130
151
  * Create a SCIM bearer token for an organization (org admin only).
131
152
  * The plaintext token is returned exactly once.
@@ -109,6 +109,54 @@ export interface IReq_GetUserActivity
109
109
  };
110
110
  }
111
111
 
112
+ /**
113
+ * Self-service account deletion. Requires re-authentication: the account
114
+ * password when one is set (SSO/passkey-only accounts pass confirmEmail
115
+ * instead). Owning any organization blocks deletion until ownership is
116
+ * transferred or the organization is deleted. On success the account is
117
+ * locked immediately (all sessions and JWTs revoked, sign-in rejected) and
118
+ * purged after a 7-day grace window; a global admin can cancel within the
119
+ * window by reactivating the account.
120
+ */
121
+ export interface IReq_DeleteAccount
122
+ extends plugins.typedRequestInterfaces.implementsTR<
123
+ plugins.typedRequestInterfaces.ITypedRequest,
124
+ IReq_DeleteAccount
125
+ > {
126
+ method: 'deleteAccount';
127
+ request: {
128
+ jwt: string;
129
+ /** required when the account has a password */
130
+ password?: string;
131
+ /** required when the account has no password: must equal the account email */
132
+ confirmEmail?: string;
133
+ };
134
+ response: {
135
+ success: boolean;
136
+ /** epoch ms when the account will be purged */
137
+ purgeAt: number;
138
+ };
139
+ }
140
+
141
+ /**
142
+ * Immediate, irreversible purge of a suspended account (global admin only).
143
+ * The target must currently be suspended or in a pending-deletion state.
144
+ */
145
+ export interface IReq_DeleteSuspendedUser
146
+ extends plugins.typedRequestInterfaces.implementsTR<
147
+ plugins.typedRequestInterfaces.ITypedRequest,
148
+ IReq_DeleteSuspendedUser
149
+ > {
150
+ method: 'deleteSuspendedUser';
151
+ request: {
152
+ jwt: string;
153
+ userId: string;
154
+ };
155
+ response: {
156
+ success: boolean;
157
+ };
158
+ }
159
+
112
160
  /**
113
161
  * Cursor-paged export of the authenticated user's full activity trail
114
162
  * (SOC2 audit evidence / data portability). Iterate until nextCursor is