@drmhse/sso-sdk 0.3.13 → 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
  */
@@ -1060,10 +1125,12 @@ interface Plan {
1060
1125
  id: string;
1061
1126
  service_id: string;
1062
1127
  name: string;
1128
+ description?: string;
1063
1129
  price_cents: number;
1064
1130
  currency: string;
1065
1131
  features: string;
1066
1132
  stripe_price_id?: string;
1133
+ is_default?: boolean;
1067
1134
  created_at: string;
1068
1135
  }
1069
1136
  /**
@@ -1073,6 +1140,30 @@ interface PlanResponse {
1073
1140
  plan: Plan;
1074
1141
  subscription_count: number;
1075
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
+ }
1076
1167
  /**
1077
1168
  * Create service payload
1078
1169
  */
@@ -1091,7 +1182,6 @@ interface CreateServicePayload {
1091
1182
  */
1092
1183
  interface CreateServiceResponse {
1093
1184
  service: Service;
1094
- provider_grants: ProviderTokenGrant[];
1095
1185
  default_plan: Plan;
1096
1186
  usage: {
1097
1187
  current_services: number;
@@ -1099,6 +1189,10 @@ interface CreateServiceResponse {
1099
1189
  tier: string;
1100
1190
  };
1101
1191
  }
1192
+ interface RotateServiceSecretResponse {
1193
+ service: Service;
1194
+ client_secret: string;
1195
+ }
1102
1196
  /**
1103
1197
  * Update service payload
1104
1198
  */
@@ -1112,37 +1206,10 @@ interface UpdateServicePayload {
1112
1206
  device_activation_uri?: string;
1113
1207
  }
1114
1208
  /**
1115
- * Service response with details
1209
+ * Service with aggregated details (for listing)
1116
1210
  */
1117
- interface ServiceResponse {
1211
+ interface ServiceWithDetails {
1118
1212
  service: Service;
1119
- provider_grants: ProviderTokenGrant[];
1120
- plans: Plan[];
1121
- }
1122
- /**
1123
- * Create plan payload
1124
- */
1125
- interface CreatePlanPayload {
1126
- name: string;
1127
- price_cents: number;
1128
- currency: string;
1129
- features?: string[];
1130
- stripe_price_id?: string;
1131
- }
1132
- /**
1133
- * Update plan payload
1134
- */
1135
- interface UpdatePlanPayload {
1136
- name?: string;
1137
- price_cents?: number;
1138
- currency?: string;
1139
- features?: string[];
1140
- stripe_price_id?: string | null;
1141
- }
1142
- /**
1143
- * Service with aggregated details
1144
- */
1145
- interface ServiceWithDetails extends Service {
1146
1213
  plan_count: number;
1147
1214
  subscription_count: number;
1148
1215
  }
@@ -1516,6 +1583,30 @@ interface EndUserIdentity {
1516
1583
  provider_user_id: string;
1517
1584
  created_at: string;
1518
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
+ }
1519
1610
  /**
1520
1611
  * End-user with subscriptions and identities
1521
1612
  */
@@ -1551,6 +1642,8 @@ interface EndUserDetailResponse {
1551
1642
  subscriptions: EndUserSubscription[];
1552
1643
  identities: EndUserIdentity[];
1553
1644
  session_count: number;
1645
+ sessions: EndUserSession[];
1646
+ recent_logins: EndUserLoginEvent[];
1554
1647
  }
1555
1648
  /**
1556
1649
  * List end-users query params
@@ -1630,6 +1723,9 @@ interface PasskeyRegisterFinishResponse {
1630
1723
  */
1631
1724
  interface PasskeyAuthStartRequest {
1632
1725
  email: string;
1726
+ org_slug?: string;
1727
+ service_slug?: string;
1728
+ redirect_uri?: string;
1633
1729
  }
1634
1730
  /**
1635
1731
  * Response from starting passkey authentication
@@ -1649,6 +1745,10 @@ interface PasskeyAuthFinishRequest {
1649
1745
  * Response from finishing passkey authentication
1650
1746
  */
1651
1747
  interface PasskeyAuthFinishResponse {
1748
+ access_token: string;
1749
+ refresh_token: string;
1750
+ expires_in: number;
1751
+ /** Backward compatible alias for access_token. */
1652
1752
  token: string;
1653
1753
  user_id: string;
1654
1754
  device_trust_token?: string;
@@ -1699,6 +1799,25 @@ interface Passkey {
1699
1799
  last_used_at?: string;
1700
1800
  created_at: string;
1701
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
+ }
1702
1821
 
1703
1822
  /**
1704
1823
  * Privacy and GDPR compliance types
@@ -1768,6 +1887,13 @@ interface ExportUserDataResponse {
1768
1887
  mfa_events: MfaEventExport[];
1769
1888
  passkeys: PasskeyExport[];
1770
1889
  }
1890
+ /**
1891
+ * User anonymization confirmation payload.
1892
+ */
1893
+ interface ForgetUserRequest {
1894
+ current_password?: string;
1895
+ mfa_code?: string;
1896
+ }
1771
1897
  /**
1772
1898
  * User anonymization response (GDPR Right to be Forgotten)
1773
1899
  */
@@ -1858,6 +1984,57 @@ interface UpdateRoleRequest {
1858
1984
  permissions?: string[];
1859
1985
  }
1860
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
+
1861
2038
  interface SessionConfig {
1862
2039
  storageKeyPrefix?: string;
1863
2040
  autoRefresh?: boolean;
@@ -1986,7 +2163,7 @@ declare class HttpClient {
1986
2163
  /**
1987
2164
  * DELETE request
1988
2165
  */
1989
- delete<T = any>(path: string, config?: {
2166
+ delete<T = any>(path: string, data?: any, config?: {
1990
2167
  headers?: Record<string, string>;
1991
2168
  }): Promise<HttpResponse<T>>;
1992
2169
  }
@@ -2293,7 +2470,7 @@ declare class AuthModule {
2293
2470
  resendVerification(payload: ResendVerificationRequest): Promise<ResendVerificationResponse>;
2294
2471
  /**
2295
2472
  * Login with email and password.
2296
- * Automatically persists the session and configures the client.
2473
+ * Automatically persists the session once authentication is complete.
2297
2474
  *
2298
2475
  * @param payload Login credentials (email and password)
2299
2476
  * @returns Access token, refresh token, and expiration info
@@ -2304,7 +2481,7 @@ declare class AuthModule {
2304
2481
  * email: 'user@example.com',
2305
2482
  * password: 'SecurePassword123!'
2306
2483
  * });
2307
- * // Session is automatically saved - no need for manual token management
2484
+ * // Session is automatically saved unless MFA is required
2308
2485
  * ```
2309
2486
  */
2310
2487
  login(payload: LoginRequest): Promise<RefreshTokenResponse>;
@@ -2409,6 +2586,10 @@ declare class AuthModule {
2409
2586
  * ```
2410
2587
  */
2411
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>;
2412
2593
  }
2413
2594
 
2414
2595
  /**
@@ -2936,6 +3117,53 @@ declare class WebhooksModule {
2936
3117
  }>;
2937
3118
  }
2938
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
+
2939
3167
  /**
2940
3168
  * Organization management methods
2941
3169
  */
@@ -2950,6 +3178,10 @@ declare class OrganizationsModule {
2950
3178
  * Webhooks management
2951
3179
  */
2952
3180
  webhooks: WebhooksModule;
3181
+ /**
3182
+ * Upstream provider (Enterprise SSO) management
3183
+ */
3184
+ upstreamProviders: UpstreamProvidersModule;
2953
3185
  /**
2954
3186
  * Create a new organization (requires authentication).
2955
3187
  * The authenticated user becomes the organization owner.
@@ -3135,6 +3367,14 @@ declare class OrganizationsModule {
3135
3367
  * ```
3136
3368
  */
3137
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[]>;
3138
3378
  /**
3139
3379
  * Transfer organization ownership to another member.
3140
3380
  * Requires 'owner' role.
@@ -3796,13 +4036,12 @@ declare class ServicesModule {
3796
4036
  *
3797
4037
  * @param orgSlug Organization slug
3798
4038
  * @param serviceSlug Service slug
3799
- * @returns Service with provider grants and plans
4039
+ * @returns Service details
3800
4040
  *
3801
4041
  * @example
3802
4042
  * ```typescript
3803
4043
  * const service = await sso.services.get('acme-corp', 'main-app');
3804
- * console.log(service.service.redirect_uris);
3805
- * console.log(service.plans);
4044
+ * console.log(service.name, service.client_id);
3806
4045
  * ```
3807
4046
  */
3808
4047
  get(orgSlug: string, serviceSlug: string): Promise<Service>;
@@ -3837,6 +4076,11 @@ declare class ServicesModule {
3837
4076
  * ```
3838
4077
  */
3839
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>;
3840
4084
  /**
3841
4085
  * Plan management methods
3842
4086
  */
@@ -4284,6 +4528,12 @@ declare class InvitationsModule {
4284
4528
  * ```
4285
4529
  */
4286
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>;
4287
4537
  /**
4288
4538
  * Decline an invitation using its token.
4289
4539
  *
@@ -4295,6 +4545,12 @@ declare class InvitationsModule {
4295
4545
  * ```
4296
4546
  */
4297
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>;
4298
4554
  }
4299
4555
 
4300
4556
  /**
@@ -4427,12 +4683,17 @@ declare class PlatformModule {
4427
4683
  */
4428
4684
  updateFeatures: (orgId: string, payload: {
4429
4685
  allow_saml?: boolean;
4686
+ allow_saml_idp?: boolean;
4430
4687
  allow_scim?: boolean;
4431
4688
  allow_custom_domain?: boolean;
4432
4689
  allow_custom_branding?: boolean;
4690
+ allow_branding?: boolean;
4433
4691
  allow_advanced_risk_engine?: boolean;
4434
4692
  allow_siem_integration?: boolean;
4693
+ allow_siem?: boolean;
4435
4694
  allow_webhooks?: boolean;
4695
+ allow_passkeys?: boolean;
4696
+ allow_overage?: boolean;
4436
4697
  }) => Promise<Organization>;
4437
4698
  /**
4438
4699
  * Delete an organization and all its associated data.
@@ -4520,6 +4781,15 @@ declare class PlatformModule {
4520
4781
  limit?: number;
4521
4782
  offset?: number;
4522
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
+ }>;
4523
4793
  /**
4524
4794
  * Search users by email address or user ID.
4525
4795
  *
@@ -4697,6 +4967,17 @@ declare class PlatformModule {
4697
4967
  * ```
4698
4968
  */
4699
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
+ }>;
4700
4981
  }
4701
4982
 
4702
4983
  /**
@@ -5223,6 +5504,18 @@ declare class PasskeysModule {
5223
5504
  * returns the options required to create credentials in the browser.
5224
5505
  */
5225
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>;
5226
5519
  /**
5227
5520
  * Finish the passkey registration ceremony.
5228
5521
  * Verifies the credential created by the browser.
@@ -5259,7 +5552,11 @@ declare class PasskeysModule {
5259
5552
  * Start the passkey authentication ceremony.
5260
5553
  * Returns the options required to get credentials from the browser.
5261
5554
  */
5262
- 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>;
5263
5560
  /**
5264
5561
  * Finish the passkey authentication ceremony.
5265
5562
  * Verifies the assertion returned by the browser.
@@ -5269,7 +5566,11 @@ declare class PasskeysModule {
5269
5566
  * Authenticate with a passkey and obtain a JWT token
5270
5567
  * ...
5271
5568
  */
5272
- 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>;
5273
5574
  /**
5274
5575
  * Convert Base64URL string to Uint8Array
5275
5576
  */
@@ -5287,7 +5588,12 @@ interface MagicLinkRequest {
5287
5588
  /** Email address to send the magic link to */
5288
5589
  email: string;
5289
5590
  /** Optional organization context */
5591
+ org_slug?: string;
5290
5592
  orgSlug?: string;
5593
+ /** Optional service context */
5594
+ service_slug?: string;
5595
+ /** Optional service callback URI */
5596
+ redirect_uri?: string;
5291
5597
  }
5292
5598
  /**
5293
5599
  * Magic link response
@@ -5379,7 +5685,7 @@ declare class PrivacyModule {
5379
5685
  * // "User data has been anonymized. PII has been removed while preserving audit logs."
5380
5686
  * ```
5381
5687
  */
5382
- forgetUser(userId: string): Promise<ForgetUserResponse>;
5688
+ forgetUser(userId: string, payload?: ForgetUserRequest): Promise<ForgetUserResponse>;
5383
5689
  }
5384
5690
 
5385
5691
  /**
@@ -5589,16 +5895,16 @@ declare enum AuthErrorCodes {
5589
5895
  ORG_REQUIRED = "ORG_REQUIRED",
5590
5896
  /** The provided credentials are invalid */
5591
5897
  INVALID_CREDENTIALS = "INVALID_CREDENTIALS",
5592
- /** The JWT token has expired */
5593
- TOKEN_EXPIRED = "TOKEN_EXPIRED",
5594
5898
  /** The refresh token is invalid or has been revoked */
5595
5899
  REFRESH_TOKEN_INVALID = "REFRESH_TOKEN_INVALID",
5900
+ /** The requested resource was not found */
5901
+ NOT_FOUND = "NOT_FOUND",
5596
5902
  /** The user is not authorized to perform this action */
5597
5903
  UNAUTHORIZED = "UNAUTHORIZED",
5598
5904
  /** The user does not have permission for this resource */
5599
5905
  FORBIDDEN = "FORBIDDEN",
5600
- /** The requested resource was not found */
5601
- NOT_FOUND = "NOT_FOUND",
5906
+ /** The JWT token has expired */
5907
+ TOKEN_EXPIRED = "TOKEN_EXPIRED",
5602
5908
  /** The request failed validation */
5603
5909
  VALIDATION_ERROR = "VALIDATION_ERROR",
5604
5910
  /** The email address is already registered */
@@ -5609,20 +5915,48 @@ declare enum AuthErrorCodes {
5609
5915
  ACCOUNT_SUSPENDED = "ACCOUNT_SUSPENDED",
5610
5916
  /** The organization has been suspended */
5611
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",
5612
5939
  /** Rate limit exceeded */
5613
5940
  RATE_LIMITED = "RATE_LIMITED",
5941
+ TOO_MANY_REQUESTS = "TOO_MANY_REQUESTS",
5614
5942
  /** The password does not meet requirements */
5615
5943
  WEAK_PASSWORD = "WEAK_PASSWORD",
5616
5944
  /** The MFA code is invalid */
5617
5945
  INVALID_MFA_CODE = "INVALID_MFA_CODE",
5618
- /** The magic link or verification token has expired */
5619
- LINK_EXPIRED = "LINK_EXPIRED",
5620
- /** The device code has expired */
5621
- DEVICE_CODE_EXPIRED = "DEVICE_CODE_EXPIRED",
5622
- /** Authorization is still pending (device flow) */
5623
- 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",
5624
5952
  /** The passkey authentication failed */
5625
- 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"
5626
5960
  }
5627
5961
  /**
5628
5962
  * Custom error class for SSO API errors.
@@ -5660,4 +5994,4 @@ declare class SsoApiError extends Error {
5660
5994
  isNotFound(): boolean;
5661
5995
  }
5662
5996
 
5663
- 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 };