@drmhse/sso-sdk 0.3.14 → 0.5.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/index.d.ts CHANGED
@@ -108,7 +108,7 @@ type ServiceType = 'web' | 'mobile' | 'desktop' | 'api';
108
108
  /**
109
109
  * Organization member roles
110
110
  */
111
- type MemberRole = 'owner' | 'admin' | 'member';
111
+ type MemberRole = 'owner' | 'admin' | 'member' | (string & {});
112
112
  /**
113
113
  * Invitation status
114
114
  */
@@ -182,8 +182,11 @@ interface RiskEventResponse {
182
182
  created_at: string;
183
183
  risk_score: number;
184
184
  risk_factors: string[];
185
+ risk_action: RiskAction | string;
185
186
  geo_country?: string;
186
187
  geo_city?: string;
188
+ geo_lat?: number;
189
+ geo_long?: number;
187
190
  ip_address?: string;
188
191
  provider: string;
189
192
  }
@@ -320,6 +323,10 @@ interface RegisterRequest {
320
323
  * This ensures password users are tracked the same as OAuth users.
321
324
  */
322
325
  service_slug?: string;
326
+ /**
327
+ * Optional service callback URI to preserve the original app return path in the verification link.
328
+ */
329
+ redirect_uri?: string;
323
330
  }
324
331
  /**
325
332
  * Registration response
@@ -344,6 +351,12 @@ interface LoginRequest {
344
351
  * Only required for regular members; org owners/admins can omit.
345
352
  */
346
353
  service_slug?: string;
354
+ /**
355
+ * Optional service callback URI for hosted password login.
356
+ * When supplied with org_slug and service_slug, the API validates it
357
+ * against the service before tokens are returned to the hosted UI.
358
+ */
359
+ redirect_uri?: string;
347
360
  }
348
361
  /**
349
362
  * Forgot password request payload
@@ -351,6 +364,8 @@ interface LoginRequest {
351
364
  interface ForgotPasswordRequest {
352
365
  email: string;
353
366
  org_slug?: string;
367
+ service_slug?: string;
368
+ redirect_uri?: string;
354
369
  }
355
370
  /**
356
371
  * Forgot password response
@@ -376,6 +391,9 @@ interface ResetPasswordResponse {
376
391
  */
377
392
  interface ResendVerificationRequest {
378
393
  email: string;
394
+ org_slug?: string;
395
+ service_slug?: string;
396
+ redirect_uri?: string;
379
397
  }
380
398
  /**
381
399
  * Resend verification response
@@ -435,6 +453,43 @@ interface LookupEmailResponse {
435
453
  */
436
454
  auth_method: 'upstream' | 'password' | 'oauth';
437
455
  }
456
+ /**
457
+ * Public hosted-auth context request.
458
+ */
459
+ interface AuthContextRequest {
460
+ org?: string;
461
+ service?: string;
462
+ redirect_uri?: string;
463
+ }
464
+ /**
465
+ * Public hosted-auth organization context.
466
+ */
467
+ interface AuthOrganizationContext {
468
+ slug: string;
469
+ name: string;
470
+ logo_url?: string | null;
471
+ primary_color?: string | null;
472
+ status: string;
473
+ }
474
+ /**
475
+ * Public hosted-auth service context.
476
+ */
477
+ interface AuthServiceContext {
478
+ slug: string;
479
+ name: string;
480
+ service_type: string;
481
+ redirect_uri_valid?: boolean | null;
482
+ }
483
+ /**
484
+ * Public hosted-auth context response.
485
+ */
486
+ interface AuthContextResponse {
487
+ organization: AuthOrganizationContext | null;
488
+ service: AuthServiceContext | null;
489
+ available_providers: string[];
490
+ auth_methods: string[];
491
+ support_available: boolean;
492
+ }
438
493
 
439
494
  /**
440
495
  * User subscription details
@@ -464,6 +519,54 @@ interface Identity {
464
519
  interface StartLinkResponse {
465
520
  authorization_url: string;
466
521
  }
522
+ interface ProviderDefinition {
523
+ provider: string;
524
+ display_name: string;
525
+ provider_type: string;
526
+ scopes: string[];
527
+ connect_supported: boolean;
528
+ }
529
+ interface LinkedAccountGrant {
530
+ id: string;
531
+ service_id: string;
532
+ scopes: string[];
533
+ granted_at: string;
534
+ last_used_at?: string;
535
+ }
536
+ interface LinkedAccount {
537
+ id: string;
538
+ provider: string;
539
+ provider_user_id: string;
540
+ email?: string;
541
+ display_name?: string;
542
+ scopes: string[];
543
+ expires_at?: string;
544
+ status: string;
545
+ grants: LinkedAccountGrant[];
546
+ }
547
+ interface LinkedAccountsResponse {
548
+ accounts: LinkedAccount[];
549
+ available_providers: ProviderDefinition[];
550
+ }
551
+ interface GrantLinkedAccountRequest {
552
+ service_id?: string;
553
+ scopes: string[];
554
+ }
555
+ interface ProviderTokenRequestDetails {
556
+ state: string;
557
+ provider: string;
558
+ requested_scopes: string[];
559
+ service_id: string;
560
+ service_name: string;
561
+ expires_at: string;
562
+ accounts: LinkedAccount[];
563
+ }
564
+ interface CompleteProviderTokenRequestPayload {
565
+ connected_account_id?: string;
566
+ }
567
+ interface CompleteProviderTokenRequestResponse {
568
+ redirect_url: string;
569
+ }
467
570
  /**
468
571
  * Change password request payload
469
572
  */
@@ -589,6 +692,12 @@ interface Organization {
589
692
  rejected_by?: string | null;
590
693
  rejected_at?: string | null;
591
694
  rejection_reason?: string | null;
695
+ custom_domain?: string | null;
696
+ domain_verified?: boolean;
697
+ domain_verification_token?: string | null;
698
+ brand_logo_url?: string | null;
699
+ brand_primary_color?: string | null;
700
+ feature_overrides?: string | Record<string, unknown> | null;
592
701
  created_at: string;
593
702
  updated_at: string;
594
703
  }
@@ -634,6 +743,18 @@ interface OrganizationMember {
634
743
  role: MemberRole;
635
744
  joined_at: string;
636
745
  }
