@drmhse/sso-sdk 0.3.14 → 0.4.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.mts 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
@@ -589,6 +644,12 @@ interface Organization {
589
644
  rejected_by?: string | null;
590
645
  rejected_at?: string | null;
591
646
  rejection_reason?: string | null;
647
+ custom_domain?: string | null;
648
+ domain_verified?: boolean;
649
+ domain_verification_token?: string | null;
650
+ brand_logo_url?: string | null;
651
+ brand_primary_color?: string | null;
652
+ feature_overrides?: string | Record<string, unknown> | null;
592
653
  created_at: string;
593
654
  updated_at: string;
594
655
  }
@@ -634,6 +695,18 @@ interface OrganizationMember {
634
695
  role: MemberRole;
635
696
  joined_at: string;
636
697
  }
698
+ interface MemberServiceAccess {
699
+ service_id: string;
700
+ service_slug: string;
701
+ service_name: string;
702
+ access: 'viewer' | 'manager' | null;
703
+ }
704
+ interface UpdateMemberServiceAccessPayload {
705
+ grants: Array<{
706
+ service_slug: string;
707
+ access: 'viewer' | 'manager' | null;
708
+ }>;
709
+ }
637
710
  /**
638
711
  * Create organization payload (authenticated endpoint)
639
712
  */
@@ -842,6 +915,7 @@ interface WebhookResponse {
842
915
  url: string;
843
916
  events: string[];
844
917
  is_active: boolean;
918
+ secret?: string;
845
919
  created_at: string;
846
920
  updated_at: string;
847
921
  }
