@authsome/ui-core 0.1.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/README.md +164 -0
- package/dist/adapters/index.d.mts +57 -0
- package/dist/adapters/index.d.ts +57 -0
- package/dist/adapters/index.js +94 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/index.mjs +92 -0
- package/dist/adapters/index.mjs.map +1 -0
- package/dist/index.d.mts +540 -0
- package/dist/index.d.ts +540 -0
- package/dist/index.js +1453 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1415 -0
- package/dist/index.mjs.map +1 -0
- package/dist/provider-DXf_a2WT.d.mts +457 -0
- package/dist/provider-DXf_a2WT.d.ts +457 -0
- package/dist/types/index.d.mts +98 -0
- package/dist/types/index.d.ts +98 -0
- package/dist/types/index.js +180 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/index.mjs +170 -0
- package/dist/types/index.mjs.map +1 -0
- package/package.json +57 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
import { A as AuthErrorType, a as AuthError, V as ValidationError, 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-DXf_a2WT.mjs';
|
|
2
|
+
export { y as AuthResponse, v as AuthState, w as OAuthConfig, z as ProviderConfig, x as TwoFactorConfig } from './provider-DXf_a2WT.mjs';
|
|
3
|
+
import { Storage, Observable, Unsubscribe } from './types/index.mjs';
|
|
4
|
+
export { Listener, LocalStorageAdapter, MemoryStorageAdapter, SessionStorageAdapter } from './types/index.mjs';
|
|
5
|
+
export { BaseAuthProvider } from './adapters/index.mjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Error handling utilities
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Create an auth error
|
|
13
|
+
*
|
|
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
|
|
27
|
+
*/
|
|
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
|
+
* Validation utilities
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Validate email address
|
|
44
|
+
*/
|
|
45
|
+
declare function validateEmail(email: string): ValidationError | null;
|
|
46
|
+
/**
|
|
47
|
+
* Validate password
|
|
48
|
+
*/
|
|
49
|
+
declare function validatePassword(password: string, options?: {
|
|
50
|
+
minLength?: number;
|
|
51
|
+
requireUppercase?: boolean;
|
|
52
|
+
requireLowercase?: boolean;
|
|
53
|
+
requireNumber?: boolean;
|
|
54
|
+
requireSpecial?: boolean;
|
|
55
|
+
}): ValidationError | null;
|
|
56
|
+
/**
|
|
57
|
+
* Validate phone number
|
|
58
|
+
*/
|
|
59
|
+
declare function validatePhone(phone: string): ValidationError | null;
|
|
60
|
+
/**
|
|
61
|
+
* Validate username
|
|
62
|
+
*/
|
|
63
|
+
declare function validateUsername(username: string): ValidationError | null;
|
|
64
|
+
/**
|
|
65
|
+
* Validate 2FA code
|
|
66
|
+
*/
|
|
67
|
+
declare function validate2FACode(code: string): ValidationError | null;
|
|
68
|
+
/**
|
|
69
|
+
* Validate required field
|
|
70
|
+
*/
|
|
71
|
+
declare function validateRequired(value: unknown, fieldName: string): ValidationError | null;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Token management utilities
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Token manager class
|
|
79
|
+
*/
|
|
80
|
+
declare class TokenManager {
|
|
81
|
+
private storage;
|
|
82
|
+
constructor(storage?: Storage);
|
|
83
|
+
/**
|
|
84
|
+
* Get access token
|
|
85
|
+
*/
|
|
86
|
+
getToken(): Promise<string | null>;
|
|
87
|
+
/**
|
|
88
|
+
* Set access token
|
|
89
|
+
*/
|
|
90
|
+
setToken(token: string): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Remove access token
|
|
93
|
+
*/
|
|
94
|
+
removeToken(): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Get refresh token
|
|
97
|
+
*/
|
|
98
|
+
getRefreshToken(): Promise<string | null>;
|
|
99
|
+
/**
|
|
100
|
+
* Set refresh token
|
|
101
|
+
*/
|
|
102
|
+
setRefreshToken(token: string): Promise<void>;
|
|
103
|
+
/**
|
|
104
|
+
* Remove refresh token
|
|
105
|
+
*/
|
|
106
|
+
removeRefreshToken(): Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* Clear all tokens
|
|
109
|
+
*/
|
|
110
|
+
clearTokens(): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Check if token is expired
|
|
113
|
+
*/
|
|
114
|
+
isTokenExpired(token: string): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Decode JWT token (without verification)
|
|
117
|
+
*/
|
|
118
|
+
private decodeToken;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Auth client configuration
|
|
123
|
+
*/
|
|
124
|
+
interface AuthClientConfig {
|
|
125
|
+
provider: AuthProvider;
|
|
126
|
+
autoRefresh?: boolean;
|
|
127
|
+
refreshInterval?: number;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Auth client class
|
|
131
|
+
*/
|
|
132
|
+
declare class AuthClient {
|
|
133
|
+
private provider;
|
|
134
|
+
private autoRefresh;
|
|
135
|
+
private refreshInterval;
|
|
136
|
+
private refreshTimer?;
|
|
137
|
+
readonly state: Observable<AuthContext>;
|
|
138
|
+
constructor(config: AuthClientConfig);
|
|
139
|
+
/**
|
|
140
|
+
* Initialize the auth client
|
|
141
|
+
*/
|
|
142
|
+
initialize(): Promise<void>;
|
|
143
|
+
/**
|
|
144
|
+
* Sign in with credentials
|
|
145
|
+
*/
|
|
146
|
+
signIn(request: SignInRequest): Promise<void>;
|
|
147
|
+
/**
|
|
148
|
+
* Sign up with credentials
|
|
149
|
+
*/
|
|
150
|
+
signUp(request: SignUpRequest): Promise<void>;
|
|
151
|
+
/**
|
|
152
|
+
* Sign out
|
|
153
|
+
*/
|
|
154
|
+
signOut(): Promise<void>;
|
|
155
|
+
/**
|
|
156
|
+
* Update user profile
|
|
157
|
+
*/
|
|
158
|
+
updateUser(request: UpdateUserRequest): Promise<void>;
|
|
159
|
+
/**
|
|
160
|
+
* Change password
|
|
161
|
+
*/
|
|
162
|
+
changePassword(request: PasswordChangeRequest): Promise<void>;
|
|
163
|
+
/**
|
|
164
|
+
* Request password reset
|
|
165
|
+
*/
|
|
166
|
+
requestPasswordReset(request: PasswordResetRequest): Promise<void>;
|
|
167
|
+
/**
|
|
168
|
+
* Confirm password reset
|
|
169
|
+
*/
|
|
170
|
+
confirmPasswordReset(request: PasswordResetConfirmRequest): Promise<void>;
|
|
171
|
+
/**
|
|
172
|
+
* Get OAuth sign in URL
|
|
173
|
+
*/
|
|
174
|
+
getOAuthUrl(request: OAuthSignInRequest): Promise<string>;
|
|
175
|
+
/**
|
|
176
|
+
* Handle OAuth callback
|
|
177
|
+
*/
|
|
178
|
+
handleOAuthCallback(request: OAuthCallbackRequest): Promise<void>;
|
|
179
|
+
/**
|
|
180
|
+
* Get available OAuth providers
|
|
181
|
+
*/
|
|
182
|
+
getOAuthProviders(): Promise<OAuthProvider[]>;
|
|
183
|
+
/**
|
|
184
|
+
* Send magic link
|
|
185
|
+
*/
|
|
186
|
+
sendMagicLink(request: MagicLinkRequest): Promise<void>;
|
|
187
|
+
/**
|
|
188
|
+
* Verify magic link
|
|
189
|
+
*/
|
|
190
|
+
verifyMagicLink(request: MagicLinkVerifyRequest): Promise<void>;
|
|
191
|
+
/**
|
|
192
|
+
* Send phone verification code
|
|
193
|
+
*/
|
|
194
|
+
sendPhoneCode(request: PhoneAuthRequest): Promise<void>;
|
|
195
|
+
/**
|
|
196
|
+
* Verify phone code
|
|
197
|
+
*/
|
|
198
|
+
verifyPhoneCode(request: PhoneVerifyRequest): Promise<void>;
|
|
199
|
+
/**
|
|
200
|
+
* Setup 2FA
|
|
201
|
+
*/
|
|
202
|
+
setupTwoFactor(request: TwoFactorSetupRequest): Promise<TwoFactorSetupResponse>;
|
|
203
|
+
/**
|
|
204
|
+
* Verify 2FA code
|
|
205
|
+
*/
|
|
206
|
+
verifyTwoFactor(request: TwoFactorVerifyRequest): Promise<void>;
|
|
207
|
+
/**
|
|
208
|
+
* Disable 2FA
|
|
209
|
+
*/
|
|
210
|
+
disableTwoFactor(): Promise<void>;
|
|
211
|
+
/**
|
|
212
|
+
* Get 2FA status
|
|
213
|
+
*/
|
|
214
|
+
getTwoFactorStatus(): Promise<TwoFactorMethod[]>;
|
|
215
|
+
/**
|
|
216
|
+
* Register passkey
|
|
217
|
+
*/
|
|
218
|
+
registerPasskey(request: PasskeyRegisterRequest): Promise<PasskeyCredential>;
|
|
219
|
+
/**
|
|
220
|
+
* Authenticate with passkey
|
|
221
|
+
*/
|
|
222
|
+
authenticatePasskey(request: PasskeyAuthRequest): Promise<void>;
|
|
223
|
+
/**
|
|
224
|
+
* List passkeys
|
|
225
|
+
*/
|
|
226
|
+
listPasskeys(): Promise<PasskeyCredential[]>;
|
|
227
|
+
/**
|
|
228
|
+
* Delete passkey
|
|
229
|
+
*/
|
|
230
|
+
deletePasskey(credentialId: string): Promise<void>;
|
|
231
|
+
/**
|
|
232
|
+
* Get all organizations the user belongs to
|
|
233
|
+
* Only available if the provider supports organizations
|
|
234
|
+
*/
|
|
235
|
+
getOrganizations(): Promise<Organization[]>;
|
|
236
|
+
/**
|
|
237
|
+
* Get the currently active organization
|
|
238
|
+
* Only available if the provider supports organizations
|
|
239
|
+
*/
|
|
240
|
+
getActiveOrganization(): Promise<Organization | null>;
|
|
241
|
+
/**
|
|
242
|
+
* Set the active organization and refresh user state
|
|
243
|
+
* Only available if the provider supports organizations
|
|
244
|
+
*/
|
|
245
|
+
setActiveOrganization(organizationId: string): Promise<void>;
|
|
246
|
+
/**
|
|
247
|
+
* Get organization memberships with roles and permissions
|
|
248
|
+
* Only available if the provider supports organizations
|
|
249
|
+
*/
|
|
250
|
+
getOrganizationMemberships(): Promise<OrganizationMembership[]>;
|
|
251
|
+
/**
|
|
252
|
+
* Check if the provider supports organizations
|
|
253
|
+
*/
|
|
254
|
+
supportsOrganizations(): boolean;
|
|
255
|
+
/**
|
|
256
|
+
* Refresh session
|
|
257
|
+
*/
|
|
258
|
+
refreshSession(): Promise<void>;
|
|
259
|
+
/**
|
|
260
|
+
* Get current user
|
|
261
|
+
*/
|
|
262
|
+
getUser(): User | null;
|
|
263
|
+
/**
|
|
264
|
+
* Get current session
|
|
265
|
+
*/
|
|
266
|
+
getSession(): Session | null;
|
|
267
|
+
/**
|
|
268
|
+
* Check if authenticated
|
|
269
|
+
*/
|
|
270
|
+
isAuthenticated(): boolean;
|
|
271
|
+
/**
|
|
272
|
+
* Get current error
|
|
273
|
+
*/
|
|
274
|
+
getError(): AuthError | null;
|
|
275
|
+
/**
|
|
276
|
+
* Clear error
|
|
277
|
+
*/
|
|
278
|
+
clearError(): void;
|
|
279
|
+
/**
|
|
280
|
+
* Subscribe to auth state changes
|
|
281
|
+
*/
|
|
282
|
+
subscribe(listener: (context: AuthContext) => void): Unsubscribe;
|
|
283
|
+
/**
|
|
284
|
+
* Cleanup resources
|
|
285
|
+
*/
|
|
286
|
+
destroy(): void;
|
|
287
|
+
private updateState;
|
|
288
|
+
private setLoading;
|
|
289
|
+
private handleError;
|
|
290
|
+
private startAutoRefresh;
|
|
291
|
+
private stopAutoRefresh;
|
|
292
|
+
private createUnsupportedError;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Authentication flow types and state machine
|
|
297
|
+
*/
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Available authentication flow steps
|
|
301
|
+
*/
|
|
302
|
+
declare enum FlowStep {
|
|
303
|
+
SIGN_IN = "sign_in",
|
|
304
|
+
SIGN_UP = "sign_up",
|
|
305
|
+
EMAIL_PASSWORD_SIGN_IN = "email_password_sign_in",
|
|
306
|
+
EMAIL_PASSWORD_SIGN_UP = "email_password_sign_up",
|
|
307
|
+
OAUTH_SELECT = "oauth_select",
|
|
308
|
+
OAUTH_CALLBACK = "oauth_callback",
|
|
309
|
+
MAGIC_LINK_REQUEST = "magic_link_request",
|
|
310
|
+
MAGIC_LINK_VERIFY = "magic_link_verify",
|
|
311
|
+
MAGIC_LINK_SENT = "magic_link_sent",
|
|
312
|
+
PHONE_REQUEST = "phone_request",
|
|
313
|
+
PHONE_VERIFY = "phone_verify",
|
|
314
|
+
USERNAME_SIGN_IN = "username_sign_in",
|
|
315
|
+
USERNAME_SIGN_UP = "username_sign_up",
|
|
316
|
+
PASSKEY_REGISTER = "passkey_register",
|
|
317
|
+
PASSKEY_AUTHENTICATE = "passkey_authenticate",
|
|
318
|
+
MFA_REQUIRED = "mfa_required",
|
|
319
|
+
MFA_SETUP = "mfa_setup",
|
|
320
|
+
MFA_VERIFY = "mfa_verify",
|
|
321
|
+
MFA_SELECT_METHOD = "mfa_select_method",
|
|
322
|
+
EMAIL_VERIFICATION_REQUIRED = "email_verification_required",
|
|
323
|
+
EMAIL_VERIFICATION_SENT = "email_verification_sent",
|
|
324
|
+
PHONE_VERIFICATION_REQUIRED = "phone_verification_required",
|
|
325
|
+
PASSWORD_RESET_REQUEST = "password_reset_request",
|
|
326
|
+
PASSWORD_RESET_SENT = "password_reset_sent",
|
|
327
|
+
PASSWORD_RESET_CONFIRM = "password_reset_confirm",
|
|
328
|
+
PASSWORD_CHANGE = "password_change",
|
|
329
|
+
PROFILE_UPDATE = "profile_update",
|
|
330
|
+
PROFILE_COMPLETE = "profile_complete",
|
|
331
|
+
SUCCESS = "success",
|
|
332
|
+
ERROR = "error",
|
|
333
|
+
CANCELLED = "cancelled"
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Flow state data that can be passed between steps
|
|
337
|
+
*/
|
|
338
|
+
interface FlowState {
|
|
339
|
+
currentStep: FlowStep;
|
|
340
|
+
previousStep?: FlowStep;
|
|
341
|
+
user?: User;
|
|
342
|
+
session?: Session;
|
|
343
|
+
email?: string;
|
|
344
|
+
phone?: string;
|
|
345
|
+
username?: string;
|
|
346
|
+
mfaRequired?: boolean;
|
|
347
|
+
mfaMethods?: TwoFactorMethod[];
|
|
348
|
+
mfaToken?: string;
|
|
349
|
+
oauthProvider?: OAuthProvider;
|
|
350
|
+
oauthRedirectUrl?: string;
|
|
351
|
+
verificationRequired?: boolean;
|
|
352
|
+
verificationToken?: string;
|
|
353
|
+
verificationSent?: boolean;
|
|
354
|
+
error?: AuthError;
|
|
355
|
+
metadata?: Record<string, unknown>;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Flow transition result
|
|
359
|
+
*/
|
|
360
|
+
interface FlowTransition {
|
|
361
|
+
nextStep: FlowStep;
|
|
362
|
+
state: Partial<FlowState>;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Flow configuration for a specific authentication journey
|
|
366
|
+
*/
|
|
367
|
+
interface FlowConfig {
|
|
368
|
+
name: string;
|
|
369
|
+
description?: string;
|
|
370
|
+
initialStep: FlowStep;
|
|
371
|
+
allowedSteps: FlowStep[];
|
|
372
|
+
transitions: {
|
|
373
|
+
[key in FlowStep]?: {
|
|
374
|
+
onSuccess?: FlowStep;
|
|
375
|
+
onError?: FlowStep;
|
|
376
|
+
onCancel?: FlowStep;
|
|
377
|
+
onBack?: FlowStep;
|
|
378
|
+
conditions?: Array<{
|
|
379
|
+
when: (state: FlowState) => boolean;
|
|
380
|
+
then: FlowStep;
|
|
381
|
+
}>;
|
|
382
|
+
};
|
|
383
|
+
};
|
|
384
|
+
onStepChange?: (step: FlowStep, state: FlowState) => void;
|
|
385
|
+
onComplete?: (user: User, session: Session) => void;
|
|
386
|
+
onError?: (error: AuthError, state: FlowState) => void;
|
|
387
|
+
onCancel?: (state: FlowState) => void;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Predefined flow configurations
|
|
391
|
+
*/
|
|
392
|
+
declare enum FlowConfigType {
|
|
393
|
+
SIMPLE_SIGN_IN = "simple_sign_in",
|
|
394
|
+
SIMPLE_SIGN_UP = "simple_sign_up",
|
|
395
|
+
SIGN_UP_WITH_EMAIL_VERIFICATION = "sign_up_with_email_verification",
|
|
396
|
+
SIGN_IN_WITH_MFA = "sign_in_with_mfa",
|
|
397
|
+
OAUTH_SIGN_IN = "oauth_sign_in",
|
|
398
|
+
MAGIC_LINK_FLOW = "magic_link_flow",
|
|
399
|
+
PHONE_AUTH_FLOW = "phone_auth_flow",
|
|
400
|
+
COMPLETE_SIGN_UP_FLOW = "complete_sign_up_flow",// signup → verify email → complete profile
|
|
401
|
+
SECURE_SIGN_IN_FLOW = "secure_sign_in_flow",// signin → MFA → success
|
|
402
|
+
PASSWORD_RESET_FLOW = "password_reset_flow",
|
|
403
|
+
CUSTOM = "custom"
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Flow action types
|
|
407
|
+
*/
|
|
408
|
+
declare enum FlowAction {
|
|
409
|
+
START = "start",
|
|
410
|
+
NEXT = "next",
|
|
411
|
+
BACK = "back",
|
|
412
|
+
CANCEL = "cancel",
|
|
413
|
+
ERROR = "error",
|
|
414
|
+
RESET = "reset"
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Flow event for state machine
|
|
418
|
+
*/
|
|
419
|
+
interface FlowEvent {
|
|
420
|
+
action: FlowAction;
|
|
421
|
+
data?: Partial<FlowState>;
|
|
422
|
+
error?: AuthError;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Authentication flow state machine engine
|
|
427
|
+
*/
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Flow engine that manages authentication flow state transitions
|
|
431
|
+
*/
|
|
432
|
+
declare class FlowEngine {
|
|
433
|
+
private config;
|
|
434
|
+
private state;
|
|
435
|
+
private history;
|
|
436
|
+
constructor(config: FlowConfig, initialState?: Partial<FlowState>);
|
|
437
|
+
/**
|
|
438
|
+
* Get current flow state
|
|
439
|
+
*/
|
|
440
|
+
getState(): FlowState;
|
|
441
|
+
/**
|
|
442
|
+
* Get current step
|
|
443
|
+
*/
|
|
444
|
+
getCurrentStep(): FlowStep;
|
|
445
|
+
/**
|
|
446
|
+
* Check if step is allowed in this flow
|
|
447
|
+
*/
|
|
448
|
+
isStepAllowed(step: FlowStep): boolean;
|
|
449
|
+
/**
|
|
450
|
+
* Transition to next step based on action
|
|
451
|
+
*/
|
|
452
|
+
transition(event: FlowEvent): Promise<FlowState>;
|
|
453
|
+
/**
|
|
454
|
+
* Start or restart the flow
|
|
455
|
+
*/
|
|
456
|
+
private handleStart;
|
|
457
|
+
/**
|
|
458
|
+
* Move to next step
|
|
459
|
+
*/
|
|
460
|
+
private handleNext;
|
|
461
|
+
/**
|
|
462
|
+
* Go back to previous step
|
|
463
|
+
*/
|
|
464
|
+
private handleBack;
|
|
465
|
+
/**
|
|
466
|
+
* Cancel the flow
|
|
467
|
+
*/
|
|
468
|
+
private handleCancel;
|
|
469
|
+
/**
|
|
470
|
+
* Handle error in flow
|
|
471
|
+
*/
|
|
472
|
+
private handleError;
|
|
473
|
+
/**
|
|
474
|
+
* Reset flow to initial state
|
|
475
|
+
*/
|
|
476
|
+
private handleReset;
|
|
477
|
+
/**
|
|
478
|
+
* Move to a specific step
|
|
479
|
+
*/
|
|
480
|
+
private moveToStep;
|
|
481
|
+
/**
|
|
482
|
+
* Get flow history
|
|
483
|
+
*/
|
|
484
|
+
getHistory(): FlowStep[];
|
|
485
|
+
/**
|
|
486
|
+
* Check if can go back
|
|
487
|
+
*/
|
|
488
|
+
canGoBack(): boolean;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Predefined flow configurations
|
|
493
|
+
*/
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Simple sign-in flow (email/password only)
|
|
497
|
+
*/
|
|
498
|
+
declare const simpleSignInFlow: FlowConfig;
|
|
499
|
+
/**
|
|
500
|
+
* Sign-in with MFA support
|
|
501
|
+
*/
|
|
502
|
+
declare const signInWithMFAFlow: FlowConfig;
|
|
503
|
+
/**
|
|
504
|
+
* Complete sign-up flow with email verification
|
|
505
|
+
*/
|
|
506
|
+
declare const completeSignUpFlow: FlowConfig;
|
|
507
|
+
/**
|
|
508
|
+
* Magic link authentication flow
|
|
509
|
+
*/
|
|
510
|
+
declare const magicLinkFlow: FlowConfig;
|
|
511
|
+
/**
|
|
512
|
+
* Phone authentication flow
|
|
513
|
+
*/
|
|
514
|
+
declare const phoneAuthFlow: FlowConfig;
|
|
515
|
+
/**
|
|
516
|
+
* OAuth sign-in flow
|
|
517
|
+
*/
|
|
518
|
+
declare const oauthSignInFlow: FlowConfig;
|
|
519
|
+
/**
|
|
520
|
+
* Password reset flow
|
|
521
|
+
*/
|
|
522
|
+
declare const passwordResetFlow: FlowConfig;
|
|
523
|
+
/**
|
|
524
|
+
* Get predefined flow configuration by type
|
|
525
|
+
*/
|
|
526
|
+
declare function getFlowConfig(type: FlowConfigType): FlowConfig;
|
|
527
|
+
/**
|
|
528
|
+
* Export all predefined flows
|
|
529
|
+
*/
|
|
530
|
+
declare const predefinedFlows: {
|
|
531
|
+
simple_sign_in: FlowConfig;
|
|
532
|
+
sign_in_with_mfa: FlowConfig;
|
|
533
|
+
complete_sign_up_flow: FlowConfig;
|
|
534
|
+
magic_link_flow: FlowConfig;
|
|
535
|
+
phone_auth_flow: FlowConfig;
|
|
536
|
+
oauth_sign_in: FlowConfig;
|
|
537
|
+
password_reset_flow: FlowConfig;
|
|
538
|
+
};
|
|
539
|
+
|
|
540
|
+
export { AuthClient, type AuthClientConfig, AuthContext, AuthError, AuthErrorType, AuthProvider, 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, getFlowConfig, isAuthError, isMFARequiredError, isNetworkError, isUnauthenticatedError, magicLinkFlow, oauthSignInFlow, passwordResetFlow, phoneAuthFlow, predefinedFlows, signInWithMFAFlow, simpleSignInFlow, toAuthError, validate2FACode, validateEmail, validatePassword, validatePhone, validateRequired, validateUsername };
|