@authsome/ui-core 0.1.9 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,825 +1,1294 @@
1
- import { A as AuthErrorType, a as AuthError, V as ValidationError, C as CookieData, b as AuthContext, c as AuthProvider, S as SignInRequest, d as SignUpRequest, U as UpdateUserRequest, P as PasswordChangeRequest, e as PasswordResetRequest, f as PasswordResetConfirmRequest, O as OAuthSignInRequest, g as OAuthCallbackRequest, h as OAuthProvider, M as MagicLinkRequest, i as MagicLinkVerifyRequest, j as PhoneAuthRequest, k as PhoneVerifyRequest, T as TwoFactorSetupRequest, l as TwoFactorSetupResponse, m as TwoFactorVerifyRequest, n as TwoFactorMethod, o as PasskeyRegisterRequest, p as PasskeyCredential, q as PasskeyAuthRequest, r as Organization, s as OrganizationMembership, t as User, u as Session } from './provider-DWklI8Wr.js';
2
- export { Q as AuthResponse, v as AuthState, a3 as Device, F as DeviceAuthorizeRequest, B as DeviceCodeVerifyRequest, E as DeviceCodeVerifyResponse, D as DeviceFlowInitiateRequest, z as DeviceFlowInitiateResponse, G as DeviceTokenPollRequest, I as DeviceTokenPollResponse, H as DeviceTokenPollStatus, $ as EnrollMFAFactorRequest, L as FieldDefinition, K as FieldType, J as FieldValidation, a5 as ListSessionsOptions, a6 as ListSessionsResponse, a1 as MFAChallengeRequest, a2 as MFAChallengeResponse, _ as MFAFactor, x as OAuthConfig, R as ProviderConfig, W as RequestContext, Z as ResendVerificationRequest, X as SendVerificationEmailRequest, w as SessionData, a4 as SessionInfo, N as SignupFieldsResponse, y as TwoFactorConfig, Y as VerifyEmailRequest, a0 as VerifyMFAFactorRequest } from './provider-DWklI8Wr.js';
3
- import { Storage, Observable, Unsubscribe } from './types/index.js';
4
- export { Listener, LocalStorageAdapter, MemoryStorageAdapter, SessionStorageAdapter } from './types/index.js';
5
- export { BaseAuthProvider } from './adapters/index.js';
1
+ interface ACSRequest {
2
+ Provider: string;
3
+ RelayState: string;
4
+ SAMLResponse: string;
5
+ }
6
+ interface AdminDeleteUserRequest {
7
+ UserID: string;
8
+ }
9
+ interface AdminImpersonateRequest {
10
+ UserID: string;
11
+ }
12
+ interface AdminStatsResponse {
13
+ total_organizations: number;
14
+ total_users: number;
15
+ }
16
+ interface AdminStopImpersonationRequest {
17
+ }
18
+ interface AdminUnbanUserRequest {
19
+ UserID: string;
20
+ }
21
+ interface AdminUserListResponse {
22
+ next_cursor?: string;
23
+ total: number;
24
+ users: User[];
25
+ }
26
+ interface AuthResponse {
27
+ expires_at: string;
28
+ refresh_token: string;
29
+ session_token: string;
30
+ user: User;
31
+ }
32
+ interface CallbackRequest {
33
+ Provider: string;
34
+ code: string;
35
+ error?: string;
36
+ state: string;
37
+ }
38
+ interface CallbackResponse {
39
+ expires_at: string;
40
+ is_new_user: boolean;
41
+ provider: string;
42
+ refresh_token: string;
43
+ session_token: string;
44
+ user: User;
45
+ }
46
+ interface ChallengeRequest {
47
+ code: string;
48
+ }
49
+ interface ChallengeResponse {
50
+ challenge_passed: boolean;
51
+ method: string;
52
+ }
53
+ interface CreateKeyRequest {
54
+ app_id: string;
55
+ name: string;
56
+ scopes?: string[];
57
+ user_id: string;
58
+ }
59
+ interface CreateKeyResponse {
60
+ created_at: string;
61
+ expires_at?: string;
62
+ id: string;
63
+ key: string;
64
+ key_prefix: string;
65
+ name: string;
66
+ scopes?: string[];
67
+ }
68
+ interface CredentialInfo {
69
+ created_at: string;
70
+ display_name: string;
71
+ id: string;
72
+ transport: string[];
73
+ }
74
+ interface DeleteAccountRequest {
75
+ }
76
+ interface DeleteDeviceRequest {
77
+ DeviceID: string;
78
+ }
79
+ interface DeleteOrgRequest {
80
+ OrgID: string;
81
+ }
82
+ interface DeleteRequest {
83
+ CredentialID: string;
84
+ }
85
+ interface DeleteResponse {
86
+ status: string;
87
+ }
88
+ interface DeleteRoleRequest {
89
+ RoleID: string;
90
+ }
91
+ interface DeleteTeamRequest {
92
+ OrgID: string;
93
+ TeamID: string;
94
+ }
95
+ interface DeleteWebhookRequest {
96
+ WebhookID: string;
97
+ }
98
+ interface Device {
99
+ app_id: ID;
100
+ browser?: string;
101
+ created_at: string;
102
+ fingerprint?: string;
103
+ id: ID;
104
+ ip_address?: string;
105
+ last_seen_at: string;
106
+ name?: string;
107
+ os?: string;
108
+ trusted: boolean;
109
+ type?: string;
110
+ updated_at: string;
111
+ user_id: ID;
112
+ }
113
+ interface DeviceListResponse {
114
+ devices: Device[];
115
+ }
116
+ interface DisableRequest {
117
+ }
118
+ interface DisableResponse {
119
+ status: string;
120
+ }
121
+ interface EnrollRequest {
122
+ method?: string;
123
+ phone?: string;
124
+ }
125
+ interface EnrollResponse {
126
+ id: string;
127
+ method: string;
128
+ otpauth_url: string;
129
+ secret: string;
130
+ }
131
+ interface ForgotPasswordResponse {
132
+ status: string;
133
+ }
134
+ interface HealthResponse {
135
+ error?: string;
136
+ status: string;
137
+ }
138
+ interface ID {
139
+ }
140
+ interface Invitation {
141
+ created_at: string;
142
+ email: string;
143
+ expires_at: string;
144
+ id: ID;
145
+ inviter_id: ID;
146
+ org_id: ID;
147
+ role: string;
148
+ status: string;
149
+ }
150
+ interface InvitationListResponse {
151
+ invitations: Invitation[];
152
+ }
153
+ interface KeyListItem {
154
+ created_at: string;
155
+ expires_at?: string;
156
+ id: string;
157
+ key_prefix: string;
158
+ last_used_at?: string;
159
+ name: string;
160
+ revoked: boolean;
161
+ scopes?: string[];
162
+ }
163
+ interface ListKeysResponse {
164
+ keys: KeyListItem[];
165
+ total: number;
166
+ }
167
+ interface ListResponse$1 {
168
+ credentials: CredentialInfo[];
169
+ }
170
+ interface LoginBeginRequest {
171
+ email?: string;
172
+ }
173
+ interface LoginBeginResponse {
174
+ options: Record<string, unknown>;
175
+ }
176
+ interface LoginFinishRequest {
177
+ }
178
+ interface LoginFinishResponse {
179
+ status: string;
180
+ user_id: string;
181
+ }
182
+ interface LoginRequest {
183
+ Provider: string;
184
+ }
185
+ interface LoginResponse {
186
+ login_url: string;
187
+ state: string;
188
+ }
189
+ interface Member {
190
+ created_at: string;
191
+ id: ID;
192
+ org_id: ID;
193
+ role: string;
194
+ updated_at: string;
195
+ user_id: ID;
196
+ }
197
+ interface MemberListResponse {
198
+ members: Member[];
199
+ }
200
+ interface OrgListResponse {
201
+ organizations: Organization[];
202
+ }
203
+ interface Organization {
204
+ app_id: ID;
205
+ created_at: string;
206
+ created_by: ID;
207
+ id: ID;
208
+ logo?: string;
209
+ metadata?: Record<string, unknown>;
210
+ name: string;
211
+ slug: string;
212
+ updated_at: string;
213
+ }
214
+ interface Permission {
215
+ action: string;
216
+ id: string;
217
+ resource: string;
218
+ role_id: string;
219
+ }
220
+ interface PermissionListResponse {
221
+ permissions: Permission[];
222
+ }
223
+ interface RecoveryRegenerateRequest {
224
+ }
225
+ interface RecoveryRegenerateResponse {
226
+ codes: string[];
227
+ }
228
+ interface RecoveryVerifyRequest {
229
+ code: string;
230
+ }
231
+ interface RecoveryVerifyResponse {
232
+ challenge_passed: boolean;
233
+ codes_remaining: number;
234
+ }
235
+ interface RegisterBeginRequest {
236
+ display_name?: string;
237
+ }
238
+ interface RegisterBeginResponse {
239
+ options: Record<string, unknown>;
240
+ }
241
+ interface RegisterFinishRequest {
242
+ }
243
+ interface RegisterFinishResponse {
244
+ display_name: string;
245
+ id: string;
246
+ status: string;
247
+ }
248
+ interface RemoveMemberRequest {
249
+ MemberID: string;
250
+ OrgID: string;
251
+ }
252
+ interface RemovePermissionRequest {
253
+ PermissionID: string;
254
+ RoleID: string;
255
+ }
256
+ interface RevokeKeyRequest {
257
+ KeyID: string;
258
+ }
259
+ interface RevokeSessionRequest {
260
+ SessionID: string;
261
+ }
262
+ interface Role {
263
+ app_id: string;
264
+ created_at: string;
265
+ description?: string;
266
+ id: string;
267
+ name: string;
268
+ parent_id?: string;
269
+ slug: string;
270
+ updated_at: string;
271
+ }
272
+ interface RoleListResponse {
273
+ roles: Role[];
274
+ }
275
+ interface SMSSendRequest {
276
+ phone?: string;
277
+ }
278
+ interface SMSSendResponse {
279
+ expires_in_seconds: number;
280
+ phone_masked: string;
281
+ sent: boolean;
282
+ }
283
+ interface SMSVerifyRequest {
284
+ code: string;
285
+ }
286
+ interface SMSVerifyResponse {
287
+ method: string;
288
+ verified: boolean;
289
+ }
290
+ interface SendRequest {
291
+ app_id?: string;
292
+ email: string;
293
+ }
294
+ interface SendResponse {
295
+ status: string;
296
+ }
297
+ interface SessionListResponse {
298
+ sessions: Record<string, unknown>[];
299
+ }
300
+ interface SignOutRequest {
301
+ }
302
+ interface SlugAvailableResponse {
303
+ available: boolean;
304
+ }
305
+ interface StartRequest {
306
+ Provider: string;
307
+ }
308
+ interface StartResponse {
309
+ auth_url: string;
310
+ }
311
+ interface StatusResponse {
312
+ status: string;
313
+ }
314
+ interface Team {
315
+ created_at: string;
316
+ id: ID;
317
+ name: string;
318
+ org_id: ID;
319
+ slug: string;
320
+ updated_at: string;
321
+ }
322
+ interface TeamListResponse {
323
+ teams: Team[];
324
+ }
325
+ interface TokenResponse {
326
+ expires_at: string;
327
+ refresh_token: string;
328
+ session_token: string;
329
+ }
330
+ interface TrustDeviceRequest {
331
+ DeviceID: string;
332
+ }
333
+ interface User {
334
+ app_id: ID;
335
+ ban_expires?: string;
336
+ ban_reason?: string;
337
+ banned: boolean;
338
+ created_at: string;
339
+ deleted_at?: string;
340
+ display_username?: string;
341
+ email: string;
342
+ email_verified: boolean;
343
+ id: ID;
344
+ image?: string;
345
+ metadata?: Record<string, unknown>;
346
+ name: string;
347
+ phone?: string;
348
+ phone_verified: boolean;
349
+ updated_at: string;
350
+ username?: string;
351
+ }
352
+ interface UserRoleListResponse {
353
+ roles: Role[];
354
+ }
355
+ interface VerifyMFARequest {
356
+ code: string;
357
+ }
358
+ interface VerifyMFAResponse {
359
+ method: string;
360
+ recovery_codes?: string[];
361
+ verified: boolean;
362
+ }
363
+ interface VerifyRequest {
364
+ app_id?: string;
365
+ token: string;
366
+ }
367
+ interface VerifyResponse {
368
+ expires_at: string;
369
+ refresh_token: string;
370
+ session_token: string;
371
+ user: User;
372
+ }
373
+ interface Webhook {
374
+ active: boolean;
375
+ app_id: ID;
376
+ created_at: string;
377
+ events: string[];
378
+ id: ID;
379
+ updated_at: string;
380
+ url: string;
381
+ }
382
+ interface WebhookListResponse {
383
+ webhooks: Webhook[];
384
+ }
385
+ type AdminBanUserRequest = {
386
+ expires_at?: string;
387
+ reason?: string;
388
+ };
389
+ type ChangePasswordRequest = {
390
+ current_password: string;
391
+ new_password: string;
392
+ };
393
+ type ForgotPasswordRequest = {
394
+ app_id?: string;
395
+ email: string;
396
+ };
397
+ type CreateAPIKeyRequest = CreateKeyRequest;
398
+ type RevokeAPIKeyRequest = RevokeKeyRequest;
399
+ type SendMagicLinkRequest = SendRequest;
400
+ type VerifyMagicLinkRequest = VerifyRequest;
401
+ type UpdateMeRequest = {
402
+ image?: string;
403
+ name?: string;
404
+ username?: string;
405
+ };
406
+ type DeleteMeRequest = DeleteAccountRequest;
407
+ type ChallengeMFARequest = ChallengeRequest;
408
+ type EnrollMFARequest = EnrollRequest;
409
+ type DisableMFARequest = DisableRequest;
410
+ type RegenerateMFARecoveryCodesRequest = RecoveryRegenerateRequest;
411
+ type VerifyRecoveryCodeRequest = RecoveryVerifyRequest;
412
+ type SendSMSCodeRequest = SMSSendRequest;
413
+ type VerifySMSCodeRequest = SMSVerifyRequest;
414
+ type CreateOrganizationRequest = {
415
+ app_id?: string;
416
+ logo?: string;
417
+ name: string;
418
+ slug: string;
419
+ };
420
+ type AcceptInvitationRequest = {
421
+ token: string;
422
+ };
423
+ type DeclineInvitationRequest = {
424
+ token: string;
425
+ };
426
+ type UpdateOrganizationRequest = {
427
+ logo?: string;
428
+ name?: string;
429
+ };
430
+ type DeleteOrganizationRequest = DeleteOrgRequest;
431
+ type CreateInvitationRequest = {
432
+ email: string;
433
+ role?: string;
434
+ };
435
+ type AddMemberRequest = {
436
+ role?: string;
437
+ user_id: string;
438
+ };
439
+ type UpdateMemberRequest = {
440
+ role: string;
441
+ };
442
+ type CreateTeamRequest = {
443
+ name: string;
444
+ slug: string;
445
+ };
446
+ type UpdateTeamRequest = {
447
+ name?: string;
448
+ slug?: string;
449
+ };
450
+ type PasskeyLoginBeginRequest = LoginBeginRequest;
451
+ type PasskeyLoginFinishRequest = LoginFinishRequest;
452
+ type PasskeyRegisterBeginRequest = RegisterBeginRequest;
453
+ type PasskeyRegisterFinishRequest = RegisterFinishRequest;
454
+ type DeletePasskeyRequest = DeleteRequest;
455
+ type RefreshRequest = {
456
+ refresh_token: string;
457
+ };
458
+ type ResetPasswordRequest = {
459
+ new_password: string;
460
+ token: string;
461
+ };
462
+ type CreateRoleRequest = {
463
+ app_id?: string;
464
+ description?: string;
465
+ name: string;
466
+ parent_id?: string;
467
+ slug: string;
468
+ };
469
+ type UpdateRoleRequest = {
470
+ description?: string;
471
+ name?: string;
472
+ parent_id?: string;
473
+ };
474
+ type AssignRoleRequest = {
475
+ org_id?: string;
476
+ user_id: string;
477
+ };
478
+ type AddPermissionRequest = {
479
+ action: string;
480
+ resource: string;
481
+ };
482
+ type UnassignRoleRequest = {
483
+ user_id: string;
484
+ };
485
+ type SignInRequest = {
486
+ app_id?: string;
487
+ email?: string;
488
+ password: string;
489
+ username?: string;
490
+ };
491
+ type SignUpRequest = {
492
+ app_id?: string;
493
+ email: string;
494
+ name?: string;
495
+ password: string;
496
+ username?: string;
497
+ };
498
+ type StartOAuthRequest = StartRequest;
499
+ type SsoACSRequest = ACSRequest;
500
+ type SsoCallbackRequest = CallbackRequest;
501
+ type StartSSOLoginRequest = LoginRequest;
502
+ type VerifyEmailRequest = {
503
+ token: string;
504
+ };
505
+ type CreateWebhookRequest = {
506
+ app_id?: string;
507
+ events: string[];
508
+ url: string;
509
+ };
510
+ type UpdateWebhookRequest = {
511
+ active?: boolean;
512
+ events?: string[];
513
+ url?: string;
514
+ };
6
515
 