@@ -1028,6 +1102,7 @@ interface Service {
1028
1102
  name: string;
1029
1103
  service_type: ServiceType;
1030
1104
  client_id: string;
1105
+ client_secret?: string | null;
1031
1106
  github_scopes: string[];
1032
1107
  microsoft_scopes: string[];
1033
1108
  google_scopes: string[];
@@ -1043,16 +1118,6 @@ interface Service {
1043
1118
  saml_sign_response: boolean;
1044
1119
  created_at: string;
1045
1120
  }
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
1121
  /**
1057
1122
  * Subscription plan
1058
1123
  */
@@ -1075,6 +1140,30 @@ interface PlanResponse {
1075
1140
  plan: Plan;
1076
1141
  subscription_count: number;
1077
1142
  }
1143
+ /**
1144
+ * Create plan payload
1145
+ */
1146
+ interface CreatePlanPayload {
1147
+ name: string;
1148
+ description?: string;
1149
+ price_cents: number;
1150
+ currency: string;
1151
+ features?: string[];
1152
+ stripe_price_id?: string;
1153
+ is_default?: boolean;
1154
+ }
1155
+ /**
1156
+ * Update plan payload
1157
+ */
1158
+ interface UpdatePlanPayload {
1159
+ name?: string;
1160
+ description?: string;
1161
+ price_cents?: number;
1162
+ currency?: string;
1163
+ features?: string[];
1164
+ stripe_price_id?: string | null;
1165
+ is_default?: boolean;
1166
+ }
1078
1167
  /**
1079
1168
  * Create service payload
1080
1169
  */
@@ -1093,7 +1182,6 @@ interface CreateServicePayload {
1093
1182
  */
1094
1183
  interface CreateServiceResponse {
1095
1184
  service: Service;
1096
- provider_grants: ProviderTokenGrant[];
1097
1185
  default_plan: Plan;
1098
1186
  usage: {
1099
1187
  current_services: number;
@@ -1101,6 +1189,10 @@ interface CreateServiceResponse {
1101
1189
  tier: string;
1102
1190
  };
1103
1191
  }
1192
+ interface RotateServiceSecretResponse {
1193
+ service: Service;
1194
+ client_secret: string;
1195
+ }
1104
1196
  /**
1105
1197
  * Update service payload
1106
1198
  */
@@ -1114,41 +1206,10 @@ interface UpdateServicePayload {
1114
1206
  device_activation_uri?: string;
1115
1207
  }
1116
1208
  /**
1117
- * Service response with details
1209
+ * Service with aggregated details (for listing)
1118
1210
  */
1119
- interface ServiceResponse {
1211
+ interface ServiceWithDetails {
1120
1212
  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
1213
  plan_count: number;
1153
1214
  subscription_count: number;
1154
1215
  }
@@ -1522,6 +1583,30 @@ interface EndUserIdentity {
1522
1583
  provider_user_id: string;
1523
1584
  created_at: string;
1524
1585
  }
1586
+ interface EndUserSession {
1587
+ id: string;
1588
+ service_id?: string | null;
1589
+ service_name?: string | null;
1590
+ org_slug?: string | null;
1591
+ ip_address?: string | null;
1592
+ user_agent?: string | null;
1593
+ expires_at: string;
1594
+ refresh_token_expires_at?: string | null;
1595
+ created_at: string;
1596
+ }
1597
+ interface EndUserLoginEvent {
1598
+ id: string;
1599
+ service_id?: string | null;
1600
+ service_name?: string | null;
1601
+ provider: string;
1602
+ ip_address?: string | null;
1603
+ user_agent?: string | null;
1604
+ risk_score?: number | null;
1605
+ risk_factors: string[];
1606
+ geo_country?: string | null;
1607
+ geo_city?: string | null;
1608
+ created_at: string;
1609
+ }
1525
1610
  /**
1526
1611
  * End-user with subscriptions and identities
1527
1612
  */
@@ -1557,6 +1642,8 @@ interface EndUserDetailResponse {
1557
1642
  subscriptions: EndUserSubscription[];
1558
1643
  identities: EndUserIdentity[];
1559
1644
  session_count: number;
1645
+ sessions: EndUserSession[];
1646
+ recent_logins: EndUserLoginEvent[];
1560
1647
  }
1561
1648
  /**
1562
1649
  * List end-users query params
@@ -1636,6 +1723,9 @@ interface PasskeyRegisterFinishResponse {
1636
1723
  */
1637
1724
  interface PasskeyAuthStartRequest {
1638
1725
  email: string;
1726
+ org_slug?: string;
1727
+ service_slug?: string;
1728
+ redirect_uri?: string;
1639
1729
  }
1640
1730
  /**
1641
1731
  * Response from starting passkey authentication
@@ -1655,6 +1745,10 @@ interface PasskeyAuthFinishRequest {
1655
1745
  * Response from finishing passkey authentication
1656
1746
  */
1657
1747
  interface PasskeyAuthFinishResponse {
1748
+ access_token: string;
1749
+ refresh_token: string;
1750
+ expires_in: number;
1751
+ /** Backward compatible alias for access_token. */
1658
1752
  token: string;
1659
1753
  user_id: string;
1660
1754
  device_trust_token?: string;
@@ -1705,6 +1799,25 @@ interface Passkey {
1705
1799
  last_used_at?: string;
1706
1800
  created_at: string;
1707
1801
  }
1802
+ /**
1803
+ * Passkey shown in authenticated self-service settings.
1804
+ */
1805
+ interface UserPasskey {
1806
+ id: string;
1807
+ name: string;
1808
+ backup_eligible: boolean;
1809
+ backup_state: boolean;
1810
+ transports?: string | null;
1811
+ last_used_at?: string | null;
1812
+ created_at: string;
1813
+ }
1814
+ /**
1815
+ * Generic passkey action response.
1816
+ */
1817
+ interface PasskeyActionResponse {
1818
+ success: boolean;
1819
+ message: string;
1820
+ }
1708
1821
 
1709
1822
  /**
1710
1823
  * Privacy and GDPR compliance types
@@ -1774,6 +1887,13 @@ interface ExportUserDataResponse {
1774
1887
  mfa_events: MfaEventExport[];
1775
1888
  passkeys: PasskeyExport[];
1776
1889
  }
1890
+ /**
1891
+ * User anonymization confirmation payload.
1892
+ */
1893
+ interface ForgetUserRequest {
1894
+ current_password?: string;
1895
+ mfa_code?: string;
1896
+ }
1777
1897
  /**
1778
1898
  * User anonymization response (GDPR Right to be Forgotten)
1779
1899
  */
@@ -1864,6 +1984,57 @@ interface UpdateRoleRequest {
1864
1984
  permissions?: string[];
1865
1985
  }
1866
1986
 
1987
+ /**
1988
+ * Upstream Provider (Enterprise SSO) types
1989
+ */
1990
+ type UpstreamProviderType = 'oidc' | 'saml';
1991
+ interface UpstreamProvider {
1992
+ id: string;
1993
+ org_id: string;
1994
+ connection_id: string;
1995
+ name: string;
1996
+ provider_type: UpstreamProviderType;
1997
+ enabled: boolean;
1998
+ client_id: string;
1999
+ issuer?: string;
2000
+ authorization_url?: string;
2001
+ token_url?: string;
2002
+ userinfo_url?: string;
2003
+ discovery_url?: string;
2004
+ scopes?: string;
2005
+ metadata?: any;
2006
+ created_at: string;
2007
+ updated_at: string;
2008
+ }
2009
+ interface CreateUpstreamProviderPayload {
2010
+ connection_id: string;
2011
+ name: string;
2012
+ provider_type: UpstreamProviderType;
2013
+ client_id: string;
2014
+ client_secret?: string;
2015
+ issuer?: string;
2016
+ authorization_url?: string;
2017
+ token_url?: string;
2018
+ userinfo_url?: string;
2019
+ discovery_url?: string;
2020
+ scopes?: string;
2021
+ metadata?: any;
2022
+ enabled?: boolean;
2023
+ }
2024
+ interface UpdateUpstreamProviderPayload {
2025
+ name?: string;
2026
+ enabled?: boolean;
2027
+ client_id?: string;
2028
+ client_secret?: string;
2029
+ issuer?: string;
2030
+ authorization_url?: string;
2031
+ token_url?: string;
2032
+ userinfo_url?: string;
2033
+ discovery_url?: string;
2034
+ scopes?: string;
2035
+ metadata?: any;
2036
+ }
2037
+
1867
2038
  interface SessionConfig {
1868
2039
  storageKeyPrefix?: string;
1869
2040
  autoRefresh?: boolean;
@@ -1992,7 +2163,7 @@ declare class HttpClient {
1992
2163
  /**
1993
2164
  * DELETE request
1994
2165
  */
1995
- delete<T = any>(path: string, config?: {
2166
+ delete<T = any>(path: string, data?: any, config?: {
1996
2167
  headers?: Record<string, string>;
1997
2168
  }): Promise<HttpResponse<T>>;
1998
2169
  }
@@ -2299,7 +2470,7 @@ declare class AuthModule {
2299
2470
  resendVerification(payload: ResendVerificationRequest): Promise<ResendVerificationResponse>;
2300
2471
  /**
2301
2472
  * Login with email and password.
2302
- * Automatically persists the session and configures the client.
2473
+ * Automatically persists the session once authentication is complete.
2303
2474
  *
2304
2475
  * @param payload Login credentials (email and password)
2305
2476
  * @returns Access token, refresh token, and expiration info
@@ -2310,7 +2481,7 @@ declare class AuthModule {
2310
2481
  * email: 'user@example.com',
2311
2482
  * password: 'SecurePassword123!'
2312
2483
  * });
2313
- * // Session is automatically saved - no need for manual token management
2484
+ * // Session is automatically saved unless MFA is required
2314
2485
  * ```
2315
2486
  */
2316
2487
  login(payload: LoginRequest): Promise<RefreshTokenResponse>;
@@ -2415,6 +2586,10 @@ declare class AuthModule {
2415
2586
  * ```
2416
2587
  */
2417
2588
  lookupEmail(email: string): Promise<LookupEmailResponse>;
2589
+ /**
2590
+ * Fetch public hosted-auth context for an organization/service login.
2591
+ */
2592
+ getContext(params?: AuthContextRequest): Promise<AuthContextResponse>;
2418
2593
  }
2419
2594
 
2420
2595
  /**
@@ -2942,6 +3117,53 @@ declare class WebhooksModule {
2942
3117
  }>;
2943
3118
  }
2944
3119
 
3120
+ /**
3121
+ * Upstream Provider (Enterprise SSO) management methods
3122
+ */
3123
+ declare class UpstreamProvidersModule {
3124
+ private http;
3125
+ constructor(http: HttpClient);
3126
+ /**
3127
+ * List all upstream providers for an organization.
3128
+ *
3129
+ * @param orgSlug Organization slug
3130
+ * @returns Array of upstream providers
3131
+ */
3132
+ list(orgSlug: string): Promise<UpstreamProvider[]>;
3133
+ /**
3134
+ * Get a specific upstream provider.
3135
+ *
3136
+ * @param orgSlug Organization slug
3137
+ * @param providerId Provider ID or connection_id
3138
+ * @returns Upstream provider details
3139
+ */
3140
+ get(orgSlug: string, providerId: string): Promise<UpstreamProvider>;
3141
+ /**
3142
+ * Create a new upstream provider.
3143
+ *
3144
+ * @param orgSlug Organization slug
3145
+ * @param payload Provider configuration
3146
+ * @returns Created upstream provider
3147
+ */
3148
+ create(orgSlug: string, payload: CreateUpstreamProviderPayload): Promise<UpstreamProvider>;
3149
+ /**
3150
+ * Update an existing upstream provider.
3151
+ *
3152
+ * @param orgSlug Organization slug
3153
+ * @param providerId Provider ID or connection_id
3154
+ * @param payload Update payload
3155
+ * @returns Updated upstream provider
3156
+ */
3157
+ update(orgSlug: string, providerId: string, payload: UpdateUpstreamProviderPayload): Promise<UpstreamProvider>;
3158
+ /**
3159
+ * Delete an upstream provider.
3160
+ *
3161
+ * @param orgSlug Organization slug
3162
+ * @param providerId Provider ID or connection_id
3163
+ */
3164
+ delete(orgSlug: string, providerId: string): Promise<void>;
3165
+ }
3166
+
2945
3167
  /**
2946
3168
  * Organization management methods
2947
3169
  */
@@ -2956,6 +3178,10 @@ declare class OrganizationsModule {
2956
3178
  * Webhooks management
2957
3179
  */
2958
3180
  webhooks: WebhooksModule;
3181
+ /**
3182
+ * Upstream provider (Enterprise SSO) management
3183
+ */
3184
+ upstreamProviders: UpstreamProvidersModule;
2959
3185
  /**
2960
3186
  * Create a new organization (requires authentication).
2961
3187
  * The authenticated user becomes the organization owner.
@@ -3141,6 +3367,14 @@ declare class OrganizationsModule {
3141
3367
  * ```
3142
3368
  */
3143
3369
  remove: (orgSlug: string, userId: string) => Promise<void>;
3370
+ /**
3371
+ * List a member's direct per-service access grants.
3372
+ */
3373
+ listServiceAccess: (orgSlug: string, userId: string) => Promise<MemberServiceAccess[]>;
3374
+ /**
3375
+ * Replace a member's direct per-service access grants.
3376
+ */
3377
+ updateServiceAccess: (orgSlug: string, userId: string, payload: UpdateMemberServiceAccessPayload) => Promise<MemberServiceAccess[]>;
3144
3378
  /**
3145
3379
  * Transfer organization ownership to another member.
3146
3380
  * Requires 'owner' role.
@@ -3802,13 +4036,12 @@ declare class ServicesModule {
3802
4036
  *
3803
4037
  * @param orgSlug Organization slug
3804
4038
  * @param serviceSlug Service slug
3805
- * @returns Service with provider grants and plans
4039
+ * @returns Service details
3806
4040
  *
3807
4041
  * @example
3808
4042
  * ```typescript
3809
4043
  * const service = await sso.services.get('acme-corp', 'main-app');
3810
- * console.log(service.service.redirect_uris);
3811
- * console.log(service.plans);
4044
+ * console.log(service.name, service.client_id);
3812
4045
  * ```
3813
4046
  */
3814
4047
  get(orgSlug: string, serviceSlug: string): Promise<Service>;
@@ -3843,6 +4076,11 @@ declare class ServicesModule {
3843
4076
  * ```
3844
4077
  */
3845
4078
  delete(orgSlug: string, serviceSlug: string): Promise<void>;
4079
+ /**
4080
+ * Rotate a service client secret.
4081
+ * The new secret is returned once and cannot be retrieved later.
4082
+ */
4083
+ rotateSecret(orgSlug: string, serviceSlug: string): Promise<RotateServiceSecretResponse>;
3846
4084
  /**
3847
4085
  * Plan management methods
3848
4086
  */
@@ -4290,6 +4528,12 @@ declare class InvitationsModule {
4290
4528
  * ```
4291
4529
  */
4292
4530
  accept(token: string): Promise<void>;
4531
+ /**
4532
+ * Accept one of the current user's invitations by invitation ID.
4533
+ *
4534
+ * @param invitationId Invitation ID
4535
+ */
4536
+ acceptById(invitationId: string): Promise<void>;
4293
4537
  /**
4294
4538
  * Decline an invitation using its token.
4295
4539
  *
@@ -4301,6 +4545,12 @@ declare class InvitationsModule {
4301
4545
  * ```
4302
4546
  */
4303
4547
  decline(token: string): Promise<void>;
4548
+ /**
4549
+ * Decline one of the current user's invitations by invitation ID.
4550
+ *
4551
+ * @param invitationId Invitation ID
4552
+ */
4553
+ declineById(invitationId: string): Promise<void>;
4304
4554
  }
4305
4555
 
4306
4556
  /**
@@ -4433,12 +4683,17 @@ declare class PlatformModule {
4433
4683
  */
4434
4684
  updateFeatures: (orgId: string, payload: {
4435
4685
  allow_saml?: boolean;
4686
+ allow_saml_idp?: boolean;
4436
4687
  allow_scim?: boolean;
4437
4688
  allow_custom_domain?: boolean;
4438
4689
  allow_custom_branding?: boolean;
4690
+ allow_branding?: boolean;
4439
4691
  allow_advanced_risk_engine?: boolean;
4440
4692
  allow_siem_integration?: boolean;
4693
+ allow_siem?: boolean;
4441
4694
  allow_webhooks?: boolean;
4695
+ allow_passkeys?: boolean;
4696
+ allow_overage?: boolean;
4442
4697
  }) => Promise<Organization>;
4443
4698
  /**
4444
4699
  * Delete an organization and all its associated data.
@@ -4526,6 +4781,15 @@ declare class PlatformModule {
4526
4781
  limit?: number;
4527
4782
  offset?: number;
4528
4783
  }) => Promise<PlatformUserListResponse>;
4784
+ /**
4785
+ * Get a single platform user by ID.
4786
+ */
4787
+ get: (userId: string) => Promise<{
4788
+ id: string;
4789
+ email: string;
4790
+ is_platform_owner: boolean;
4791
+ created_at: string;
4792
+ }>;
4529
4793
  /**
4530
4794
  * Search users by email address or user ID.
4531
4795
  *
@@ -4703,6 +4967,17 @@ declare class PlatformModule {
4703
4967
  * ```
4704
4968
  */
4705
4969
  impersonateUser(payload: ImpersonateRequest): Promise<ImpersonateResponse>;
4970
+ /**
4971
+ * Get platform operational counters for jobs, webhooks, and SIEM delivery.
4972
+ */
4973
+ getOperationsStatus(): Promise<{
4974
+ jobs_pending: number;
4975
+ jobs_running: number;
4976
+ jobs_failed: number;
4977
+ webhook_deliveries_failed: number;
4978
+ siem_configs_enabled: number;
4979
+ siem_configs_with_failures: number;
4980
+ }>;
4706
4981
  }
4707
4982
 
4708
4983
  /**
@@ -5229,6 +5504,18 @@ declare class PasskeysModule {
5229
5504
  * returns the options required to create credentials in the browser.
5230
5505
  */
5231
5506
  registerStart(displayName?: string): Promise<PasskeyRegisterStartResponse>;
5507
+ /**
5508
+ * List registered passkeys for the authenticated user.
5509
+ */
5510
+ list(): Promise<UserPasskey[]>;
5511
+ /**
5512
+ * Rename a passkey for the authenticated user.
5513
+ */
5514
+ updateName(passkeyId: string, name: string): Promise<UserPasskey>;
5515
+ /**
5516
+ * Delete a passkey for the authenticated user.
5517
+ */
5518
+ delete(passkeyId: string): Promise<PasskeyActionResponse>;
5232
5519
  /**
5233
5520
  * Finish the passkey registration ceremony.
5234
5521
  * Verifies the credential created by the browser.
@@ -5265,7 +5552,11 @@ declare class PasskeysModule {
5265
5552
  * Start the passkey authentication ceremony.
5266
5553
  * Returns the options required to get credentials from the browser.
5267
5554
  */
5268
- authenticateStart(email: string): Promise<PasskeyAuthStartResponse>;
5555
+ authenticateStart(email: string, context?: {
5556
+ org_slug?: string;
5557
+ service_slug?: string;
5558
+ redirect_uri?: string;
5559
+ }): Promise<PasskeyAuthStartResponse>;
5269
5560
  /**
5270
5561
  * Finish the passkey authentication ceremony.
5271
5562
  * Verifies the assertion returned by the browser.
@@ -5275,7 +5566,11 @@ declare class PasskeysModule {
5275
5566
  * Authenticate with a passkey and obtain a JWT token
5276
5567
  * ...
5277
5568
  */
5278
- login(email: string): Promise<PasskeyAuthFinishResponse>;
5569
+ login(email: string, context?: {
5570
+ org_slug?: string;
5571
+ service_slug?: string;
5572
+ redirect_uri?: string;
5573
+ }): Promise<PasskeyAuthFinishResponse>;
5279
5574
  /**
5280
5575
  * Convert Base64URL string to Uint8Array
5281
5576
  */
@@ -5293,7 +5588,12 @@ interface MagicLinkRequest {
5293
5588
  /** Email address to send the magic link to */
5294
5589
  email: string;
5295
5590
  /** Optional organization context */
5591
+ org_slug?: string;
5296
5592
  orgSlug?: string;
5593
+ /** Optional service context */
5594
+ service_slug?: string;
5595
+ /** Optional service callback URI */
5596
+ redirect_uri?: string;
5297
5597
  }
5298
5598
  /**
5299
5599
  * Magic link response
@@ -5385,7 +5685,7 @@ declare class PrivacyModule {
5385
5685
  * // "User data has been anonymized. PII has been removed while preserving audit logs."
5386
5686
  * ```
5387
5687
  */
5388
- forgetUser(userId: string): Promise<ForgetUserResponse>;
5688
+ forgetUser(userId: string, payload?: ForgetUserRequest): Promise<ForgetUserResponse>;
5389
5689
  }
5390
5690
 
5391
5691
  /**
@@ -5595,16 +5895,16 @@ declare enum AuthErrorCodes {
5595
5895
  ORG_REQUIRED = "ORG_REQUIRED",
5596
5896
  /** The provided credentials are invalid */
5597
5897
  INVALID_CREDENTIALS = "INVALID_CREDENTIALS",
5598
- /** The JWT token has expired */
5599
- TOKEN_EXPIRED = "TOKEN_EXPIRED",
5600
5898
  /** The refresh token is invalid or has been revoked */
5601
5899
  REFRESH_TOKEN_INVALID = "REFRESH_TOKEN_INVALID",
5900
+ /** The requested resource was not found */
5901
+ NOT_FOUND = "NOT_FOUND",
5602
5902
  /** The user is not authorized to perform this action */
5603
5903
  UNAUTHORIZED = "UNAUTHORIZED",
5604
5904
  /** The user does not have permission for this resource */
5605
5905
  FORBIDDEN = "FORBIDDEN",
5606
- /** The requested resource was not found */
5607
- NOT_FOUND = "NOT_FOUND",
5906
+ /** The JWT token has expired */
5907
+ TOKEN_EXPIRED = "TOKEN_EXPIRED",
5608
5908
  /** The request failed validation */
5609
5909
  VALIDATION_ERROR = "VALIDATION_ERROR",
5610
5910
  /** The email address is already registered */
@@ -5615,20 +5915,48 @@ declare enum AuthErrorCodes {
5615
5915
  ACCOUNT_SUSPENDED = "ACCOUNT_SUSPENDED",
5616
5916
  /** The organization has been suspended */
5617
5917
  ORG_SUSPENDED = "ORG_SUSPENDED",
5918
+ /** The request failed validation or is malformed */
5919
+ BAD_REQUEST = "BAD_REQUEST",
5920
+ /** A resource with this information already exists */
5921
+ DUPLICATE_CONSTRAINT = "DUPLICATE_CONSTRAINT",
5922
+ /** Organization is pending approval or suspended */
5923
+ ORGANIZATION_NOT_ACTIVE = "ORGANIZATION_NOT_ACTIVE",
5924
+ /** Service creation limit reached for organization tier */
5925
+ SERVICE_LIMIT_EXCEEDED = "SERVICE_LIMIT_EXCEEDED",
5926
+ /** Team member limit reached for organization tier */
5927
+ TEAM_LIMIT_EXCEEDED = "TEAM_LIMIT_EXCEEDED",
5928
+ /** Invitation link has expired */
5929
+ INVITATION_EXPIRED = "INVITATION_EXPIRED",
5930
+ /** The magic link or verification token has expired */
5931
+ LINK_EXPIRED = "LINK_EXPIRED",
5932
+ /** Device code for headless authentication has expired */
5933
+ DEVICE_CODE_EXPIRED = "DEVICE_CODE_EXPIRED",
5934
+ /** Authorization is still pending (device flow) */
5935
+ AUTHORIZATION_PENDING = "AUTHORIZATION_PENDING",
5936
+ DEVICE_CODE_PENDING = "DEVICE_CODE_PENDING",
5937
+ /** Feature not available in organization's current tier */
5938
+ FEATURE_NOT_AVAILABLE_IN_TIER = "FEATURE_NOT_AVAILABLE_IN_TIER",
5618
5939
  /** Rate limit exceeded */
5619
5940
  RATE_LIMITED = "RATE_LIMITED",
5941
+ TOO_MANY_REQUESTS = "TOO_MANY_REQUESTS",
5620
5942
  /** The password does not meet requirements */
5621
5943
  WEAK_PASSWORD = "WEAK_PASSWORD",
5622
5944
  /** The MFA code is invalid */
5623
5945
  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",
5946
+ /** Malformed or invalid JWT token */
5947
+ JWT_ERROR = "JWT_ERROR",
5948
+ /** Unexpected server error */
5949
+ INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR",
5950
+ /** OAuth provider communication failed */
5951
+ OAUTH_ERROR = "OAUTH_ERROR",
5630
5952
  /** The passkey authentication failed */
5631
- PASSKEY_ERROR = "PASSKEY_ERROR"
5953
+ PASSKEY_ERROR = "PASSKEY_ERROR",
5954
+ /** Billing system error */
5955
+ STRIPE_ERROR = "STRIPE_ERROR",
5956
+ /** General database operation failed */
5957
+ DATABASE_ERROR = "DATABASE_ERROR",
5958
+ /** General system error */
5959
+ GENERIC_ERROR = "GENERIC_ERROR"
5632
5960
  }
5633
5961
  /**
5634
5962
  * Custom error class for SSO API errors.
@@ -5666,4 +5994,4 @@ declare class SsoApiError extends Error {
5666
5994
  isNotFound(): boolean;
5667
5995
  }
5668
5996
 
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 };
5997
+ 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 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 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 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 ProviderToken, 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 };