746
+ interface MemberServiceAccess {
747
+ service_id: string;
748
+ service_slug: string;
749
+ service_name: string;
750
+ access: 'viewer' | 'manager' | null;
751
+ }
752
+ interface UpdateMemberServiceAccessPayload {
753
+ grants: Array<{
754
+ service_slug: string;
755
+ access: 'viewer' | 'manager' | null;
756
+ }>;
757
+ }
637
758
  /**
638
759
  * Create organization payload (authenticated endpoint)
639
760
  */
@@ -842,6 +963,7 @@ interface WebhookResponse {
842
963
  url: string;
843
964
  events: string[];
844
965
  is_active: boolean;
966
+ secret?: string;
845
967
  created_at: string;
846
968
  updated_at: string;
847
969
  }
@@ -1028,6 +1150,7 @@ interface Service {
1028
1150
  name: string;
1029
1151
  service_type: ServiceType;
1030
1152
  client_id: string;
1153
+ client_secret?: string | null;
1031
1154
  github_scopes: string[];
1032
1155
  microsoft_scopes: string[];
1033
1156
  google_scopes: string[];
@@ -1043,16 +1166,6 @@ interface Service {
1043
1166
  saml_sign_response: boolean;
1044
1167
  created_at: string;
1045
1168
  }
1046
- /**
1047
- * Provider token grant configuration
1048
- */
1049
- interface ProviderTokenGrant {
1050
- id: string;
1051
- service_id: string;
1052
- provider: string;
1053
- scopes: string[];
1054
- created_at: string;
1055
- }
1056
1169
  /**
1057
1170
  * Subscription plan
1058
1171
  */
@@ -1075,6 +1188,30 @@ interface PlanResponse {
1075
1188
  plan: Plan;
1076
1189
  subscription_count: number;
1077
1190
  }
1191
+ /**
1192
+ * Create plan payload
1193
+ */
1194
+ interface CreatePlanPayload {
1195
+ name: string;
1196
+ description?: string;
1197
+ price_cents: number;
1198
+ currency: string;
1199
+ features?: string[];
1200
+ stripe_price_id?: string;
1201
+ is_default?: boolean;
1202
+ }
1203
+ /**
1204
+ * Update plan payload
1205
+ */
1206
+ interface UpdatePlanPayload {
1207
+ name?: string;
1208
+ description?: string;
1209
+ price_cents?: number;
1210
+ currency?: string;
1211
+ features?: string[];
1212
+ stripe_price_id?: string | null;
1213
+ is_default?: boolean;
1214
+ }
1078
1215
  /**
1079
1216
  * Create service payload
1080
1217
  */
@@ -1093,7 +1230,6 @@ interface CreateServicePayload {
1093
1230
  */
1094
1231
  interface CreateServiceResponse {
1095
1232
  service: Service;
1096
- provider_grants: ProviderTokenGrant[];
1097
1233
  default_plan: Plan;
1098
1234
  usage: {
1099
1235
  current_services: number;
@@ -1101,6 +1237,10 @@ interface CreateServiceResponse {
1101
1237
  tier: string;
1102
1238
  };
1103
1239
  }
1240
+ interface RotateServiceSecretResponse {
1241
+ service: Service;
1242
+ client_secret: string;
1243
+ }
1104
1244
  /**
1105
1245
  * Update service payload
1106
1246
  */
@@ -1114,41 +1254,10 @@ interface UpdateServicePayload {
1114
1254
  device_activation_uri?: string;
1115
1255
  }
1116
1256
  /**
1117
- * Service response with details
1257
+ * Service with aggregated details (for listing)
1118
1258
  */
1119
- interface ServiceResponse {
1259
+ interface ServiceWithDetails {
1120
1260
  service: Service;
1121
- provider_grants: ProviderTokenGrant[];
1122
- plans: Plan[];
1123
- }
1124
- /**
1125
- * Create plan payload
1126
- */
1127
- interface CreatePlanPayload {
1128
- name: string;
1129
- description?: string;
1130
- price_cents: number;
1131
- currency: string;
1132
- features?: string[];
1133
- stripe_price_id?: string;
1134
- is_default?: boolean;
1135
- }
1136
- /**
1137
- * Update plan payload
1138
- */
1139
- interface UpdatePlanPayload {
1140
- name?: string;
1141
- description?: string;
1142
- price_cents?: number;
1143
- currency?: string;
1144
- features?: string[];
1145
- stripe_price_id?: string | null;
1146
- is_default?: boolean;
1147
- }
1148
- /**
1149
- * Service with aggregated details
1150
- */
1151
- interface ServiceWithDetails extends Service {
1152
1261
  plan_count: number;
1153
1262
  subscription_count: number;
1154
1263
  }
@@ -1522,6 +1631,30 @@ interface EndUserIdentity {
1522
1631
  provider_user_id: string;
1523
1632
  created_at: string;
1524
1633
  }
1634
+ interface EndUserSession {
1635
+ id: string;
1636
+ service_id?: string | null;
1637
+ service_name?: string | null;
1638
+ org_slug?: string | null;
1639
+ ip_address?: string | null;
1640
+ user_agent?: string | null;
1641
+ expires_at: string;
1642
+ refresh_token_expires_at?: string | null;
1643
+ created_at: string;
1644
+ }
1645
+ interface EndUserLoginEvent {
1646
+ id: string;
1647
+ service_id?: string | null;
1648
+ service_name?: string | null;
1649
+ provider: string;
1650
+ ip_address?: string | null;
1651
+ user_agent?: string | null;
1652
+ risk_score?: number | null;
1653
+ risk_factors: string[];
1654
+ geo_country?: string | null;
1655
+ geo_city?: string | null;
1656
+ created_at: string;
1657
+ }
1525
1658
  /**
1526
1659
  * End-user with subscriptions and identities
1527
1660
  */
@@ -1557,6 +1690,8 @@ interface EndUserDetailResponse {
1557
1690
  subscriptions: EndUserSubscription[];
1558
1691
  identities: EndUserIdentity[];
1559
1692
  session_count: number;
1693
+ sessions: EndUserSession[];
1694
+ recent_logins: EndUserLoginEvent[];
1560
1695
  }
1561
1696
  /**
1562
1697
  * List end-users query params
@@ -1636,6 +1771,9 @@ interface PasskeyRegisterFinishResponse {
1636
1771
  */
1637
1772
  interface PasskeyAuthStartRequest {
1638
1773
  email: string;
1774
+ org_slug?: string;
1775
+ service_slug?: string;
1776
+ redirect_uri?: string;
1639
1777
  }
1640
1778
  /**
1641
1779
  * Response from starting passkey authentication
@@ -1655,6 +1793,10 @@ interface PasskeyAuthFinishRequest {
1655
1793
  * Response from finishing passkey authentication
1656
1794
  */
1657
1795
  interface PasskeyAuthFinishResponse {
1796
+ access_token: string;
1797
+ refresh_token: string;
1798
+ expires_in: number;
1799
+ /** Backward compatible alias for access_token. */
1658
1800
  token: string;
1659
1801
  user_id: string;
1660
1802
  device_trust_token?: string;
@@ -1705,6 +1847,25 @@ interface Passkey {
1705
1847
  last_used_at?: string;
1706
1848
  created_at: string;
1707
1849
  }
1850
+ /**
1851
+ * Passkey shown in authenticated self-service settings.
1852
+ */
1853
+ interface UserPasskey {
1854
+ id: string;
1855
+ name: string;
1856
+ backup_eligible: boolean;
1857
+ backup_state: boolean;
1858
+ transports?: string | null;
1859
+ last_used_at?: string | null;
1860
+ created_at: string;
1861
+ }
1862
+ /**
1863
+ * Generic passkey action response.
1864
+ */
1865
+ interface PasskeyActionResponse {
1866
+ success: boolean;
1867
+ message: string;
1868
+ }
1708
1869
 
1709
1870
  /**
1710
1871
  * Privacy and GDPR compliance types
@@ -1774,6 +1935,13 @@ interface ExportUserDataResponse {
1774
1935
  mfa_events: MfaEventExport[];
1775
1936
  passkeys: PasskeyExport[];
1776
1937
  }
1938
+ /**
1939
+ * User anonymization confirmation payload.
1940
+ */
1941
+ interface ForgetUserRequest {
1942
+ current_password?: string;
1943
+ mfa_code?: string;
1944
+ }
1777
1945
  /**
1778
1946
  * User anonymization response (GDPR Right to be Forgotten)
1779
1947
  */
@@ -1864,6 +2032,57 @@ interface UpdateRoleRequest {
1864
2032
  permissions?: string[];
1865
2033
  }
1866
2034
 
2035
+ /**
2036
+ * Upstream Provider (Enterprise SSO) types
2037
+ */
2038
+ type UpstreamProviderType = 'oidc' | 'oauth2' | 'saml';
2039
+ interface UpstreamProvider {
2040
+ id: string;
2041
+ org_id: string;
2042
+ connection_id: string;
2043
+ name: string;
2044
+ provider_type: UpstreamProviderType;
2045
+ enabled: boolean;
2046
+ client_id: string;
2047
+ issuer?: string;
2048
+ authorization_url?: string;
2049
+ token_url?: string;
2050
+ userinfo_url?: string;
2051
+ discovery_url?: string;
2052
+ scopes?: string;
2053
+ metadata?: any;
2054
+ created_at: string;
2055
+ updated_at: string;
2056
+ }
2057
+ interface CreateUpstreamProviderPayload {
2058
+ connection_id: string;
2059
+ name: string;
2060
+ provider_type: UpstreamProviderType;
2061
+ client_id: string;
2062
+ client_secret?: string;
2063
+ issuer?: string;
2064
+ authorization_url?: string;
2065
+ token_url?: string;
2066
+ userinfo_url?: string;
2067
+ discovery_url?: string;
2068
+ scopes?: string;
2069
+ metadata?: any;
2070
+ enabled?: boolean;
2071
+ }
2072
+ interface UpdateUpstreamProviderPayload {
2073
+ name?: string;
2074
+ enabled?: boolean;
2075
+ client_id?: string;
2076
+ client_secret?: string;
2077
+ issuer?: string;
2078
+ authorization_url?: string;
2079
+ token_url?: string;
2080
+ userinfo_url?: string;
2081
+ discovery_url?: string;
2082
+ scopes?: string;
2083
+ metadata?: any;
2084
+ }
2085
+
1867
2086
  interface SessionConfig {
1868
2087
  storageKeyPrefix?: string;
1869
2088
  autoRefresh?: boolean;
@@ -1992,7 +2211,7 @@ declare class HttpClient {
1992
2211
  /**
1993
2212
  * DELETE request
1994
2213
  */
1995
- delete<T = any>(path: string, config?: {
2214
+ delete<T = any>(path: string, data?: any, config?: {
1996
2215
  headers?: Record<string, string>;
1997
2216
  }): Promise<HttpResponse<T>>;
1998
2217
  }
@@ -2299,7 +2518,7 @@ declare class AuthModule {
2299
2518
  resendVerification(payload: ResendVerificationRequest): Promise<ResendVerificationResponse>;
2300
2519
  /**
2301
2520
  * Login with email and password.
2302
- * Automatically persists the session and configures the client.
2521
+ * Automatically persists the session once authentication is complete.
2303
2522
  *
2304
2523
  * @param payload Login credentials (email and password)
2305
2524
  * @returns Access token, refresh token, and expiration info
@@ -2310,7 +2529,7 @@ declare class AuthModule {
2310
2529
  * email: 'user@example.com',
2311
2530
  * password: 'SecurePassword123!'
2312
2531
  * });
2313
- * // Session is automatically saved - no need for manual token management
2532
+ * // Session is automatically saved unless MFA is required
2314
2533
  * ```
2315
2534
  */
2316
2535
  login(payload: LoginRequest): Promise<RefreshTokenResponse>;
@@ -2415,6 +2634,10 @@ declare class AuthModule {
2415
2634
  * ```
2416
2635
  */
2417
2636
  lookupEmail(email: string): Promise<LookupEmailResponse>;
2637
+ /**
2638
+ * Fetch public hosted-auth context for an organization/service login.
2639
+ */
2640
+ getContext(params?: AuthContextRequest): Promise<AuthContextResponse>;
2418
2641
  }
2419
2642
 
2420
2643
  /**
@@ -2462,6 +2685,18 @@ declare class IdentitiesModule {
2462
2685
  */
2463
2686
  unlink(provider: string): Promise<void>;
2464
2687
  }
2688
+ declare class LinkedAccountsModule {
2689
+ private http;
2690
+ constructor(http: HttpClient);
2691
+ list(): Promise<LinkedAccountsResponse>;
2692
+ startLink(provider: string): Promise<StartLinkResponse>;
2693
+ grant(accountId: string, payload: GrantLinkedAccountRequest): Promise<LinkedAccountGrant>;
2694
+ revokeGrant(accountId: string, serviceId: string): Promise<void>;
2695
+ unlink(accountId: string): Promise<void>;
2696
+ getProviderTokenRequest(state: string): Promise<ProviderTokenRequestDetails>;
2697
+ completeProviderTokenRequest(state: string, payload?: CompleteProviderTokenRequestPayload): Promise<CompleteProviderTokenRequestResponse>;
2698
+ startProviderTokenRequestLink(state: string): Promise<StartLinkResponse>;
2699
+ }
2465
2700
  /**
2466
2701
  * Multi-Factor Authentication (MFA) methods
2467
2702
  */
@@ -2634,6 +2869,7 @@ declare class DevicesModule {
2634
2869
  declare class UserModule {
2635
2870
  private http;
2636
2871
  readonly identities: IdentitiesModule;
2872
+ readonly linkedAccounts: LinkedAccountsModule;
2637
2873
  readonly mfa: MfaModule;
2638
2874
  readonly devices: DevicesModule;
2639
2875
  constructor(http: HttpClient);
@@ -2942,6 +3178,53 @@ declare class WebhooksModule {
2942
3178
  }>;
2943
3179
  }
2944
3180
 
3181
+ /**
3182
+ * Upstream Provider (Enterprise SSO) management methods
3183
+ */
3184
+ declare class UpstreamProvidersModule {
3185
+ private http;
3186
+ constructor(http: HttpClient);
3187
+ /**
3188
+ * List all upstream providers for an organization.
3189
+ *
3190
+ * @param orgSlug Organization slug
3191
+ * @returns Array of upstream providers
3192
+ */
3193
+ list(orgSlug: string): Promise<UpstreamProvider[]>;
3194
+ /**
3195
+ * Get a specific upstream provider.
3196
+ *
3197
+ * @param orgSlug Organization slug
3198
+ * @param providerId Provider ID or connection_id
3199
+ * @returns Upstream provider details
3200
+ */
3201
+ get(orgSlug: string, providerId: string): Promise<UpstreamProvider>;
3202
+ /**
3203
+ * Create a new upstream provider.
3204
+ *
3205
+ * @param orgSlug Organization slug
3206
+ * @param payload Provider configuration
3207
+ * @returns Created upstream provider
3208
+ */
3209
+ create(orgSlug: string, payload: CreateUpstreamProviderPayload): Promise<UpstreamProvider>;
3210
+ /**
3211
+ * Update an existing upstream provider.
3212
+ *
3213
+ * @param orgSlug Organization slug
3214
+ * @param providerId Provider ID or connection_id
3215
+ * @param payload Update payload
3216
+ * @returns Updated upstream provider
3217
+ */
3218
+ update(orgSlug: string, providerId: string, payload: UpdateUpstreamProviderPayload): Promise<UpstreamProvider>;
3219
+ /**
3220
+ * Delete an upstream provider.
3221
+ *
3222
+ * @param orgSlug Organization slug
3223
+ * @param providerId Provider ID or connection_id
3224
+ */
3225
+ delete(orgSlug: string, providerId: string): Promise<void>;
3226
+ }
3227
+
2945
3228
  /**
2946
3229
  * Organization management methods
2947
3230
  */
@@ -2956,6 +3239,10 @@ declare class OrganizationsModule {
2956
3239
  * Webhooks management
2957
3240
  */
2958
3241
  webhooks: WebhooksModule;
3242
+ /**
3243
+ * Upstream provider (Enterprise SSO) management
3244
+ */
3245
+ upstreamProviders: UpstreamProvidersModule;
2959
3246
  /**
2960
3247
  * Create a new organization (requires authentication).
2961
3248
  * The authenticated user becomes the organization owner.
@@ -3141,6 +3428,14 @@ declare class OrganizationsModule {
3141
3428
  * ```
3142
3429
  */
3143
3430
  remove: (orgSlug: string, userId: string) => Promise<void>;
3431
+ /**
3432
+ * List a member's direct per-service access grants.
3433
+ */
3434
+ listServiceAccess: (orgSlug: string, userId: string) => Promise<MemberServiceAccess[]>;
3435
+ /**
3436
+ * Replace a member's direct per-service access grants.
3437
+ */
3438
+ updateServiceAccess: (orgSlug: string, userId: string, payload: UpdateMemberServiceAccessPayload) => Promise<MemberServiceAccess[]>;
3144
3439
  /**
3145
3440
  * Transfer organization ownership to another member.
3146
3441
  * Requires 'owner' role.
@@ -3802,13 +4097,12 @@ declare class ServicesModule {
3802
4097
  *
3803
4098
  * @param orgSlug Organization slug
3804
4099
  * @param serviceSlug Service slug
3805
- * @returns Service with provider grants and plans
4100
+ * @returns Service details
3806
4101
  *
3807
4102
  * @example
3808
4103
  * ```typescript
3809
4104
  * const service = await sso.services.get('acme-corp', 'main-app');
3810
- * console.log(service.service.redirect_uris);
3811
- * console.log(service.plans);
4105
+ * console.log(service.name, service.client_id);
3812
4106
  * ```
3813
4107
  */
3814
4108
  get(orgSlug: string, serviceSlug: string): Promise<Service>;
@@ -3843,6 +4137,11 @@ declare class ServicesModule {
3843
4137
  * ```
3844
4138
  */
3845
4139
  delete(orgSlug: string, serviceSlug: string): Promise<void>;
4140
+ /**
4141
+ * Rotate a service client secret.
4142
+ * The new secret is returned once and cannot be retrieved later.
4143
+ */
4144
+ rotateSecret(orgSlug: string, serviceSlug: string): Promise<RotateServiceSecretResponse>;
3846
4145
  /**
3847
4146
  * Plan management methods
3848
4147
  */
@@ -4290,6 +4589,12 @@ declare class InvitationsModule {
4290
4589
  * ```
4291
4590
  */
4292
4591
  accept(token: string): Promise<void>;
4592
+ /**
4593
+ * Accept one of the current user's invitations by invitation ID.
4594
+ *
4595
+ * @param invitationId Invitation ID
4596
+ */
4597
+ acceptById(invitationId: string): Promise<void>;
4293
4598
  /**
4294
4599
  * Decline an invitation using its token.
4295
4600
  *
@@ -4301,6 +4606,12 @@ declare class InvitationsModule {
4301
4606
  * ```
4302
4607
  */
4303
4608
  decline(token: string): Promise<void>;
4609
+ /**
4610
+ * Decline one of the current user's invitations by invitation ID.
4611
+ *
4612
+ * @param invitationId Invitation ID
4613
+ */
4614
+ declineById(invitationId: string): Promise<void>;
4304
4615
  }
4305
4616
 
4306
4617
  /**
@@ -4433,12 +4744,17 @@ declare class PlatformModule {
4433
4744
  */
4434
4745
  updateFeatures: (orgId: string, payload: {
4435
4746
  allow_saml?: boolean;
4747
+ allow_saml_idp?: boolean;
4436
4748
  allow_scim?: boolean;
4437
4749
  allow_custom_domain?: boolean;
4438
4750
  allow_custom_branding?: boolean;
4751
+ allow_branding?: boolean;
4439
4752
  allow_advanced_risk_engine?: boolean;
4440
4753
  allow_siem_integration?: boolean;
4754
+ allow_siem?: boolean;
4441
4755
  allow_webhooks?: boolean;
4756
+ allow_passkeys?: boolean;
4757
+ allow_overage?: boolean;
4442
4758
  }) => Promise<Organization>;
4443
4759
  /**
4444
4760
  * Delete an organization and all its associated data.
@@ -4526,6 +4842,15 @@ declare class PlatformModule {
4526
4842
  limit?: number;
4527
4843
  offset?: number;
4528
4844
  }) => Promise<PlatformUserListResponse>;
4845
+ /**
4846
+ * Get a single platform user by ID.
4847
+ */
4848
+ get: (userId: string) => Promise<{
4849
+ id: string;
4850
+ email: string;
4851
+ is_platform_owner: boolean;
4852
+ created_at: string;
4853
+ }>;
4529
4854
  /**
4530
4855
  * Search users by email address or user ID.
4531
4856
  *
@@ -4703,6 +5028,17 @@ declare class PlatformModule {
4703
5028
  * ```
4704
5029
  */
4705
5030
  impersonateUser(payload: ImpersonateRequest): Promise<ImpersonateResponse>;
5031
+ /**
5032
+ * Get platform operational counters for jobs, webhooks, and SIEM delivery.
5033
+ */
5034
+ getOperationsStatus(): Promise<{
5035
+ jobs_pending: number;
5036
+ jobs_running: number;
5037
+ jobs_failed: number;
5038
+ webhook_deliveries_failed: number;
5039
+ siem_configs_enabled: number;
5040
+ siem_configs_with_failures: number;
5041
+ }>;
4706
5042
  }
4707
5043
 
4708
5044
  /**
@@ -4790,6 +5126,33 @@ interface ServiceAnalytics {
4790
5126
  active_subscriptions: number;
4791
5127
  [key: string]: any;
4792
5128
  }
5129
+ interface ProviderTokenRequest {
5130
+ user_id: string;
5131
+ provider: string;
5132
+ scopes?: string[];
5133
+ redirect_uri?: string;
5134
+ state?: string;
5135
+ }
5136
+ interface ProviderTokenAccount {
5137
+ id: string;
5138
+ provider_user_id: string;
5139
+ email?: string;
5140
+ display_name?: string;
5141
+ }
5142
+ type ProviderTokenResult = {
5143
+ status: 'ok';
5144
+ access_token: string;
5145
+ expires_at?: string;
5146
+ scopes: string[];
5147
+ provider: string;
5148
+ account: ProviderTokenAccount;
5149
+ } | {
5150
+ status: 'action_required';
5151
+ code: 'PROVIDER_LINK_REQUIRED' | 'PROVIDER_GRANT_REQUIRED' | 'PROVIDER_SCOPE_CONSENT_REQUIRED' | 'PROVIDER_REAUTH_REQUIRED' | string;
5152
+ reauth_url: string;
5153
+ missing_scopes: string[];
5154
+ provider: string;
5155
+ };
4793
5156
  /**
4794
5157
  * Service API module for API key-based service-to-service operations.
4795
5158
  * Provides operations for managing users, subscriptions, and service configuration.
@@ -4873,6 +5236,11 @@ declare class ServiceApiModule {
4873
5236
  * @returns Service information
4874
5237
  */
4875
5238
  getServiceInfo(): Promise<ServiceApiInfo>;
5239
+ /**
5240
+ * Request a backend-only third-party provider access token for an AuthOS user.
5241
+ * Requires `read:provider_tokens` or `read:provider_tokens:{provider}` on the API key.
5242
+ */
5243
+ requestProviderToken(request: ProviderTokenRequest): Promise<ProviderTokenResult>;
4876
5244
  /**
4877
5245
  * Create a new user
4878
5246
  * Requires 'write:users' permission on the API key
@@ -5229,6 +5597,18 @@ declare class PasskeysModule {
5229
5597
  * returns the options required to create credentials in the browser.
5230
5598
  */
5231
5599
  registerStart(displayName?: string): Promise<PasskeyRegisterStartResponse>;
5600
+ /**
5601
+ * List registered passkeys for the authenticated user.
5602
+ */
5603
+ list(): Promise<UserPasskey[]>;
5604
+ /**
5605
+ * Rename a passkey for the authenticated user.
5606
+ */
5607
+ updateName(passkeyId: string, name: string): Promise<UserPasskey>;
5608
+ /**
5609
+ * Delete a passkey for the authenticated user.
5610
+ */
5611
+ delete(passkeyId: string): Promise<PasskeyActionResponse>;
5232
5612
  /**
5233
5613
  * Finish the passkey registration ceremony.
5234
5614
  * Verifies the credential created by the browser.
@@ -5265,7 +5645,11 @@ declare class PasskeysModule {
5265
5645
  * Start the passkey authentication ceremony.
5266
5646
  * Returns the options required to get credentials from the browser.
5267
5647
  */
5268
- authenticateStart(email: string): Promise<PasskeyAuthStartResponse>;
5648
+ authenticateStart(email: string, context?: {
5649
+ org_slug?: string;
5650
+ service_slug?: string;
5651
+ redirect_uri?: string;
5652
+ }): Promise<PasskeyAuthStartResponse>;
5269
5653
  /**
5270
5654
  * Finish the passkey authentication ceremony.
5271
5655
  * Verifies the assertion returned by the browser.
@@ -5275,7 +5659,11 @@ declare class PasskeysModule {
5275
5659
  * Authenticate with a passkey and obtain a JWT token
5276
5660
  * ...
5277
5661
  */
5278
- login(email: string): Promise<PasskeyAuthFinishResponse>;
5662
+ login(email: string, context?: {
5663
+ org_slug?: string;
5664
+ service_slug?: string;
5665
+ redirect_uri?: string;
5666
+ }): Promise<PasskeyAuthFinishResponse>;
5279
5667
  /**
5280
5668
  * Convert Base64URL string to Uint8Array
5281
5669
  */
@@ -5293,7 +5681,12 @@ interface MagicLinkRequest {
5293
5681
  /** Email address to send the magic link to */
5294
5682
  email: string;
5295
5683
  /** Optional organization context */
5684
+ org_slug?: string;
5296
5685
  orgSlug?: string;
5686
+ /** Optional service context */
5687
+ service_slug?: string;
5688
+ /** Optional service callback URI */
5689
+ redirect_uri?: string;
5297
5690
  }
5298
5691
  /**
5299
5692
  * Magic link response
@@ -5385,7 +5778,7 @@ declare class PrivacyModule {
5385
5778
  * // "User data has been anonymized. PII has been removed while preserving audit logs."
5386
5779
  * ```
5387
5780
  */
5388
- forgetUser(userId: string): Promise<ForgetUserResponse>;
5781
+ forgetUser(userId: string, payload?: ForgetUserRequest): Promise<ForgetUserResponse>;
5389
5782
  }
5390
5783
 
5391
5784
  /**
@@ -5595,16 +5988,16 @@ declare enum AuthErrorCodes {
5595
5988
  ORG_REQUIRED = "ORG_REQUIRED",
5596
5989
  /** The provided credentials are invalid */
5597
5990
  INVALID_CREDENTIALS = "INVALID_CREDENTIALS",
5598
- /** The JWT token has expired */
5599
- TOKEN_EXPIRED = "TOKEN_EXPIRED",
5600
5991
  /** The refresh token is invalid or has been revoked */
5601
5992
  REFRESH_TOKEN_INVALID = "REFRESH_TOKEN_INVALID",
5993
+ /** The requested resource was not found */
5994
+ NOT_FOUND = "NOT_FOUND",
5602
5995
  /** The user is not authorized to perform this action */
5603
5996
  UNAUTHORIZED = "UNAUTHORIZED",
5604
5997
  /** The user does not have permission for this resource */
5605
5998
  FORBIDDEN = "FORBIDDEN",
5606
- /** The requested resource was not found */
5607
- NOT_FOUND = "NOT_FOUND",
5999
+ /** The JWT token has expired */
6000
+ TOKEN_EXPIRED = "TOKEN_EXPIRED",
5608
6001
  /** The request failed validation */
5609
6002
  VALIDATION_ERROR = "VALIDATION_ERROR",
5610
6003
  /** The email address is already registered */
@@ -5615,20 +6008,48 @@ declare enum AuthErrorCodes {
5615
6008
  ACCOUNT_SUSPENDED = "ACCOUNT_SUSPENDED",
5616
6009
  /** The organization has been suspended */
5617
6010
  ORG_SUSPENDED = "ORG_SUSPENDED",
6011
+ /** The request failed validation or is malformed */
6012
+ BAD_REQUEST = "BAD_REQUEST",
6013
+ /** A resource with this information already exists */
6014
+ DUPLICATE_CONSTRAINT = "DUPLICATE_CONSTRAINT",
6015
+ /** Organization is pending approval or suspended */
6016
+ ORGANIZATION_NOT_ACTIVE = "ORGANIZATION_NOT_ACTIVE",
6017
+ /** Service creation limit reached for organization tier */
6018
+ SERVICE_LIMIT_EXCEEDED = "SERVICE_LIMIT_EXCEEDED",
6019
+ /** Team member limit reached for organization tier */
6020
+ TEAM_LIMIT_EXCEEDED = "TEAM_LIMIT_EXCEEDED",
6021
+ /** Invitation link has expired */
6022
+ INVITATION_EXPIRED = "INVITATION_EXPIRED",
6023
+ /** The magic link or verification token has expired */
6024
+ LINK_EXPIRED = "LINK_EXPIRED",
6025
+ /** Device code for headless authentication has expired */
6026
+ DEVICE_CODE_EXPIRED = "DEVICE_CODE_EXPIRED",
6027
+ /** Authorization is still pending (device flow) */
6028
+ AUTHORIZATION_PENDING = "AUTHORIZATION_PENDING",
6029
+ DEVICE_CODE_PENDING = "DEVICE_CODE_PENDING",
6030
+ /** Feature not available in organization's current tier */
6031
+ FEATURE_NOT_AVAILABLE_IN_TIER = "FEATURE_NOT_AVAILABLE_IN_TIER",
5618
6032
  /** Rate limit exceeded */
5619
6033
  RATE_LIMITED = "RATE_LIMITED",
6034
+ TOO_MANY_REQUESTS = "TOO_MANY_REQUESTS",
5620
6035
  /** The password does not meet requirements */
5621
6036
  WEAK_PASSWORD = "WEAK_PASSWORD",
5622
6037
  /** The MFA code is invalid */
5623
6038
  INVALID_MFA_CODE = "INVALID_MFA_CODE",
5624
- /** The magic link or verification token has expired */
5625
- LINK_EXPIRED = "LINK_EXPIRED",
5626
- /** The device code has expired */
5627
- DEVICE_CODE_EXPIRED = "DEVICE_CODE_EXPIRED",
5628
- /** Authorization is still pending (device flow) */
5629
- AUTHORIZATION_PENDING = "AUTHORIZATION_PENDING",
6039
+ /** Malformed or invalid JWT token */
6040
+ JWT_ERROR = "JWT_ERROR",
6041
+ /** Unexpected server error */
6042
+ INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR",
6043
+ /** OAuth provider communication failed */
6044
+ OAUTH_ERROR = "OAUTH_ERROR",
5630
6045
  /** The passkey authentication failed */
5631
- PASSKEY_ERROR = "PASSKEY_ERROR"
6046
+ PASSKEY_ERROR = "PASSKEY_ERROR",
6047
+ /** Billing system error */
6048
+ STRIPE_ERROR = "STRIPE_ERROR",
6049
+ /** General database operation failed */
6050
+ DATABASE_ERROR = "DATABASE_ERROR",
6051
+ /** General system error */
6052
+ GENERIC_ERROR = "GENERIC_ERROR"
5632
6053
  }
5633
6054
  /**
5634
6055
  * Custom error class for SSO API errors.
@@ -5666,4 +6087,4 @@ declare class SsoApiError extends Error {
5666
6087
  isNotFound(): boolean;
5667
6088
  }
5668
6089
 
5669
- export { type AcceptInvitationPayload, type AdminLoginUrlParams, type AnalyticsQuery, type ApiKey, type ApiKeyCreateResponse, type ApproveOrganizationPayload, type AuditLog, type AuditLogEntry, type AuditLogQueryParams, type AuditLogResponse, AuthErrorCodes, AuthModule, type AuthSnapshot, type AuthenticationResponseJSON, type BackupCodesResponse, type BrandingConfiguration, BrowserStorage, type ChangePasswordRequest, type ChangePasswordResponse, type ConfigureSamlPayload, type ConfigureSamlResponse, CookieStorage, type CreateApiKeyPayload, type CreateCheckoutPayload, type CreateCheckoutResponse, type CreateInvitationPayload, type CreateOrganizationPayload, type CreateOrganizationResponse, type CreatePlanPayload, type CreateRoleRequest, type CreateScimTokenRequest, type CreateServicePayload, type CreateServiceResponse, type CreateSiemConfigRequest, type CreateWebhookRequest, type DeclineInvitationPayload, type DeviceCodeRequest, type DeviceCodeResponse, type DeviceVerifyResponse, type DomainConfiguration, type DomainVerificationMethod, type DomainVerificationResponse, type DomainVerificationResult, type EndUser, type EndUserDetailResponse, type EndUserIdentity, type EndUserListResponse, type EndUserSubscription, type EventTypeInfo, type ExportUserDataResponse, type ForgetUserResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GeoLocation, type GetAuditLogParams, type GetRiskSettingsResponse, type GrowthTrendPoint, type Identity, type ImpersonateRequest, type ImpersonateResponse, type ImpersonationUserInfo, type Invitation, type InvitationStatus, type InvitationWithOrg, InvitationsModule, type JwtClaims, type ListApiKeysResponse, type ListDevicesResponse, type ListEndUsersParams, type ListOrganizationsParams, type ListPlatformOrganizationsParams, type ListScimTokensResponse, type ListSiemConfigsResponse, type LoginActivityPoint, type LoginEventExport, type LoginRequest, type LoginTrendPoint, type LoginUrlParams, type LoginsByProvider, type LoginsByService, type LookupEmailRequest, type LookupEmailResponse, MagicLinks, type MemberListResponse, type MemberRole, type Membership, type MembershipExport, MemoryStorage, type MfaEventExport, type MfaSetupResponse, type MfaStatusResponse, type MfaVerificationRequest, type MfaVerificationResponse, type MfaVerifyRequest, type MfaVerifyResponse, type OAuthCredentials, type OAuthIdentityExport, type OAuthProvider, type Organization, type OrganizationMember, type OrganizationResponse, type OrganizationStatus, type OrganizationStatusBreakdown, type OrganizationTier, OrganizationsModule, type PaginatedResponse, type PaginationInfo, type PaginationParams, type Passkey, type PasskeyAuthFinishRequest, type PasskeyAuthFinishResponse, type PasskeyAuthStartRequest, type PasskeyAuthStartResponse, type PasskeyExport, type PasskeyRegisterFinishRequest, type PasskeyRegisterFinishResponse, type PasskeyRegisterStartRequest, type PasskeyRegisterStartResponse, PasskeysModule, PermissionsModule, type Plan, type PlanResponse, type PlatformAnalyticsDateRangeParams, PlatformModule, type PlatformOrganizationResponse, type PlatformOrganizationsListResponse, type PlatformOverviewMetrics, type PlatformUser, type PlatformUserListResponse, type PromotePlatformOwnerPayload, type ProviderToken, type ProviderTokenGrant, type RecentLogin, type RecentOrganization, type RefreshTokenRequest, type RefreshTokenResponse, type RegisterRequest, type RegisterResponse, type RegistrationResponseJSON, type RejectOrganizationPayload, type ResendVerificationRequest, type ResendVerificationResponse, type ResetPasswordRequest, type ResetPasswordResponse, type RevokeDeviceRequest, type RevokeDeviceResponse, type RevokeSessionsResponse, type RiskAction, type RiskAssessment, type RiskEventResponse, type RiskEventsQuery, type RoleResponse, type SamlCertificate, type SamlConfig, type ScimTokenResponse, type SelectOrganizationResponse, type Service, ServiceApiModule, type ServiceListResponse, type ServiceResponse, type ServiceType, type ServiceWithDetails, ServicesModule, type SetCustomDomainRequest, type SetOAuthCredentialsPayload, type SetPasswordRequest, type SetPasswordResponse, type SetSmtpRequest, type SiemConfigResponse, type SiemProviderType, type SmtpConfigResponse, SsoApiError, SsoClient, type SsoClientOptions, type StartLinkResponse, type Subscription, type TestConnectionResponse, type TokenRequest, type TokenResponse, type TokenStorage, type TopOrganization, type TransferOwnershipPayload, type UpdateBrandingRequest, type UpdateMemberRolePayload, type UpdateOrganizationPayload, type UpdateOrganizationTierPayload, type UpdatePlanPayload, type UpdateRiskSettingsRequest, type UpdateRiskSettingsResponse, type UpdateRoleRequest, type UpdateServicePayload, type UpdateSiemConfigRequest, type UpdateUserProfilePayload, type UpdateWebhookRequest, type User, type UserDevice, UserModule, type UserProfile, type Webhook, type WebhookDelivery, type WebhookDeliveryListResponse, type WebhookDeliveryQueryParams, type WebhookListResponse, type WebhookResponse };
6090
+ export { type AcceptInvitationPayload, type AdminLoginUrlParams, type AnalyticsQuery, type ApiKey, type ApiKeyCreateResponse, type ApproveOrganizationPayload, type AuditLog, type AuditLogEntry, type AuditLogQueryParams, type AuditLogResponse, type AuthContextRequest, type AuthContextResponse, AuthErrorCodes, AuthModule, type AuthOrganizationContext, type AuthServiceContext, type AuthSnapshot, type AuthenticationResponseJSON, type BackupCodesResponse, type BrandingConfiguration, BrowserStorage, type ChangePasswordRequest, type ChangePasswordResponse, type CompleteProviderTokenRequestPayload, type CompleteProviderTokenRequestResponse, type ConfigureSamlPayload, type ConfigureSamlResponse, CookieStorage, type CreateApiKeyPayload, type CreateCheckoutPayload, type CreateCheckoutResponse, type CreateInvitationPayload, type CreateOrganizationPayload, type CreateOrganizationResponse, type CreatePlanPayload, type CreateRoleRequest, type CreateScimTokenRequest, type CreateServicePayload, type CreateServiceResponse, type CreateSiemConfigRequest, type CreateUpstreamProviderPayload, type CreateWebhookRequest, type DeclineInvitationPayload, type DeviceCodeRequest, type DeviceCodeResponse, type DeviceVerifyResponse, type DomainConfiguration, type DomainVerificationMethod, type DomainVerificationResponse, type DomainVerificationResult, type EndUser, type EndUserDetailResponse, type EndUserIdentity, type EndUserListResponse, type EndUserLoginEvent, type EndUserSession, type EndUserSubscription, type EventTypeInfo, type ExportUserDataResponse, type ForgetUserRequest, type ForgetUserResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GeoLocation, type GetAuditLogParams, type GetRiskSettingsResponse, type GrantLinkedAccountRequest, type GrowthTrendPoint, type Identity, type ImpersonateRequest, type ImpersonateResponse, type ImpersonationUserInfo, type Invitation, type InvitationStatus, type InvitationWithOrg, InvitationsModule, type JwtClaims, type LinkedAccount, type LinkedAccountGrant, type LinkedAccountsResponse, type ListApiKeysResponse, type ListDevicesResponse, type ListEndUsersParams, type ListOrganizationsParams, type ListPlatformOrganizationsParams, type ListScimTokensResponse, type ListSiemConfigsResponse, type LoginActivityPoint, type LoginEventExport, type LoginRequest, type LoginTrendPoint, type LoginUrlParams, type LoginsByProvider, type LoginsByService, type LookupEmailRequest, type LookupEmailResponse, MagicLinks, type MemberListResponse, type MemberRole, type MemberServiceAccess, type Membership, type MembershipExport, MemoryStorage, type MfaEventExport, type MfaSetupResponse, type MfaStatusResponse, type MfaVerificationRequest, type MfaVerificationResponse, type MfaVerifyRequest, type MfaVerifyResponse, type OAuthCredentials, type OAuthIdentityExport, type OAuthProvider, type Organization, type OrganizationMember, type OrganizationResponse, type OrganizationStatus, type OrganizationStatusBreakdown, type OrganizationTier, OrganizationsModule, type PaginatedResponse, type PaginationInfo, type PaginationParams, type Passkey, type PasskeyActionResponse, type PasskeyAuthFinishRequest, type PasskeyAuthFinishResponse, type PasskeyAuthStartRequest, type PasskeyAuthStartResponse, type PasskeyExport, type PasskeyRegisterFinishRequest, type PasskeyRegisterFinishResponse, type PasskeyRegisterStartRequest, type PasskeyRegisterStartResponse, PasskeysModule, PermissionsModule, type Plan, type PlanResponse, type PlatformAnalyticsDateRangeParams, PlatformModule, type PlatformOrganizationResponse, type PlatformOrganizationsListResponse, type PlatformOverviewMetrics, type PlatformUser, type PlatformUserListResponse, type PromotePlatformOwnerPayload, type ProviderDefinition, type ProviderToken, type ProviderTokenRequestDetails, type RecentLogin, type RecentOrganization, type RefreshTokenRequest, type RefreshTokenResponse, type RegisterRequest, type RegisterResponse, type RegistrationResponseJSON, type RejectOrganizationPayload, type ResendVerificationRequest, type ResendVerificationResponse, type ResetPasswordRequest, type ResetPasswordResponse, type RevokeDeviceRequest, type RevokeDeviceResponse, type RevokeSessionsResponse, type RiskAction, type RiskAssessment, type RiskEventResponse, type RiskEventsQuery, type RoleResponse, type RotateServiceSecretResponse, type SamlCertificate, type SamlConfig, type ScimTokenResponse, type SelectOrganizationResponse, type Service, ServiceApiModule, type ServiceListResponse, type ServiceType, type ServiceWithDetails, ServicesModule, type SetCustomDomainRequest, type SetOAuthCredentialsPayload, type SetPasswordRequest, type SetPasswordResponse, type SetSmtpRequest, type SiemConfigResponse, type SiemProviderType, type SmtpConfigResponse, SsoApiError, SsoClient, type SsoClientOptions, type StartLinkResponse, type Subscription, type TestConnectionResponse, type TokenRequest, type TokenResponse, type TokenStorage, type TopOrganization, type TransferOwnershipPayload, type UpdateBrandingRequest, type UpdateMemberRolePayload, type UpdateMemberServiceAccessPayload, type UpdateOrganizationPayload, type UpdateOrganizationTierPayload, type UpdatePlanPayload, type UpdateRiskSettingsRequest, type UpdateRiskSettingsResponse, type UpdateRoleRequest, type UpdateServicePayload, type UpdateSiemConfigRequest, type UpdateUpstreamProviderPayload, type UpdateUserProfilePayload, type UpdateWebhookRequest, type UpstreamProvider, type UpstreamProviderType, type User, type UserDevice, UserModule, type UserPasskey, type UserProfile, type Webhook, type WebhookDelivery, type WebhookDeliveryListResponse, type WebhookDeliveryQueryParams, type WebhookListResponse, type WebhookResponse };