7
- /**
8
- * Error handling utilities
9
- */
516
+ /** Core type definitions for AuthSome UI Kit. */
10
517
 
518
+ interface Session {
519
+ session_token: string;
520
+ refresh_token: string;
521
+ expires_at: string;
522
+ }
523
+ /** API error response. */
524
+ interface APIError {
525
+ error: string;
526
+ code?: number;
527
+ }
528
+ /** Authentication state. */
529
+ type AuthState = {
530
+ status: "idle";
531
+ } | {
532
+ status: "loading";
533
+ } | {
534
+ status: "authenticated";
535
+ user: User;
536
+ session: Session;
537
+ } | {
538
+ status: "unauthenticated";
539
+ } | {
540
+ status: "mfa_required";
541
+ session: Session;
542
+ } | {
543
+ status: "error";
544
+ error: string;
545
+ };
546
+ /** Configuration for the AuthSome client. */
547
+ interface AuthConfig {
548
+ /** Base URL of the AuthSome API (e.g., "https://api.example.com"). */
549
+ baseURL: string;
550
+ /** Publishable key for auto-discovering enabled auth methods. */
551
+ publishableKey?: string;
552
+ /** Pre-fetched client config (useful for SSR). */
553
+ initialClientConfig?: ClientConfig;
554
+ /** Custom fetch implementation (defaults to global fetch). */
555
+ fetch?: typeof fetch;
556
+ /** Storage implementation for persisting tokens (defaults to localStorage). */
557
+ storage?: TokenStorage;
558
+ /** Callback invoked when the auth state changes. */
559
+ onStateChange?: (state: AuthState) => void;
560
+ /** Callback invoked on authentication error. */
561
+ onError?: (error: APIError) => void;
562
+ }
563
+ /** Social provider info from the backend. */
564
+ interface SocialProviderConfig {
565
+ id: string;
566
+ name: string;
567
+ }
568
+ /** SSO connection info from the backend. */
569
+ interface SSOConnectionConfig {
570
+ id: string;
571
+ name: string;
572
+ }
11
573
  /**
12
- * Create an auth error
574
+ * Client configuration returned by the backend.
13
575
  *
14
- * @deprecated Use `new AuthError()` directly instead
15
- */
16
- declare function createAuthError(type: AuthErrorType, message: string, details?: Record<string, unknown>, code?: string | number): AuthError;
17
- /**
18
- * Check if an error is an auth error
19
- */
20
- declare function isAuthError(error: unknown): error is AuthError;
21
- /**
22
- * Convert unknown error to auth error
23
- */
24
- declare function toAuthError(error: unknown): AuthError;
25
- /**
26
- * Check if error is a network error
576
+ * Describes which auth methods are enabled so SDK components
577
+ * can auto-configure their UI without manual props.
27
578
  */
28
- declare function isNetworkError(error: unknown): boolean;
29
- /**
30
- * Check if error indicates authentication is required
31
- */
32
- declare function isUnauthenticatedError(error: unknown): boolean;
33
- /**
34
- * Check if error requires MFA
35
- */
36
- declare function isMFARequiredError(error: unknown): boolean;
37
-
38
- /**
39
- * Internationalization (i18n) types and interfaces
40
- */
41
- /**
42
- * Complete locale interface for all auth-related text
43
- */
44
- interface AuthLocale {
45
- common: {
46
- loading: string;
47
- submit: string;
48
- cancel: string;
49
- continue: string;
50
- back: string;
51
- or: string;
52
- optional: string;
53
- };
54
- auth: {
55
- signIn: string;
56
- signUp: string;
57
- signOut: string;
58
- email: string;
59
- password: string;
60
- confirmPassword: string;
61
- username: string;
62
- phone: string;
63
- rememberMe: string;
64
- forgotPassword: string;
65
- continueWith: string;
66
- orContinueWith: string;
67
- };
68
- oauth: {
69
- google: string;
70
- github: string;
71
- microsoft: string;
72
- facebook: string;
73
- apple: string;
74
- discord: string;
75
- twitter: string;
76
- linkedin: string;
77
- chooseProvider: string;
78
- signInPreferred: string;
79
- };
80
- magicLink: {
81
- sendLink: string;
82
- checkEmail: string;
83
- linkSent: string;
84
- enterEmail: string;
85
- };
86
- phone: {
87
- enterPhone: string;
88
- sendCode: string;
89
- enterCode: string;
90
- verifyPhone: string;
91
- codeLabel: string;
579
+ interface ClientConfig {
580
+ version?: string;
581
+ app_id?: string;
582
+ branding?: {
583
+ app_name?: string;
584
+ logo_url?: string;
92
585
  };
93
- mfa: {
94
- required: string;
95
- selectMethod: string;
96
- verify: string;
97
- enterCode: string;
98
- sms: string;
99
- authenticator: string;
100
- email: string;
586
+ password?: {
587
+ enabled: boolean;
101
588
  };
102
- passkey: {
103
- signInWith: string;
104
- register: string;
105
- usePasskey: string;
589
+ social?: {
590
+ enabled: boolean;
591
+ providers: SocialProviderConfig[];
106
592
  };
107
- deviceFlow: {
108
- title: string;
109
- subtitle: string;
110
- enterCode: string;
111
- enterCodeDescription: string;
112
- codeLabel: string;
113
- codePlaceholder: string;
114
- codeHint: string;
115
- verify: string;
116
- verifyCode: string;
117
- invalidCode: string;
118
- noCode: string;
119
- getCodeHelp: string;
120
- authorizationTitle: string;
121
- authorizationSubtitle: string;
122
- authorizeTitle: string;
123
- authorizeDescription: string;
124
- requestingAccess: string;
125
- codeConfirm: string;
126
- requestedPermissions: string;
127
- securityWarning: string;
128
- scopes: string;
129
- approve: string;
130
- deny: string;
131
- authorizedTitle: string;
132
- authorizedMessage: string;
133
- authorizedDescription: string;
134
- authorizedHint: string;
135
- returnToCli: string;
136
- deniedTitle: string;
137
- deniedMessage: string;
138
- deniedDescription: string;
139
- deniedHint: string;
593
+ passkey?: {
594
+ enabled: boolean;
140
595
  };
141
- signUp: {
142
- title: string;
143
- subtitle: string;
144
- haveAccount: string;
145
- signInLink: string;
146
- agreeToTerms: string;
147
- terms: string;
596
+ mfa?: {
597
+ enabled: boolean;
598
+ methods: string[];
148
599
  };
149
- signIn: {
150
- title: string;
151
- subtitle: string;
152
- noAccount: string;
153
- signUpLink: string;
154
- enterEmail: string;
600
+ magiclink?: {
601
+ enabled: boolean;
155
602
  };
156
- validation: {
157
- emailRequired: string;
158
- emailInvalid: string;
159
- passwordRequired: string;
160
- passwordTooShort: string;
161
- passwordRequireUppercase: string;
162
- passwordRequireLowercase: string;
163
- passwordRequireNumber: string;
164
- passwordRequireSpecial: string;
165
- passwordMismatch: string;
166
- usernameRequired: string;
167
- usernameInvalid: string;
168
- phoneRequired: string;
169
- phoneInvalid: string;
170
- codeRequired: string;
171
- codeInvalid: string;
172
- fieldRequired: string;
173
- termsRequired: string;
174
- };
175
- errors: {
176
- invalidCredentials: string;
177
- userNotFound: string;
178
- userExists: string;
179
- invalidToken: string;
180
- tokenExpired: string;
181
- networkError: string;
182
- mfaRequired: string;
183
- emailNotVerified: string;
184
- phoneNotVerified: string;
185
- rateLimitExceeded: string;
186
- unknownError: string;
187
- generic: string;
188
- };
189
- success: {
190
- signedIn: string;
191
- signedUp: string;
192
- signedOut: string;
193
- linkSent: string;
194
- codeSent: string;
195
- verified: string;
196
- welcome: string;
197
- };
198
- placeholders: {
199
- email: string;
200
- password: string;
201
- confirmPassword: string;
202
- username: string;
203
- phone: string;
204
- code: string;
205
- fullName: string;
603
+ sso?: {
604
+ enabled: boolean;
605
+ connections: SSOConnectionConfig[];
206
606
  };
607
+ /** List of server-side plugin names that are installed and active. */
608
+ supported_plugins?: string[];
609
+ }
610
+ /** Interface for persisting tokens across sessions. */
611
+ interface TokenStorage {
612
+ getItem(key: string): string | null | Promise<string | null>;
613
+ setItem(key: string, value: string): void | Promise<void>;
614
+ removeItem(key: string): void | Promise<void>;
207
615
  }
208
- /**
209
- * Deep partial type for locale overrides
210
- */
211
- type DeepPartial<T> = {
212
- [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
213
- };
214
-
215
- /**
216
- * Validation utilities
217
- */
218
-
219
- /**
220
- * Validate email address
221
- */
222
- declare function validateEmail(email: string, locale?: AuthLocale): ValidationError | null;
223
- /**
224
- * Validate password
225
- */
226
- declare function validatePassword(password: string, options?: {
227
- minLength?: number;
228
- requireUppercase?: boolean;
229
- requireLowercase?: boolean;
230
- requireNumber?: boolean;
231
- requireSpecial?: boolean;
232
- locale?: AuthLocale;
233
- }): ValidationError | null;
234
- /**
235
- * Validate phone number
236
- */
237
- declare function validatePhone(phone: string, locale?: AuthLocale): ValidationError | null;
238
- /**
239
- * Validate username
240
- */
241
- declare function validateUsername(username: string, locale?: AuthLocale): ValidationError | null;
242
- /**
243
- * Validate 2FA code
244
- */
245
- declare function validate2FACode(code: string, locale?: AuthLocale): ValidationError | null;
246
- /**
247
- * Validate required field
248
- */
249
- declare function validateRequired(value: unknown, fieldName: string, locale?: AuthLocale): ValidationError | null;
250
-
251
- /**
252
- * Token management utilities
253
- */
254
616
 
255
- /**
256
- * Token manager class
257
- */
258
- declare class TokenManager {
259
- private storage;
260
- constructor(storage?: Storage);
617
+ interface AuthClientConfig {
618
+ /** Base URL of the AuthSome API (e.g., "https://api.example.com") */
619
+ baseURL: string;
620
+ /** Optional custom fetch implementation */
621
+ fetch?: typeof globalThis.fetch;
622
+ }
623
+ declare class AuthClient$1 {
624
+ private baseURL;
625
+ private fetchFn;
626
+ constructor(config: AuthClientConfig | Pick<{
627
+ baseURL: string;
628
+ fetch?: typeof globalThis.fetch;
629
+ }, 'baseURL' | 'fetch'>);
261
630
  /**
262
- * Get access token
631
+ * Get AuthSome manifest
632
+ * GET /.well-known/authsome/manifest
263
633
  */
264
- getToken(): Promise<string | null>;
634
+ getManifest(): Promise<Record<string, unknown>>;
265
635
  /**
266
- * Set access token
636
+ * Get OpenAPI specification
637
+ * GET /.well-known/authsome/openapi
267
638
  */
268
- setToken(token: string): Promise<void>;
639
+ getOpenAPI(): Promise<Record<string, unknown>>;
269
640
  /**
270
- * Remove access token
641
+ * Stop impersonation (admin)
642
+ * POST /v1/auth/admin/impersonate/stop
271
643
  */
272
- removeToken(): Promise<void>;
644
+ adminStopImpersonation(body: AdminStopImpersonationRequest, token: string): Promise<StatusResponse>;
273
645
  /**
274
- * Get refresh token
646
+ * Impersonate user (admin)
647
+ * POST /v1/auth/admin/impersonate/{userId}
275
648
  */
276
- getRefreshToken(): Promise<string | null>;
649
+ adminImpersonate(userId: string, body: AdminImpersonateRequest, token: string): Promise<AuthResponse>;
277
650
  /**
278
- * Set refresh token
651
+ * List organizations (admin)
652
+ * GET /v1/auth/admin/orgs
279
653
  */
280
- setRefreshToken(token: string): Promise<void>;
654
+ adminListOrgs(token: string): Promise<OrgListResponse>;
281
655
  /**
282
- * Remove refresh token
656
+ * Get stats (admin)
657
+ * GET /v1/auth/admin/stats
283
658
  */
284
- removeRefreshToken(): Promise<void>;
659
+ adminGetStats(token: string): Promise<AdminStatsResponse>;
285
660
  /**
286
- * Clear all tokens
661
+ * List users (admin)
662
+ * GET /v1/auth/admin/users
287
663
  */
288
- clearTokens(): Promise<void>;
664
+ adminListUsers(token: string): Promise<AdminUserListResponse>;
289
665
  /**
290
- * Check if token is expired
666
+ * Get user (admin)
667
+ * GET /v1/auth/admin/users/{userId}
291
668
  */
292
- isTokenExpired(token: string): boolean;
669
+ adminGetUser(userId: string, token: string): Promise<User>;
293
670
  /**
294
- * Decode JWT token (without verification)
671
+ * Delete user (admin)
672
+ * DELETE /v1/auth/admin/users/{userId}
295
673
  */
296
- private decodeToken;
297
- }
298
-
299
- /**
300
- * Cookie utility functions
301
- * Framework-agnostic helpers for cookie parsing and serialization
302
- */
303
-
304
- /**
305
- * Parse Set-Cookie header value into CookieData
306
- * @param setCookieHeader - The Set-Cookie header value
307
- * @returns Parsed cookie data
308
- */
309
- declare function parseCookie(setCookieHeader: string): CookieData | null;
310
- /**
311
- * Extract multiple cookies from Set-Cookie headers
312
- * @param setCookieHeaders - Array of Set-Cookie header values or single string
313
- * @returns Array of parsed cookies
314
- */
315
- declare function extractCookiesFromHeaders(setCookieHeaders: string | string[]): CookieData[];
316
- /**
317
- * Serialize a CookieData object into a Set-Cookie header value
318
- * @param cookie - The cookie data to serialize
319
- * @returns Set-Cookie header value
320
- */
321
- declare function serializeCookie(cookie: CookieData): string;
322
- /**
323
- * Parse Cookie header value into key-value pairs
324
- * @param cookieHeader - The Cookie header value
325
- * @returns Object with cookie name-value pairs
326
- */
327
- declare function parseCookieOptions(cookieHeader: string): Record<string, string>;
328
- /**
329
- * Convert cookie object to Cookie header string
330
- * @param cookies - Object with cookie name-value pairs
331
- * @returns Cookie header value
332
- */
333
- declare function serializeCookies(cookies: Record<string, string>): string;
334
-
335
- /**
336
- * Locale utility functions
337
- */
338
-
339
- /**
340
- * Default locale (English)
341
- */
342
- declare const defaultLocale: AuthLocale;
343
- /**
344
- * Create a complete locale by merging overrides with the default English locale
345
- *
346
- * @param overrides - Partial locale object with custom translations
347
- * @returns Complete locale object with all required keys
348
- *
349
- * @example
350
- * ```typescript
351
- * const spanishLocale = createLocale({
352
- * auth: {
353
- * signIn: 'Iniciar sesión',
354
- * signUp: 'Registrarse',
355
- * }
356
- * });
357
- * ```
358
- */
359
- declare function createLocale(overrides?: DeepPartial<AuthLocale>): AuthLocale;
360
- /**
361
- * Interpolate template string with values
362
- *
363
- * Replaces {key} placeholders with corresponding values from the provided object.
364
- *
365
- * @param template - Template string with {key} placeholders
366
- * @param values - Object with key-value pairs for interpolation
367
- * @returns Interpolated string
368
- *
369
- * @example
370
- * ```typescript
371
- * interpolate('Hello, {name}!', { name: 'John' })
372
- * // Returns: "Hello, John!"
373
- *
374
- * interpolate('Password must be at least {min} characters', { min: '8' })
375
- * // Returns: "Password must be at least 8 characters"
376
- * ```
377
- */
378
- declare function interpolate(template: string, values: Record<string, string | number>): string;
379
-
380
- /**
381
- * Auth client configuration
382
- */
383
- interface AuthClientConfig {
384
- provider: AuthProvider;
385
- autoRefresh?: boolean;
386
- refreshInterval?: number;
387
- }
388
- /**
389
- * Auth client class
390
- */
391
- declare class AuthClient {
392
- private provider;
393
- private autoRefresh;
394
- private refreshInterval;
395
- private refreshTimer?;
396
- readonly state: Observable<AuthContext>;
397
- get adapter(): AuthProvider;
398
- constructor(config: AuthClientConfig);
674
+ adminDeleteUser(userId: string, body: AdminDeleteUserRequest, token: string): Promise<StatusResponse>;
399
675
  /**
400
- * Initialize the auth client
676
+ * Ban user (admin)
677
+ * POST /v1/auth/admin/users/{userId}/ban
401
678
  */
402
- initialize(): Promise<void>;
679
+ adminBanUser(userId: string, body: AdminBanUserRequest, token: string): Promise<StatusResponse>;
403
680
  /**
404
- * Sign in with credentials
681
+ * Unban user (admin)
682
+ * POST /v1/auth/admin/users/{userId}/unban
405
683
  */
406
- signIn(request: SignInRequest): Promise<void>;
684
+ adminUnbanUser(userId: string, body: AdminUnbanUserRequest, token: string): Promise<StatusResponse>;
407
685
  /**
408
- * Sign up with credentials
686
+ * Change password
687
+ * POST /v1/auth/change-password
409
688
  */
410
- signUp(request: SignUpRequest): Promise<void>;
689
+ changePassword(body: ChangePasswordRequest, token: string): Promise<StatusResponse>;
411
690
  /**
412
- * Sign out
691
+ * List devices
692
+ * GET /v1/auth/devices
413
693
  */
414
- signOut(): Promise<void>;
694
+ listDevices(token: string): Promise<DeviceListResponse>;
415
695
  /**
416
- * Update user profile
696
+ * Get device
697
+ * GET /v1/auth/devices/{deviceId}
417
698
  */
418
- updateUser(request: UpdateUserRequest): Promise<void>;
699
+ getDevice(deviceId: string, token: string): Promise<Device>;
419
700
  /**
420
- * Change password
701
+ * Delete device
702
+ * DELETE /v1/auth/devices/{deviceId}
703
+ */
704
+ deleteDevice(deviceId: string, body: DeleteDeviceRequest, token: string): Promise<StatusResponse>;
705
+ /**
706
+ * Trust device
707
+ * PATCH /v1/auth/devices/{deviceId}/trust
421
708
  */
422
- changePassword(request: PasswordChangeRequest): Promise<void>;
709
+ trustDevice(deviceId: string, body: TrustDeviceRequest, token: string): Promise<Device>;
423
710
  /**
424
- * Request password reset
711
+ * Forgot password
712
+ * POST /v1/auth/forgot-password
425
713
  */
426
- requestPasswordReset(request: PasswordResetRequest): Promise<void>;
714
+ forgotPassword(body: ForgotPasswordRequest): Promise<ForgotPasswordResponse>;
427
715
  /**
428
- * Confirm password reset
716
+ * Health check
717
+ * GET /v1/auth/health
429
718
  */
430
- confirmPasswordReset(request: PasswordResetConfirmRequest): Promise<void>;
719
+ getHealth(): Promise<HealthResponse>;
431
720
  /**
432
- * Get OAuth sign in URL
721
+ * List API keys
722
+ * GET /v1/auth/keys
433
723
  */
434
- getOAuthUrl(request: OAuthSignInRequest): Promise<string>;
724
+ listAPIKeys(token: string): Promise<ListKeysResponse>;
435
725
  /**
436
- * Handle OAuth callback
726
+ * Create API key
727
+ * POST /v1/auth/keys
437
728
  */
438
- handleOAuthCallback(request: OAuthCallbackRequest): Promise<void>;
729
+ createAPIKey(body: CreateAPIKeyRequest, token: string): Promise<CreateKeyResponse>;
439
730
  /**
440
- * Get available OAuth providers
731
+ * Revoke API key
732
+ * DELETE /v1/auth/keys/{keyId}
441
733
  */
442
- getOAuthProviders(): Promise<OAuthProvider[]>;
734
+ revokeAPIKey(keyId: string, body: RevokeAPIKeyRequest, token: string): Promise<void>;
443
735
  /**
444
736
  * Send magic link
737
+ * POST /v1/auth/magic-link/send
445
738
  */
446
- sendMagicLink(request: MagicLinkRequest): Promise<void>;
739
+ sendMagicLink(body: SendMagicLinkRequest): Promise<SendResponse>;
447
740
  /**
448
741
  * Verify magic link
742
+ * POST /v1/auth/magic-link/verify
743
+ */
744
+ verifyMagicLink(body: VerifyMagicLinkRequest): Promise<VerifyResponse>;
745
+ /**
746
+ * Get current user
747
+ * GET /v1/auth/me
748
+ */
749
+ getMe(token: string): Promise<User>;
750
+ /**
751
+ * Update current user
752
+ * PATCH /v1/auth/me
753
+ */
754
+ updateMe(body: UpdateMeRequest, token: string): Promise<User>;
755
+ /**
756
+ * Delete account
757
+ * DELETE /v1/auth/me
758
+ */
759
+ deleteMe(body: DeleteMeRequest, token: string): Promise<StatusResponse>;
760
+ /**
761
+ * Export user data
762
+ * GET /v1/auth/me/export
449
763
  */
450
- verifyMagicLink(request: MagicLinkVerifyRequest): Promise<void>;
764
+ exportMyData(token: string): Promise<Record<string, unknown>>;
451
765
  /**
452
- * Send phone verification code
766
+ * MFA challenge
767
+ * POST /v1/auth/mfa/challenge
453
768
  */
454
- sendPhoneCode(request: PhoneAuthRequest): Promise<void>;
769
+ challengeMFA(body: ChallengeMFARequest): Promise<ChallengeResponse>;
455
770
  /**
456
- * Verify phone code
771
+ * Enroll in MFA
772
+ * POST /v1/auth/mfa/enroll
457
773
  */
458
- verifyPhoneCode(request: PhoneVerifyRequest): Promise<void>;
774
+ enrollMFA(body: EnrollMFARequest, token: string): Promise<EnrollResponse>;
459
775
  /**
460
- * Setup 2FA
776
+ * Disable MFA
777
+ * DELETE /v1/auth/mfa/enrollment
461
778
  */
462
- setupTwoFactor(request: TwoFactorSetupRequest): Promise<TwoFactorSetupResponse>;
779
+ disableMFA(body: DisableMFARequest, token: string): Promise<DisableResponse>;
463
780
  /**
464
- * Verify 2FA code
781
+ * Regenerate MFA recovery codes
782
+ * POST /v1/auth/mfa/recovery/regenerate
465
783
  */
466
- verifyTwoFactor(request: TwoFactorVerifyRequest): Promise<void>;
784
+ regenerateMFARecoveryCodes(body: RegenerateMFARecoveryCodesRequest, token: string): Promise<RecoveryRegenerateResponse>;
467
785
  /**
468
- * Disable 2FA
786
+ * Verify MFA recovery code
787
+ * POST /v1/auth/mfa/recovery/verify
469
788
  */
470
- disableTwoFactor(): Promise<void>;
789
+ verifyRecoveryCode(body: VerifyRecoveryCodeRequest): Promise<RecoveryVerifyResponse>;
471
790
  /**
472
- * Get 2FA status
791
+ * Send SMS verification code
792
+ * POST /v1/auth/mfa/sms/send
473
793
  */
474
- getTwoFactorStatus(): Promise<TwoFactorMethod[]>;
794
+ sendSMSCode(body: SendSMSCodeRequest, token: string): Promise<SMSSendResponse>;
475
795
  /**
476
- * Register passkey
796
+ * Verify SMS code
797
+ * POST /v1/auth/mfa/sms/verify
477
798
  */
478
- registerPasskey(request: PasskeyRegisterRequest): Promise<PasskeyCredential>;
799
+ verifySMSCode(body: VerifySMSCodeRequest, token: string): Promise<SMSVerifyResponse>;
479
800
  /**
480
- * Authenticate with passkey
801
+ * Verify MFA code
802
+ * POST /v1/auth/mfa/verify
481
803
  */
482
- authenticatePasskey(request: PasskeyAuthRequest): Promise<void>;
804
+ verifyMFA(body: VerifyMFARequest): Promise<VerifyMFAResponse>;
805
+ /**
806
+ * List organizations
807
+ * GET /v1/auth/orgs
808
+ */
809
+ listOrganizations(token: string): Promise<OrgListResponse>;
810
+ /**
811
+ * Create organization
812
+ * POST /v1/auth/orgs
813
+ */
814
+ createOrganization(body: CreateOrganizationRequest, token: string): Promise<Organization>;
815
+ /**
816
+ * Check slug availability
817
+ * GET /v1/auth/orgs/check-slug
818
+ */
819
+ checkOrgSlug(token: string): Promise<SlugAvailableResponse>;
820
+ /**
821
+ * Accept invitation
822
+ * POST /v1/auth/orgs/invitations/accept
823
+ */
824
+ acceptInvitation(body: AcceptInvitationRequest, token: string): Promise<Member>;
825
+ /**
826
+ * Decline invitation
827
+ * POST /v1/auth/orgs/invitations/decline
828
+ */
829
+ declineInvitation(body: DeclineInvitationRequest, token: string): Promise<StatusResponse>;
830
+ /**
831
+ * Get organization
832
+ * GET /v1/auth/orgs/{orgId}
833
+ */
834
+ getOrganization(orgId: string, token: string): Promise<Organization>;
835
+ /**
836
+ * Update organization
837
+ * PATCH /v1/auth/orgs/{orgId}
838
+ */
839
+ updateOrganization(orgId: string, body: UpdateOrganizationRequest, token: string): Promise<Organization>;
840
+ /**
841
+ * Delete organization
842
+ * DELETE /v1/auth/orgs/{orgId}
843
+ */
844
+ deleteOrganization(orgId: string, body: DeleteOrganizationRequest, token: string): Promise<StatusResponse>;
845
+ /**
846
+ * List invitations
847
+ * GET /v1/auth/orgs/{orgId}/invitations
848
+ */
849
+ listInvitations(orgId: string, token: string): Promise<InvitationListResponse>;
850
+ /**
851
+ * Create invitation
852
+ * POST /v1/auth/orgs/{orgId}/invitations
853
+ */
854
+ createInvitation(orgId: string, body: CreateInvitationRequest, token: string): Promise<Invitation>;
855
+ /**
856
+ * List members
857
+ * GET /v1/auth/orgs/{orgId}/members
858
+ */
859
+ listMembers(orgId: string, token: string): Promise<MemberListResponse>;
860
+ /**
861
+ * Add member
862
+ * POST /v1/auth/orgs/{orgId}/members
863
+ */
864
+ addMember(orgId: string, body: AddMemberRequest, token: string): Promise<Member>;
865
+ /**
866
+ * Update member role
867
+ * PATCH /v1/auth/orgs/{orgId}/members/{memberId}
868
+ */
869
+ updateMember(orgId: string, memberId: string, body: UpdateMemberRequest, token: string): Promise<Member>;
870
+ /**
871
+ * Remove member
872
+ * DELETE /v1/auth/orgs/{orgId}/members/{memberId}
873
+ */
874
+ removeMember(orgId: string, memberId: string, body: RemoveMemberRequest, token: string): Promise<StatusResponse>;
875
+ /**
876
+ * List teams
877
+ * GET /v1/auth/orgs/{orgId}/teams
878
+ */
879
+ listTeams(orgId: string, token: string): Promise<TeamListResponse>;
880
+ /**
881
+ * Create team
882
+ * POST /v1/auth/orgs/{orgId}/teams
883
+ */
884
+ createTeam(orgId: string, body: CreateTeamRequest, token: string): Promise<Team>;
885
+ /**
886
+ * Get team
887
+ * GET /v1/auth/orgs/{orgId}/teams/{teamId}
888
+ */
889
+ getTeam(orgId: string, teamId: string, token: string): Promise<Team>;
890
+ /**
891
+ * Update team
892
+ * PATCH /v1/auth/orgs/{orgId}/teams/{teamId}
893
+ */
894
+ updateTeam(orgId: string, teamId: string, body: UpdateTeamRequest, token: string): Promise<Team>;
895
+ /**
896
+ * Delete team
897
+ * DELETE /v1/auth/orgs/{orgId}/teams/{teamId}
898
+ */
899
+ deleteTeam(orgId: string, teamId: string, body: DeleteTeamRequest, token: string): Promise<StatusResponse>;
483
900
  /**
484
901
  * List passkeys
902
+ * GET /v1/auth/passkeys/
485
903
  */
486
- listPasskeys(): Promise<PasskeyCredential[]>;
904
+ listPasskeys(token: string): Promise<ListResponse$1>;
905
+ /**
906
+ * Begin passkey login
907
+ * POST /v1/auth/passkeys/login/begin
908
+ */
909
+ passkeyLoginBegin(body: PasskeyLoginBeginRequest): Promise<LoginBeginResponse>;
910
+ /**
911
+ * Complete passkey login
912
+ * POST /v1/auth/passkeys/login/finish
913
+ */
914
+ passkeyLoginFinish(body: PasskeyLoginFinishRequest): Promise<LoginFinishResponse>;
915
+ /**
916
+ * Begin passkey registration
917
+ * POST /v1/auth/passkeys/register/begin
918
+ */
919
+ passkeyRegisterBegin(body: PasskeyRegisterBeginRequest, token: string): Promise<RegisterBeginResponse>;
920
+ /**
921
+ * Complete passkey registration
922
+ * POST /v1/auth/passkeys/register/finish
923
+ */
924
+ passkeyRegisterFinish(body: PasskeyRegisterFinishRequest, token: string): Promise<RegisterFinishResponse>;
487
925
  /**
488
926
  * Delete passkey
927
+ * DELETE /v1/auth/passkeys/{credentialId}
489
928
  */
490
- deletePasskey(credentialId: string): Promise<void>;
929
+ deletePasskey(credentialId: string, body: DeletePasskeyRequest, token: string): Promise<DeleteResponse>;
491
930
  /**
492
- * Get all organizations the user belongs to
493
- * Only available if the provider supports organizations
931
+ * Refresh tokens
932
+ * POST /v1/auth/refresh
494
933
  */
495
- getOrganizations(): Promise<Organization[]>;
934
+ refresh(body: RefreshRequest): Promise<TokenResponse>;
496
935
  /**
497
- * Get the currently active organization
498
- * Only available if the provider supports organizations
936
+ * Reset password
937
+ * POST /v1/auth/reset-password
499
938
  */
500
- getActiveOrganization(): Promise<Organization | null>;
939
+ resetPassword(body: ResetPasswordRequest): Promise<StatusResponse>;
501
940
  /**
502
- * Set the active organization and refresh user state
503
- * Only available if the provider supports organizations
941
+ * List roles
942
+ * GET /v1/auth/roles
504
943
  */
505
- setActiveOrganization(organizationId: string): Promise<void>;
944
+ listRoles(token: string): Promise<RoleListResponse>;
506
945
  /**
507
- * Get organization memberships with roles and permissions
508
- * Only available if the provider supports organizations
946
+ * Create role
947
+ * POST /v1/auth/roles
509
948
  */
510
- getOrganizationMemberships(): Promise<OrganizationMembership[]>;
949
+ createRole(body: CreateRoleRequest, token: string): Promise<Role>;
511
950
  /**
512
- * Check if the provider supports organizations
951
+ * Get role
952
+ * GET /v1/auth/roles/{roleId}
513
953
  */
514
- supportsOrganizations(): boolean;
954
+ getRole(roleId: string, token: string): Promise<Role>;
515
955
  /**
516
- * Refresh session
956
+ * Update role
957
+ * PATCH /v1/auth/roles/{roleId}
517
958
  */
518
- refreshSession(): Promise<void>;
959
+ updateRole(roleId: string, body: UpdateRoleRequest, token: string): Promise<Role>;
519
960
  /**
520
- * Get current user
961
+ * Delete role
962
+ * DELETE /v1/auth/roles/{roleId}
521
963
  */
522
- getUser(): User | null;
964
+ deleteRole(roleId: string, body: DeleteRoleRequest, token: string): Promise<StatusResponse>;
523
965
  /**
524
- * Get current session
966
+ * Assign role to user
967
+ * POST /v1/auth/roles/{roleId}/assign
525
968
  */
526
- getSession(): Session | null;
969
+ assignRole(roleId: string, body: AssignRoleRequest, token: string): Promise<StatusResponse>;
527
970
  /**
528
- * Check if authenticated
971
+ * List role permissions
972
+ * GET /v1/auth/roles/{roleId}/permissions
529
973
  */
530
- isAuthenticated(): boolean;
974
+ listRolePermissions(roleId: string, token: string): Promise<PermissionListResponse>;
531
975
  /**
532
- * Get current error
976
+ * Add permission to role
977
+ * POST /v1/auth/roles/{roleId}/permissions
533
978
  */
534
- getError(): AuthError | null;
979
+ addPermission(roleId: string, body: AddPermissionRequest, token: string): Promise<Permission>;
535
980
  /**
536
- * Clear error
981
+ * Remove permission from role
982
+ * DELETE /v1/auth/roles/{roleId}/permissions/{permissionId}
537
983
  */
538
- clearError(): void;
984
+ removePermission(roleId: string, permissionId: string, body: RemovePermissionRequest, token: string): Promise<StatusResponse>;
539
985
  /**
540
- * Subscribe to auth state changes
986
+ * Unassign role from user
987
+ * POST /v1/auth/roles/{roleId}/unassign
541
988
  */
542
- subscribe(listener: (context: AuthContext) => void): Unsubscribe;
989
+ unassignRole(roleId: string, body: UnassignRoleRequest, token: string): Promise<StatusResponse>;
543
990
  /**
544
- * Cleanup resources
991
+ * List sessions
992
+ * GET /v1/auth/sessions
545
993
  */
546
- destroy(): void;
547
- private updateState;
548
- private setLoading;
549
- private handleError;
550
- private startAutoRefresh;
551
- private stopAutoRefresh;
552
- private createUnsupportedError;
553
- }
554
-
555
- /**
556
- * Authentication flow types and state machine
557
- */
558
-
559
- /**
560
- * Available authentication flow steps
561
- */
562
- declare enum FlowStep {
563
- SIGN_IN = "sign_in",
564
- SIGN_UP = "sign_up",
565
- EMAIL_PASSWORD_SIGN_IN = "email_password_sign_in",
566
- EMAIL_PASSWORD_SIGN_UP = "email_password_sign_up",
567
- OAUTH_SELECT = "oauth_select",
568
- OAUTH_CALLBACK = "oauth_callback",
569
- MAGIC_LINK_REQUEST = "magic_link_request",
570
- MAGIC_LINK_VERIFY = "magic_link_verify",
571
- MAGIC_LINK_SENT = "magic_link_sent",
572
- PHONE_REQUEST = "phone_request",
573
- PHONE_VERIFY = "phone_verify",
574
- USERNAME_SIGN_IN = "username_sign_in",
575
- USERNAME_SIGN_UP = "username_sign_up",
576
- PASSKEY_REGISTER = "passkey_register",
577
- PASSKEY_AUTHENTICATE = "passkey_authenticate",
578
- MFA_REQUIRED = "mfa_required",
579
- MFA_SETUP = "mfa_setup",
580
- MFA_VERIFY = "mfa_verify",
581
- MFA_SELECT_METHOD = "mfa_select_method",
582
- EMAIL_VERIFICATION_REQUIRED = "email_verification_required",
583
- EMAIL_VERIFICATION_SENT = "email_verification_sent",
584
- PHONE_VERIFICATION_REQUIRED = "phone_verification_required",
585
- PASSWORD_RESET_REQUEST = "password_reset_request",
586
- PASSWORD_RESET_SENT = "password_reset_sent",
587
- PASSWORD_RESET_CONFIRM = "password_reset_confirm",
588
- PASSWORD_CHANGE = "password_change",
589
- PROFILE_UPDATE = "profile_update",
590
- PROFILE_COMPLETE = "profile_complete",
591
- DEVICE_FLOW_INITIATE = "device_flow_initiate",
592
- DEVICE_CODE_ENTRY = "device_code_entry",
593
- DEVICE_CODE_VERIFY = "device_code_verify",
594
- DEVICE_AUTHORIZE = "device_authorize",
595
- DEVICE_POLLING = "device_polling",
596
- DEVICE_AUTHORIZED = "device_authorized",
597
- DEVICE_DENIED = "device_denied",
598
- SUCCESS = "success",
599
- ERROR = "error",
600
- CANCELLED = "cancelled"
601
- }
602
- /**
603
- * Flow state data that can be passed between steps
604
- */
605
- interface FlowState {
606
- currentStep: FlowStep;
607
- previousStep?: FlowStep;
608
- user?: User;
609
- session?: Session;
610
- email?: string;
611
- phone?: string;
612
- username?: string;
613
- token?: string;
614
- mfaRequired?: boolean;
615
- mfaMethods?: TwoFactorMethod[];
616
- mfaToken?: string;
617
- oauthProvider?: OAuthProvider;
618
- oauthRedirectUrl?: string;
619
- verificationRequired?: boolean;
620
- verificationToken?: string;
621
- verificationSent?: boolean;
622
- deviceCode?: string;
623
- userCode?: string;
624
- verificationUri?: string;
625
- verificationUriComplete?: string;
626
- deviceCodeExpiresIn?: number;
627
- devicePollingInterval?: number;
628
- deviceClientId?: string;
629
- deviceScopes?: string[];
630
- deviceAuthorized?: boolean;
631
- error?: AuthError;
632
- metadata?: Record<string, unknown>;
633
- }
634
- /**
635
- * Flow transition result
636
- */
637
- interface FlowTransition {
638
- nextStep: FlowStep;
639
- state: Partial<FlowState>;
640
- }
641
- /**
642
- * Flow configuration for a specific authentication journey
643
- */
644
- interface FlowConfig {
645
- name: string;
646
- description?: string;
647
- initialStep: FlowStep;
648
- allowedSteps: FlowStep[];
649
- transitions: {
650
- [key in FlowStep]?: {
651
- onSuccess?: FlowStep;
652
- onError?: FlowStep;
653
- onCancel?: FlowStep;
654
- onBack?: FlowStep;
655
- conditions?: Array<{
656
- when: (state: FlowState) => boolean;
657
- then: FlowStep;
658
- }>;
659
- };
660
- };
661
- onStepChange?: (step: FlowStep, state: FlowState) => void;
662
- onComplete?: (user: User, session: Session) => void;
663
- onError?: (error: AuthError, state: FlowState) => void;
664
- onCancel?: (state: FlowState) => void;
665
- }
666
- /**
667
- * Predefined flow configurations
668
- */
669
- declare enum FlowConfigType {
670
- SIMPLE_SIGN_IN = "simple_sign_in",
671
- SIMPLE_SIGN_UP = "simple_sign_up",
672
- SIGN_UP_WITH_EMAIL_VERIFICATION = "sign_up_with_email_verification",
673
- SIGN_IN_WITH_MFA = "sign_in_with_mfa",
674
- OAUTH_SIGN_IN = "oauth_sign_in",
675
- MAGIC_LINK_FLOW = "magic_link_flow",
676
- PHONE_AUTH_FLOW = "phone_auth_flow",
677
- COMPLETE_SIGN_UP_FLOW = "complete_sign_up_flow",// signup → verify email → complete profile
678
- SECURE_SIGN_IN_FLOW = "secure_sign_in_flow",// signin → MFA → success
679
- PASSWORD_RESET_FLOW = "password_reset_flow",
680
- EMAIL_VERIFICATION_FLOW = "email_verification_flow",
681
- DEVICE_FLOW = "device_flow",
682
- CUSTOM = "custom"
683
- }
684
- /**
685
- * Flow action types
686
- */
687
- declare enum FlowAction {
688
- START = "start",
689
- NEXT = "next",
690
- BACK = "back",
691
- CANCEL = "cancel",
692
- ERROR = "error",
693
- RESET = "reset"
694
- }
695
- /**
696
- * Flow event for state machine
697
- */
698
- interface FlowEvent {
699
- action: FlowAction;
700
- data?: Partial<FlowState>;
701
- error?: AuthError;
702
- }
703
-
704
- /**
705
- * Authentication flow state machine engine
706
- */
707
-
708
- /**
709
- * Flow engine that manages authentication flow state transitions
710
- */
711
- declare class FlowEngine {
712
- private config;
713
- private state;
714
- private history;
715
- constructor(config: FlowConfig, initialState?: Partial<FlowState>);
994
+ listSessions(token: string): Promise<SessionListResponse>;
995
+ /**
996
+ * Revoke session
997
+ * DELETE /v1/auth/sessions/{sessionId}
998
+ */
999
+ revokeSession(sessionId: string, body: RevokeSessionRequest, token: string): Promise<StatusResponse>;
716
1000
  /**
717
- * Get current flow state
1001
+ * Sign in
1002
+ * POST /v1/auth/signin
718
1003
  */
719
- getState(): FlowState;
1004
+ signIn(body: SignInRequest): Promise<AuthResponse>;
720
1005
  /**
721
- * Get current step
1006
+ * Sign out
1007
+ * POST /v1/auth/signout
722
1008
  */
723
- getCurrentStep(): FlowStep;
1009
+ signOut(body: SignOutRequest, token: string): Promise<StatusResponse>;
724
1010
  /**
725
- * Check if step is allowed in this flow
1011
+ * Sign up
1012
+ * POST /v1/auth/signup
726
1013
  */
727
- isStepAllowed(step: FlowStep): boolean;
1014
+ signUp(body: SignUpRequest): Promise<AuthResponse>;
728
1015
  /**
729
- * Transition to next step based on action
1016
+ * Start OAuth flow
1017
+ * POST /v1/auth/social/{provider}
730
1018
  */
731
- transition(event: FlowEvent): Promise<FlowState>;
1019
+ startOAuth(provider: string, body: StartOAuthRequest): Promise<StartResponse>;
732
1020
  /**
733
- * Start or restart the flow
1021
+ * OAuth callback
1022
+ * GET /v1/auth/social/{provider}/callback
734
1023
  */
735
- private handleStart;
1024
+ oauthCallback(provider: string): Promise<CallbackResponse>;
736
1025
  /**
737
- * Move to next step
1026
+ * SSO SAML ACS endpoint
1027
+ * POST /v1/auth/sso/{provider}/acs
738
1028
  */
739
- private handleNext;
1029
+ ssoACS(provider: string, body: SsoACSRequest): Promise<CallbackResponse>;
740
1030
  /**
741
- * Go back to previous step
1031
+ * SSO callback (OIDC)
1032
+ * POST /v1/auth/sso/{provider}/callback
742
1033
  */
743
- private handleBack;
1034
+ ssoCallback(provider: string, body: SsoCallbackRequest): Promise<CallbackResponse>;
744
1035
  /**
745
- * Cancel the flow
1036
+ * Start SSO login flow
1037
+ * POST /v1/auth/sso/{provider}/login
746
1038
  */
747
- private handleCancel;
1039
+ startSSOLogin(provider: string, body: StartSSOLoginRequest): Promise<LoginResponse>;
748
1040
  /**
749
- * Handle error in flow
1041
+ * List user roles
1042
+ * GET /v1/auth/users/{userId}/roles
750
1043
  */
751
- private handleError;
1044
+ listUserRoles(userId: string, token: string): Promise<UserRoleListResponse>;
752
1045
  /**
753
- * Reset flow to initial state
1046
+ * Verify email
1047
+ * POST /v1/auth/verify-email
754
1048
  */
755
- private handleReset;
1049
+ verifyEmail(body: VerifyEmailRequest): Promise<StatusResponse>;
756
1050
  /**
757
- * Move to a specific step
1051
+ * List webhooks
1052
+ * GET /v1/auth/webhooks
758
1053
  */
759
- private moveToStep;
1054
+ listWebhooks(token: string): Promise<WebhookListResponse>;
760
1055
  /**
761
- * Get flow history
1056
+ * Create webhook
1057
+ * POST /v1/auth/webhooks
762
1058
  */
763
- getHistory(): FlowStep[];
1059
+ createWebhook(body: CreateWebhookRequest, token: string): Promise<Webhook>;
764
1060
  /**
765
- * Check if can go back
1061
+ * Get webhook
1062
+ * GET /v1/auth/webhooks/{webhookId}
766
1063
  */
767
- canGoBack(): boolean;
1064
+ getWebhook(webhookId: string, token: string): Promise<Webhook>;
1065
+ /**
1066
+ * Update webhook
1067
+ * PATCH /v1/auth/webhooks/{webhookId}
1068
+ */
1069
+ updateWebhook(webhookId: string, body: UpdateWebhookRequest, token: string): Promise<Webhook>;
1070
+ /**
1071
+ * Delete webhook
1072
+ * DELETE /v1/auth/webhooks/{webhookId}
1073
+ */
1074
+ deleteWebhook(webhookId: string, body: DeleteWebhookRequest, token: string): Promise<StatusResponse>;
1075
+ private request;
1076
+ }
1077
+ declare class AuthClientError extends Error {
1078
+ code?: number;
1079
+ constructor(message: string, code?: number);
768
1080
  }
769
1081
 
770
1082
  /**
771
- * Predefined flow configurations
1083
+ * AuthClient adapter — thin wrapper over the auto-generated API client.
1084
+ *
1085
+ * The generated client lives in ./generated/api-client.ts and covers all
1086
+ * core + plugin endpoints. This file extends it with a few convenience
1087
+ * overrides so that auth.ts (and downstream consumers) keep working
1088
+ * without changes.
772
1089
  */
773
1090
 
1091
+ /** Options for paginated list endpoints. */
1092
+ interface ListOptions {
1093
+ limit?: number;
1094
+ offset?: number;
1095
+ }
1096
+ /** Paginated list response. */
1097
+ interface ListResponse<T> {
1098
+ items: T[];
1099
+ total: number;
1100
+ }
774
1101
  /**
775
- * Simple sign-in flow (email/password only)
776
- */
777
- declare const simpleSignInFlow: FlowConfig;
778
- /**
779
- * Sign-in with MFA support
780
- */
781
- declare const signInWithMFAFlow: FlowConfig;
782
- /**
783
- * Complete sign-up flow with email verification
784
- */
785
- declare const completeSignUpFlow: FlowConfig;
786
- /**
787
- * Magic link authentication flow
1102
+ * AuthClient extends the auto-generated client with backward-compatible
1103
+ * convenience methods that auth.ts depends on.
1104
+ *
1105
+ * All 80+ generated endpoints are inherited as-is. Only two methods
1106
+ * are overridden to preserve the simpler call-site signatures used by
1107
+ * the auth state machine.
788
1108
  */
789
- declare const magicLinkFlow: FlowConfig;
1109
+ declare class AuthClient extends AuthClient$1 {
1110
+ /**
1111
+ * Refresh session tokens.
1112
+ *
1113
+ * Accepts a raw refresh-token string (used by auth.ts) or the full
1114
+ * RefreshRequest body.
1115
+ */
1116
+ refresh(body: {
1117
+ refresh_token: string;
1118
+ } | string): Promise<any>;
1119
+ /**
1120
+ * Sign out.
1121
+ *
1122
+ * Accepts a raw token string (used by auth.ts) or the full
1123
+ * (body, token) pair from the generated client.
1124
+ */
1125
+ signOut(bodyOrToken: unknown, token?: string): Promise<any>;
1126
+ /**
1127
+ * MFA challenge — bridge for auth.ts.
1128
+ *
1129
+ * auth.ts calls `mfaChallenge({ enrollment_id, code })` and expects
1130
+ * an AuthResponse back. The generated client uses `challengeMFA`.
1131
+ */
1132
+ mfaChallenge(body: {
1133
+ enrollment_id?: string;
1134
+ code: string;
1135
+ }): Promise<any>;
1136
+ /**
1137
+ * Verify an MFA recovery code.
1138
+ *
1139
+ * Accepts a raw code string (used by auth.ts) or the full request body.
1140
+ */
1141
+ verifyRecoveryCode(body: {
1142
+ code: string;
1143
+ } | string): Promise<any>;
1144
+ /**
1145
+ * Send an SMS code for MFA — bridge for auth.ts.
1146
+ *
1147
+ * Simplifies the call-site by accepting just the session token.
1148
+ */
1149
+ sendSMSCodeForMFA(token: string): Promise<any>;
1150
+ /**
1151
+ * Verify an SMS code for MFA — bridge for auth.ts.
1152
+ *
1153
+ * Simplifies the call-site by accepting code + token directly.
1154
+ */
1155
+ verifySMSCodeForMFA(code: string, token: string): Promise<any>;
1156
+ /**
1157
+ * Fetch the client configuration from the backend.
1158
+ *
1159
+ * The config describes which auth methods are enabled so SDK
1160
+ * components can auto-configure without manual props.
1161
+ */
1162
+ fetchClientConfig(publishableKey?: string): Promise<ClientConfig>;
1163
+ }
1164
+
790
1165
  /**
791
- * Phone authentication flow
1166
+ * Framework-agnostic authentication state machine.
1167
+ *
1168
+ * Manages sign-in/sign-up flows, token persistence, automatic refresh,
1169
+ * and MFA challenges. Framework adapters (React, Vue, etc.) wrap this
1170
+ * class and expose reactive state.
792
1171
  */
793
- declare const phoneAuthFlow: FlowConfig;
1172
+
794
1173
  /**
795
- * OAuth sign-in flow
1174
+ * AuthManager is the core state machine that drives authentication.
1175
+ *
1176
+ * Usage:
1177
+ * ```ts
1178
+ * const auth = new AuthManager({ baseURL: "https://api.example.com" });
1179
+ * auth.subscribe((state) => console.log(state));
1180
+ * await auth.initialize(); // hydrate from storage
1181
+ * await auth.signIn({ email, password });
1182
+ * ```
796
1183
  */
797
- declare const oauthSignInFlow: FlowConfig;
1184
+ declare class AuthManager {
1185
+ private client;
1186
+ private storage;
1187
+ private state;
1188
+ private listeners;
1189
+ private refreshTimer;
1190
+ private onError?;
1191
+ private publishableKey?;
1192
+ private clientConfig;
1193
+ private configListeners;
1194
+ private configFetchPromise;
1195
+ constructor(config: AuthConfig);
1196
+ /** Current auth state (snapshot). */
1197
+ getState(): AuthState;
1198
+ /** Subscribe to state changes. Returns an unsubscribe function. */
1199
+ subscribe(listener: (state: AuthState) => void): () => void;
1200
+ /** Access the underlying HTTP client. */
1201
+ getClient(): AuthClient;
1202
+ /**
1203
+ * Initialize by hydrating the session from storage.
1204
+ * When a publishableKey is set, also fetches client config in parallel.
1205
+ * Call this once on app start.
1206
+ */
1207
+ initialize(): Promise<void>;
1208
+ /** Sign in with email & password. */
1209
+ signIn(credentials: SignInRequest): Promise<void>;
1210
+ /** Sign up with email & password. */
1211
+ signUp(data: SignUpRequest): Promise<void>;
1212
+ /** Sign out and clear the session. */
1213
+ signOut(): Promise<void>;
1214
+ /** Submit an MFA challenge code. */
1215
+ submitMFACode(enrollmentId: string, code: string): Promise<void>;
1216
+ /** Submit an MFA recovery code. */
1217
+ submitRecoveryCode(code: string): Promise<void>;
1218
+ /** Send an SMS code for MFA verification. Returns masked phone + expiry info. */
1219
+ sendSMSCode(): Promise<{
1220
+ sent: boolean;
1221
+ phone_masked: string;
1222
+ expires_in_seconds: number;
1223
+ }>;
1224
+ /** Submit an SMS verification code during MFA challenge. */
1225
+ submitSMSCode(code: string): Promise<void>;
1226
+ /** Refresh the current session manually. */
1227
+ refreshNow(): Promise<void>;
1228
+ /** Get the current session token (if authenticated). */
1229
+ getSessionToken(): string | null;
1230
+ /** Get the current user (if authenticated). */
1231
+ getUser(): User | null;
1232
+ /** Get the cached client config (or null if not yet fetched). */
1233
+ getClientConfig(): ClientConfig | null;
1234
+ /** Subscribe to client config changes. Returns an unsubscribe function. */
1235
+ subscribeConfig(listener: (config: ClientConfig | null) => void): () => void;
1236
+ /**
1237
+ * Fetch client config from the backend.
1238
+ * Deduplicates concurrent calls and caches the result with a TTL.
1239
+ */
1240
+ fetchClientConfig(): Promise<ClientConfig>;
1241
+ /** Tear down: clear timers and listeners. */
1242
+ destroy(): void;
1243
+ private handleAuthResponse;
1244
+ private refreshSession;
1245
+ private scheduleRefresh;
1246
+ private clearRefreshTimer;
1247
+ private persistSession;
1248
+ private clearSession;
1249
+ private setClientConfig;
1250
+ private setState;
1251
+ private handleError;
1252
+ }
1253
+
798
1254
  /**
799
- * Password reset flow
1255
+ * WebAuthn encoding helpers.
1256
+ *
1257
+ * The go-webauthn backend serialises binary fields (challenge, user.id,
1258
+ * credential IDs, …) as **base64url strings** in JSON. The browser
1259
+ * WebAuthn API requires those same fields as ArrayBuffer / Uint8Array.
1260
+ *
1261
+ * These helpers bridge the gap in both directions:
1262
+ * begin response → browser API (base64url string → ArrayBuffer)
1263
+ * browser API → finish POST (ArrayBuffer → base64url string)
800
1264
  */
801
- declare const passwordResetFlow: FlowConfig;
1265
+ /** Decode a base64url-encoded string into a Uint8Array. */
1266
+ declare function base64urlToBuffer(base64url: string): Uint8Array;
1267
+ /** Encode an ArrayBuffer (or Uint8Array) to a base64url string (no padding). */
1268
+ declare function bufferToBase64url(buffer: ArrayBuffer | Uint8Array): string;
802
1269
  /**
803
- * Email verification flow
1270
+ * Prepare the options object returned by `/passkeys/register/begin`
1271
+ * for `navigator.credentials.create({ publicKey })`.
1272
+ *
1273
+ * Converts base64url strings → Uint8Array for:
1274
+ * challenge, user.id, excludeCredentials[].id
804
1275
  */
805
- declare const emailVerificationFlow: FlowConfig;
1276
+ declare function prepareCreationOptions(options: Record<string, unknown>): PublicKeyCredentialCreationOptions;
806
1277
  /**
807
- * Get predefined flow configuration by type
1278
+ * Prepare the options object returned by `/passkeys/login/begin`
1279
+ * for `navigator.credentials.get({ publicKey })`.
1280
+ *
1281
+ * Converts base64url strings → Uint8Array for:
1282
+ * challenge, allowCredentials[].id
808
1283
  */
809
- declare function getFlowConfig(type: FlowConfigType): FlowConfig;
1284
+ declare function prepareRequestOptions(options: Record<string, unknown>): PublicKeyCredentialRequestOptions;
810
1285
  /**
811
- * Export all predefined flows
1286
+ * Serialize a PublicKeyCredential returned by navigator.credentials
1287
+ * into a plain object suitable for POSTing to the `/finish` endpoint.
1288
+ *
1289
+ * Converts ArrayBuffer fields → base64url strings so they survive
1290
+ * JSON.stringify and match what go-webauthn expects.
812
1291
  */
813
- declare const predefinedFlows: {
814
- simple_sign_in: FlowConfig;
815
- sign_in_with_mfa: FlowConfig;
816
- complete_sign_up_flow: FlowConfig;
817
- magic_link_flow: FlowConfig;
818
- phone_auth_flow: FlowConfig;
819
- oauth_sign_in: FlowConfig;
820
- password_reset_flow: FlowConfig;
821
- email_verification_flow: FlowConfig;
822
- device_flow: FlowConfig;
823
- };
1292
+ declare function serializeCredential(credential: Credential): Record<string, unknown>;
824
1293
 
825
- export { AuthClient, type AuthClientConfig, AuthContext, AuthError, AuthErrorType, type AuthLocale, AuthProvider, CookieData, type DeepPartial, FlowAction, type FlowConfig, FlowConfigType, FlowEngine, type FlowEvent, type FlowState, FlowStep, type FlowTransition, MagicLinkRequest, MagicLinkVerifyRequest, OAuthCallbackRequest, OAuthProvider, OAuthSignInRequest, Observable, Organization, OrganizationMembership, PasskeyAuthRequest, PasskeyCredential, PasskeyRegisterRequest, PasswordChangeRequest, PasswordResetConfirmRequest, PasswordResetRequest, PhoneAuthRequest, PhoneVerifyRequest, Session, SignInRequest, SignUpRequest, Storage, TokenManager, TwoFactorMethod, TwoFactorSetupRequest, TwoFactorSetupResponse, TwoFactorVerifyRequest, Unsubscribe, UpdateUserRequest, User, ValidationError, completeSignUpFlow, createAuthError, createLocale, defaultLocale, emailVerificationFlow, extractCookiesFromHeaders, getFlowConfig, interpolate, isAuthError, isMFARequiredError, isNetworkError, isUnauthenticatedError, magicLinkFlow, oauthSignInFlow, parseCookie, parseCookieOptions, passwordResetFlow, phoneAuthFlow, predefinedFlows, serializeCookie, serializeCookies, signInWithMFAFlow, simpleSignInFlow, toAuthError, validate2FACode, validateEmail, validatePassword, validatePhone, validateRequired, validateUsername };
1294
+ export { type APIError, type KeyListItem as APIKey, type AddMemberRequest, type AdminBanUserRequest, AuthClient, type AuthClientConfig, AuthClientError, type AuthConfig, AuthManager, type AuthResponse, type AuthState, type ChallengeMFARequest, type ChangePasswordRequest, type ClientConfig, type CreateAPIKeyRequest, type CreateInvitationRequest, type CreateOrganizationRequest as CreateOrgRequest, type CreateOrganizationRequest, type Device, type EnrollMFARequest, type EnrollResponse, type ForgotPasswordRequest, type Invitation, type KeyListItem, type ListOptions, type ListResponse, type EnrollResponse as MFAEnrollment, type SendMagicLinkRequest as MagicLinkSendRequest, type VerifyMagicLinkRequest as MagicLinkVerifyRequest, type Member, type ChallengeMFARequest as MfaChallengeRequest, type EnrollMFARequest as MfaEnrollRequest, type SendSMSCodeRequest as MfaSMSSendRequest, type VerifySMSCodeRequest as MfaSMSVerifyRequest, type VerifyMFARequest as MfaVerifyRequest, type Organization, type RefreshRequest, type ResetPasswordRequest, type SSOConnectionConfig, type SendMagicLinkRequest, type SendSMSCodeRequest, type Session, type SignInRequest, type SignUpRequest, type SocialProviderConfig, type SsoACSRequest, type SsoCallbackRequest, type TokenResponse, type TokenStorage, type UpdateMeRequest, type UpdateOrganizationRequest as UpdateOrgRequest, type UpdateOrganizationRequest, type User, type VerifyEmailRequest, type VerifyMFARequest, type VerifyMagicLinkRequest, type VerifyRecoveryCodeRequest, type VerifySMSCodeRequest, base64urlToBuffer, bufferToBase64url, prepareCreationOptions, prepareRequestOptions, serializeCredential };