@authsome/ui-core 0.1.8 → 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 +1140 -618
- package/dist/index.js +1458 -1515
- package/dist/index.js.map +1 -1
- package/package.json +22 -45
- package/README.md +0 -166
- package/dist/adapters/index.d.mts +0 -65
- package/dist/adapters/index.d.ts +0 -65
- package/dist/adapters/index.js +0 -94
- package/dist/adapters/index.js.map +0 -1
- package/dist/adapters/index.mjs +0 -92
- package/dist/adapters/index.mjs.map +0 -1
- package/dist/index.d.mts +0 -772
- package/dist/index.mjs +0 -1734
- package/dist/index.mjs.map +0 -1
- package/dist/provider-S9ZY5hsp.d.mts +0 -787
- package/dist/provider-S9ZY5hsp.d.ts +0 -787
- package/dist/types/index.d.mts +0 -98
- package/dist/types/index.d.ts +0 -98
- package/dist/types/index.js +0 -180
- package/dist/types/index.js.map +0 -1
- package/dist/types/index.mjs +0 -170
- package/dist/types/index.mjs.map +0 -1
|
@@ -1,787 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core authentication types and interfaces
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Authentication state enum
|
|
6
|
-
*/
|
|
7
|
-
declare enum AuthState {
|
|
8
|
-
AUTHENTICATED = "authenticated",
|
|
9
|
-
UNAUTHENTICATED = "unauthenticated",
|
|
10
|
-
LOADING = "loading",
|
|
11
|
-
ERROR = "error"
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* User profile interface
|
|
15
|
-
*/
|
|
16
|
-
interface User {
|
|
17
|
-
id: string;
|
|
18
|
-
email?: string;
|
|
19
|
-
username?: string;
|
|
20
|
-
phone?: string;
|
|
21
|
-
emailVerified?: boolean;
|
|
22
|
-
phoneVerified?: boolean;
|
|
23
|
-
name?: string;
|
|
24
|
-
firstName?: string;
|
|
25
|
-
lastName?: string;
|
|
26
|
-
avatar?: string;
|
|
27
|
-
metadata?: Record<string, unknown>;
|
|
28
|
-
createdAt?: Date;
|
|
29
|
-
updatedAt?: Date;
|
|
30
|
-
organizationId?: string;
|
|
31
|
-
organizationRole?: string;
|
|
32
|
-
organizationMemberships?: OrganizationMembership[];
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Session interface
|
|
36
|
-
*/
|
|
37
|
-
interface Session {
|
|
38
|
-
id: string;
|
|
39
|
-
userId: string;
|
|
40
|
-
token: string;
|
|
41
|
-
expiresAt?: Date;
|
|
42
|
-
createdAt?: Date;
|
|
43
|
-
metadata?: Record<string, unknown>;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Session data with user and session combined
|
|
47
|
-
* Used for efficient retrieval of both user and session in one call
|
|
48
|
-
*/
|
|
49
|
-
interface SessionData {
|
|
50
|
-
user: User;
|
|
51
|
-
session: Session;
|
|
52
|
-
expiresAt: number;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Auth error types
|
|
56
|
-
*/
|
|
57
|
-
declare enum AuthErrorType {
|
|
58
|
-
INVALID_CREDENTIALS = "invalid_credentials",
|
|
59
|
-
USER_NOT_FOUND = "user_not_found",
|
|
60
|
-
USER_ALREADY_EXISTS = "user_already_exists",
|
|
61
|
-
INVALID_TOKEN = "invalid_token",
|
|
62
|
-
TOKEN_EXPIRED = "token_expired",
|
|
63
|
-
NETWORK_ERROR = "network_error",
|
|
64
|
-
VALIDATION_ERROR = "validation_error",
|
|
65
|
-
MFA_REQUIRED = "mfa_required",
|
|
66
|
-
EMAIL_NOT_VERIFIED = "email_not_verified",
|
|
67
|
-
PHONE_NOT_VERIFIED = "phone_not_verified",
|
|
68
|
-
RATE_LIMIT_EXCEEDED = "rate_limit_exceeded",
|
|
69
|
-
UNKNOWN_ERROR = "unknown_error"
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Auth error class
|
|
73
|
-
*
|
|
74
|
-
* Extends Error to provide proper error handling with auth-specific context
|
|
75
|
-
*/
|
|
76
|
-
declare class AuthError extends Error {
|
|
77
|
-
readonly type: AuthErrorType;
|
|
78
|
-
readonly details?: Record<string, unknown>;
|
|
79
|
-
readonly code?: string | number;
|
|
80
|
-
readonly originalError?: unknown;
|
|
81
|
-
constructor(message: string, type?: AuthErrorType, options?: {
|
|
82
|
-
details?: Record<string, unknown>;
|
|
83
|
-
code?: string | number;
|
|
84
|
-
originalError?: unknown;
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Auth context state
|
|
89
|
-
*/
|
|
90
|
-
interface AuthContext {
|
|
91
|
-
state: AuthState;
|
|
92
|
-
user: User | null;
|
|
93
|
-
session: Session | null;
|
|
94
|
-
error: AuthError | null;
|
|
95
|
-
isAuthenticated: boolean;
|
|
96
|
-
isLoading: boolean;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* OAuth provider types
|
|
100
|
-
*/
|
|
101
|
-
declare enum OAuthProvider {
|
|
102
|
-
GOOGLE = "google",
|
|
103
|
-
GITHUB = "github",
|
|
104
|
-
FACEBOOK = "facebook",
|
|
105
|
-
TWITTER = "twitter",
|
|
106
|
-
MICROSOFT = "microsoft",
|
|
107
|
-
APPLE = "apple",
|
|
108
|
-
LINKEDIN = "linkedin",
|
|
109
|
-
DISCORD = "discord"
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* OAuth configuration
|
|
113
|
-
*/
|
|
114
|
-
interface OAuthConfig {
|
|
115
|
-
provider: OAuthProvider;
|
|
116
|
-
clientId: string;
|
|
117
|
-
redirectUri: string;
|
|
118
|
-
scope?: string[];
|
|
119
|
-
state?: string;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* 2FA method types
|
|
123
|
-
*/
|
|
124
|
-
declare enum TwoFactorMethod {
|
|
125
|
-
TOTP = "totp",
|
|
126
|
-
SMS = "sms",
|
|
127
|
-
EMAIL = "email",
|
|
128
|
-
BACKUP_CODE = "backup_code"
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* 2FA configuration
|
|
132
|
-
*/
|
|
133
|
-
interface TwoFactorConfig {
|
|
134
|
-
method: TwoFactorMethod;
|
|
135
|
-
enabled: boolean;
|
|
136
|
-
verified?: boolean;
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Passkey/WebAuthn types
|
|
140
|
-
*/
|
|
141
|
-
interface PasskeyCredential {
|
|
142
|
-
id: string;
|
|
143
|
-
name?: string;
|
|
144
|
-
createdAt?: Date;
|
|
145
|
-
lastUsedAt?: Date;
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Validation error
|
|
149
|
-
*/
|
|
150
|
-
interface ValidationError {
|
|
151
|
-
field: string;
|
|
152
|
-
message: string;
|
|
153
|
-
code?: string;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Organization interface
|
|
157
|
-
*/
|
|
158
|
-
interface Organization {
|
|
159
|
-
id: string;
|
|
160
|
-
name: string;
|
|
161
|
-
slug: string;
|
|
162
|
-
logoUrl?: string;
|
|
163
|
-
createdAt?: Date;
|
|
164
|
-
metadata?: Record<string, unknown>;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Organization membership interface
|
|
168
|
-
*/
|
|
169
|
-
interface OrganizationMembership {
|
|
170
|
-
organization: Organization;
|
|
171
|
-
role: 'owner' | 'admin' | 'member';
|
|
172
|
-
permissions?: string[];
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Sign in request
|
|
177
|
-
*/
|
|
178
|
-
interface SignInRequest {
|
|
179
|
-
email?: string;
|
|
180
|
-
username?: string;
|
|
181
|
-
phone?: string;
|
|
182
|
-
password?: string;
|
|
183
|
-
remember?: boolean;
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Sign up request
|
|
187
|
-
*/
|
|
188
|
-
interface SignUpRequest {
|
|
189
|
-
email?: string;
|
|
190
|
-
username?: string;
|
|
191
|
-
phone?: string;
|
|
192
|
-
password: string;
|
|
193
|
-
name?: string;
|
|
194
|
-
firstName?: string;
|
|
195
|
-
lastName?: string;
|
|
196
|
-
metadata?: Record<string, unknown>;
|
|
197
|
-
[key: string]: unknown;
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* OAuth sign in request
|
|
201
|
-
*/
|
|
202
|
-
interface OAuthSignInRequest {
|
|
203
|
-
provider: OAuthProvider;
|
|
204
|
-
redirectUri?: string;
|
|
205
|
-
state?: string;
|
|
206
|
-
scope?: string[];
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* OAuth callback request
|
|
210
|
-
*/
|
|
211
|
-
interface OAuthCallbackRequest {
|
|
212
|
-
provider: OAuthProvider;
|
|
213
|
-
code: string;
|
|
214
|
-
state?: string;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Magic link request
|
|
218
|
-
*/
|
|
219
|
-
interface MagicLinkRequest {
|
|
220
|
-
email: string;
|
|
221
|
-
redirectUri?: string;
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Magic link verify request
|
|
225
|
-
*/
|
|
226
|
-
interface MagicLinkVerifyRequest {
|
|
227
|
-
token: string;
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Phone auth request
|
|
231
|
-
*/
|
|
232
|
-
interface PhoneAuthRequest {
|
|
233
|
-
phone: string;
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Phone verify request
|
|
237
|
-
*/
|
|
238
|
-
interface PhoneVerifyRequest {
|
|
239
|
-
phone: string;
|
|
240
|
-
code: string;
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* 2FA setup request
|
|
244
|
-
*/
|
|
245
|
-
interface TwoFactorSetupRequest {
|
|
246
|
-
method: TwoFactorMethod;
|
|
247
|
-
phone?: string;
|
|
248
|
-
email?: string;
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* 2FA setup response
|
|
252
|
-
*/
|
|
253
|
-
interface TwoFactorSetupResponse {
|
|
254
|
-
method: TwoFactorMethod;
|
|
255
|
-
secret?: string;
|
|
256
|
-
qrCode?: string;
|
|
257
|
-
backupCodes?: string[];
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* 2FA verify request
|
|
261
|
-
*/
|
|
262
|
-
interface TwoFactorVerifyRequest {
|
|
263
|
-
code: string;
|
|
264
|
-
method?: TwoFactorMethod;
|
|
265
|
-
remember?: boolean;
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* Passkey registration request
|
|
269
|
-
*/
|
|
270
|
-
interface PasskeyRegisterRequest {
|
|
271
|
-
name?: string;
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Passkey authentication request
|
|
275
|
-
*/
|
|
276
|
-
interface PasskeyAuthRequest {
|
|
277
|
-
credentialId?: string;
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Password reset request
|
|
281
|
-
*/
|
|
282
|
-
interface PasswordResetRequest {
|
|
283
|
-
email: string;
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* Password reset confirm request
|
|
287
|
-
*/
|
|
288
|
-
interface PasswordResetConfirmRequest {
|
|
289
|
-
token: string;
|
|
290
|
-
password: string;
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Password change request
|
|
294
|
-
*/
|
|
295
|
-
interface PasswordChangeRequest {
|
|
296
|
-
currentPassword: string;
|
|
297
|
-
newPassword: string;
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* Update user request
|
|
301
|
-
*/
|
|
302
|
-
interface UpdateUserRequest {
|
|
303
|
-
name?: string;
|
|
304
|
-
firstName?: string;
|
|
305
|
-
lastName?: string;
|
|
306
|
-
avatar?: string;
|
|
307
|
-
metadata?: Record<string, unknown>;
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* Field validation rules for dynamic signup fields
|
|
311
|
-
*/
|
|
312
|
-
interface FieldValidation {
|
|
313
|
-
required?: boolean;
|
|
314
|
-
minLength?: number;
|
|
315
|
-
maxLength?: number;
|
|
316
|
-
min?: number;
|
|
317
|
-
max?: number;
|
|
318
|
-
pattern?: string;
|
|
319
|
-
errorMessage?: string;
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Field type for dynamic signup forms
|
|
323
|
-
*/
|
|
324
|
-
type FieldType = 'text' | 'email' | 'tel' | 'number' | 'select' | 'checkbox' | 'textarea' | 'date' | 'url' | 'password' | 'group';
|
|
325
|
-
/**
|
|
326
|
-
* Dynamic field definition for signup forms
|
|
327
|
-
*/
|
|
328
|
-
interface FieldDefinition {
|
|
329
|
-
name: string;
|
|
330
|
-
label: string;
|
|
331
|
-
type: FieldType;
|
|
332
|
-
placeholder?: string;
|
|
333
|
-
helperText?: string;
|
|
334
|
-
defaultValue?: string | number | boolean;
|
|
335
|
-
options?: Array<{
|
|
336
|
-
value: string;
|
|
337
|
-
label: string;
|
|
338
|
-
}>;
|
|
339
|
-
validation?: FieldValidation;
|
|
340
|
-
/**
|
|
341
|
-
* Nested fields for 'group' type
|
|
342
|
-
* Groups render multiple fields in a horizontal row with a gap
|
|
343
|
-
*/
|
|
344
|
-
fields?: FieldDefinition[];
|
|
345
|
-
/**
|
|
346
|
-
* Gap between fields in a group (CSS gap value)
|
|
347
|
-
* @default '1rem'
|
|
348
|
-
*/
|
|
349
|
-
gap?: string;
|
|
350
|
-
/**
|
|
351
|
-
* Order priority for field positioning
|
|
352
|
-
* Lower numbers appear first. Fields without order are sorted after ordered fields.
|
|
353
|
-
* @default undefined
|
|
354
|
-
*/
|
|
355
|
-
order?: number;
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* Response containing dynamic signup fields
|
|
359
|
-
*/
|
|
360
|
-
interface SignupFieldsResponse {
|
|
361
|
-
fields: FieldDefinition[];
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* Auth response
|
|
365
|
-
*/
|
|
366
|
-
interface AuthResponse {
|
|
367
|
-
user: User;
|
|
368
|
-
session: Session;
|
|
369
|
-
requiresTwoFactor?: boolean;
|
|
370
|
-
twoFactorMethods?: TwoFactorMethod[];
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Provider configuration
|
|
374
|
-
*/
|
|
375
|
-
interface ProviderConfig {
|
|
376
|
-
apiUrl?: string;
|
|
377
|
-
apiKey?: string;
|
|
378
|
-
[key: string]: unknown;
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* Generic request context (framework-agnostic)
|
|
382
|
-
* Used to pass request information to adapters in edge runtime environments
|
|
383
|
-
*/
|
|
384
|
-
interface RequestContext {
|
|
385
|
-
headers?: Record<string, string>;
|
|
386
|
-
cookies?: Record<string, string>;
|
|
387
|
-
url?: string;
|
|
388
|
-
method?: string;
|
|
389
|
-
[key: string]: unknown;
|
|
390
|
-
}
|
|
391
|
-
/**
|
|
392
|
-
* Cookie data to be set by the framework
|
|
393
|
-
* Adapters return this data; the framework is responsible for setting cookies
|
|
394
|
-
*/
|
|
395
|
-
interface CookieData {
|
|
396
|
-
name: string;
|
|
397
|
-
value: string;
|
|
398
|
-
options?: {
|
|
399
|
-
path?: string;
|
|
400
|
-
domain?: string;
|
|
401
|
-
secure?: boolean;
|
|
402
|
-
httpOnly?: boolean;
|
|
403
|
-
sameSite?: 'strict' | 'lax' | 'none';
|
|
404
|
-
maxAge?: number;
|
|
405
|
-
expires?: Date;
|
|
406
|
-
};
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
* Email verification request
|
|
410
|
-
*/
|
|
411
|
-
interface SendVerificationEmailRequest {
|
|
412
|
-
email: string;
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* Verify email request
|
|
416
|
-
*/
|
|
417
|
-
interface VerifyEmailRequest {
|
|
418
|
-
token: string;
|
|
419
|
-
code?: string;
|
|
420
|
-
}
|
|
421
|
-
/**
|
|
422
|
-
* Resend verification email request
|
|
423
|
-
*/
|
|
424
|
-
interface ResendVerificationRequest {
|
|
425
|
-
email: string;
|
|
426
|
-
}
|
|
427
|
-
/**
|
|
428
|
-
* MFA Factor representation
|
|
429
|
-
*/
|
|
430
|
-
interface MFAFactor {
|
|
431
|
-
id: string;
|
|
432
|
-
type: string;
|
|
433
|
-
name: string;
|
|
434
|
-
status: string;
|
|
435
|
-
createdAt: Date;
|
|
436
|
-
metadata?: Record<string, unknown>;
|
|
437
|
-
}
|
|
438
|
-
/**
|
|
439
|
-
* Enroll MFA factor request
|
|
440
|
-
*/
|
|
441
|
-
interface EnrollMFAFactorRequest {
|
|
442
|
-
type: string;
|
|
443
|
-
name: string;
|
|
444
|
-
metadata?: Record<string, unknown>;
|
|
445
|
-
}
|
|
446
|
-
/**
|
|
447
|
-
* Verify MFA factor request
|
|
448
|
-
*/
|
|
449
|
-
interface VerifyMFAFactorRequest {
|
|
450
|
-
factorId: string;
|
|
451
|
-
code: string;
|
|
452
|
-
}
|
|
453
|
-
/**
|
|
454
|
-
* MFA challenge request
|
|
455
|
-
*/
|
|
456
|
-
interface MFAChallengeRequest {
|
|
457
|
-
userId?: string;
|
|
458
|
-
factorTypes?: string[];
|
|
459
|
-
}
|
|
460
|
-
/**
|
|
461
|
-
* MFA challenge response
|
|
462
|
-
*/
|
|
463
|
-
interface MFAChallengeResponse {
|
|
464
|
-
challengeId: string;
|
|
465
|
-
availableFactors: MFAFactor[];
|
|
466
|
-
expiresAt: Date;
|
|
467
|
-
}
|
|
468
|
-
/**
|
|
469
|
-
* Device information
|
|
470
|
-
*/
|
|
471
|
-
interface Device {
|
|
472
|
-
id: string;
|
|
473
|
-
userId: string;
|
|
474
|
-
name?: string;
|
|
475
|
-
type?: string;
|
|
476
|
-
lastUsedAt: Date;
|
|
477
|
-
ipAddress?: string;
|
|
478
|
-
userAgent?: string;
|
|
479
|
-
}
|
|
480
|
-
/**
|
|
481
|
-
* Extended session information with device and location
|
|
482
|
-
*/
|
|
483
|
-
interface SessionInfo extends Session {
|
|
484
|
-
device?: Device;
|
|
485
|
-
location?: string;
|
|
486
|
-
}
|
|
487
|
-
/**
|
|
488
|
-
* Options for listing sessions with filtering and pagination
|
|
489
|
-
*/
|
|
490
|
-
interface ListSessionsOptions {
|
|
491
|
-
/** Filter by active sessions only */
|
|
492
|
-
active?: boolean;
|
|
493
|
-
/** Filter by IP address */
|
|
494
|
-
ipAddress?: string;
|
|
495
|
-
/** Filter by user agent */
|
|
496
|
-
userAgent?: string;
|
|
497
|
-
/** Filter sessions created after this date (ISO string or Date) */
|
|
498
|
-
createdFrom?: string | Date;
|
|
499
|
-
/** Filter sessions created before this date (ISO string or Date) */
|
|
500
|
-
createdTo?: string | Date;
|
|
501
|
-
/** Field to sort by (e.g., 'createdAt', 'lastUsedAt') */
|
|
502
|
-
sortBy?: string;
|
|
503
|
-
/** Sort order */
|
|
504
|
-
sortOrder?: 'asc' | 'desc';
|
|
505
|
-
/** Maximum number of sessions to return (default: 50) */
|
|
506
|
-
limit?: number;
|
|
507
|
-
/** Number of sessions to skip for pagination (default: 0) */
|
|
508
|
-
offset?: number;
|
|
509
|
-
}
|
|
510
|
-
/**
|
|
511
|
-
* Paginated response for session listing
|
|
512
|
-
*/
|
|
513
|
-
interface ListSessionsResponse {
|
|
514
|
-
/** Array of session information */
|
|
515
|
-
sessions: SessionInfo[];
|
|
516
|
-
/** Total number of sessions matching the filter */
|
|
517
|
-
total: number;
|
|
518
|
-
/** Current page number */
|
|
519
|
-
page: number;
|
|
520
|
-
/** Total number of pages */
|
|
521
|
-
totalPages: number;
|
|
522
|
-
/** Number of sessions per page */
|
|
523
|
-
limit: number;
|
|
524
|
-
}
|
|
525
|
-
/**
|
|
526
|
-
* Auth provider interface
|
|
527
|
-
*
|
|
528
|
-
* This interface defines the contract that all auth providers must implement.
|
|
529
|
-
* Providers can be for different backends like AuthSome, Clerk, Supabase, etc.
|
|
530
|
-
*/
|
|
531
|
-
interface AuthProvider {
|
|
532
|
-
/**
|
|
533
|
-
* Provider name/identifier
|
|
534
|
-
*/
|
|
535
|
-
readonly name: string;
|
|
536
|
-
/**
|
|
537
|
-
* Initialize the provider
|
|
538
|
-
*/
|
|
539
|
-
initialize(config: ProviderConfig): Promise<void>;
|
|
540
|
-
/**
|
|
541
|
-
* Sign in with email/username/phone and password
|
|
542
|
-
*/
|
|
543
|
-
signIn(request: SignInRequest): Promise<AuthResponse>;
|
|
544
|
-
/**
|
|
545
|
-
* Sign up with email/username/phone and password
|
|
546
|
-
*/
|
|
547
|
-
signUp(request: SignUpRequest): Promise<AuthResponse>;
|
|
548
|
-
/**
|
|
549
|
-
* Sign out
|
|
550
|
-
*/
|
|
551
|
-
signOut(): Promise<void>;
|
|
552
|
-
/**
|
|
553
|
-
* Get current user
|
|
554
|
-
*/
|
|
555
|
-
getCurrentUser(): Promise<User | null>;
|
|
556
|
-
/**
|
|
557
|
-
* Get current session
|
|
558
|
-
*/
|
|
559
|
-
getCurrentSession(): Promise<Session | null>;
|
|
560
|
-
/**
|
|
561
|
-
* Get current session data (user + session combined)
|
|
562
|
-
* More efficient than calling getCurrentUser() and getCurrentSession() separately
|
|
563
|
-
*/
|
|
564
|
-
getCurrentSessionData(): Promise<SessionData | null>;
|
|
565
|
-
/**
|
|
566
|
-
* Refresh session
|
|
567
|
-
*/
|
|
568
|
-
refreshSession(): Promise<Session>;
|
|
569
|
-
/**
|
|
570
|
-
* Update user profile
|
|
571
|
-
*/
|
|
572
|
-
updateUser(request: UpdateUserRequest): Promise<User>;
|
|
573
|
-
/**
|
|
574
|
-
* Change password
|
|
575
|
-
*/
|
|
576
|
-
changePassword(request: PasswordChangeRequest): Promise<void>;
|
|
577
|
-
/**
|
|
578
|
-
* Request password reset
|
|
579
|
-
*/
|
|
580
|
-
requestPasswordReset(request: PasswordResetRequest): Promise<void>;
|
|
581
|
-
/**
|
|
582
|
-
* Confirm password reset
|
|
583
|
-
*/
|
|
584
|
-
confirmPasswordReset(request: PasswordResetConfirmRequest): Promise<void>;
|
|
585
|
-
/**
|
|
586
|
-
* Initiate OAuth sign in
|
|
587
|
-
*/
|
|
588
|
-
oauthSignIn(request: OAuthSignInRequest): Promise<string>;
|
|
589
|
-
/**
|
|
590
|
-
* Handle OAuth callback
|
|
591
|
-
*/
|
|
592
|
-
oauthCallback(request: OAuthCallbackRequest): Promise<AuthResponse>;
|
|
593
|
-
/**
|
|
594
|
-
* Get available OAuth providers
|
|
595
|
-
*/
|
|
596
|
-
getOAuthProviders(): Promise<OAuthProvider[]>;
|
|
597
|
-
/**
|
|
598
|
-
* Send magic link
|
|
599
|
-
*/
|
|
600
|
-
sendMagicLink(request: MagicLinkRequest): Promise<void>;
|
|
601
|
-
/**
|
|
602
|
-
* Verify magic link
|
|
603
|
-
*/
|
|
604
|
-
verifyMagicLink(request: MagicLinkVerifyRequest): Promise<AuthResponse>;
|
|
605
|
-
/**
|
|
606
|
-
* Send phone verification code
|
|
607
|
-
*/
|
|
608
|
-
sendPhoneCode(request: PhoneAuthRequest): Promise<void>;
|
|
609
|
-
/**
|
|
610
|
-
* Verify phone code
|
|
611
|
-
*/
|
|
612
|
-
verifyPhoneCode(request: PhoneVerifyRequest): Promise<AuthResponse>;
|
|
613
|
-
/**
|
|
614
|
-
* Setup 2FA
|
|
615
|
-
*/
|
|
616
|
-
setupTwoFactor(request: TwoFactorSetupRequest): Promise<TwoFactorSetupResponse>;
|
|
617
|
-
/**
|
|
618
|
-
* Verify 2FA
|
|
619
|
-
*/
|
|
620
|
-
verifyTwoFactor(request: TwoFactorVerifyRequest): Promise<AuthResponse>;
|
|
621
|
-
/**
|
|
622
|
-
* Disable 2FA
|
|
623
|
-
*/
|
|
624
|
-
disableTwoFactor(): Promise<void>;
|
|
625
|
-
/**
|
|
626
|
-
* Get 2FA status
|
|
627
|
-
*/
|
|
628
|
-
getTwoFactorStatus(): Promise<TwoFactorMethod[]>;
|
|
629
|
-
/**
|
|
630
|
-
* Register passkey
|
|
631
|
-
*/
|
|
632
|
-
registerPasskey(request: PasskeyRegisterRequest): Promise<PasskeyCredential>;
|
|
633
|
-
/**
|
|
634
|
-
* Authenticate with passkey
|
|
635
|
-
*/
|
|
636
|
-
authenticatePasskey(request: PasskeyAuthRequest): Promise<AuthResponse>;
|
|
637
|
-
/**
|
|
638
|
-
* List passkeys
|
|
639
|
-
*/
|
|
640
|
-
listPasskeys(): Promise<PasskeyCredential[]>;
|
|
641
|
-
/**
|
|
642
|
-
* Delete passkey
|
|
643
|
-
*/
|
|
644
|
-
deletePasskey(credentialId: string): Promise<void>;
|
|
645
|
-
/**
|
|
646
|
-
* Normalize provider-specific errors to AuthError
|
|
647
|
-
*/
|
|
648
|
-
normalizeError(error: unknown): AuthError;
|
|
649
|
-
/**
|
|
650
|
-
* Get all organizations the user belongs to
|
|
651
|
-
* Optional - only available if adapter supports organizations
|
|
652
|
-
*/
|
|
653
|
-
getOrganizations?(): Promise<Organization[]>;
|
|
654
|
-
/**
|
|
655
|
-
* Get the currently active organization
|
|
656
|
-
* Optional - only available if adapter supports organizations
|
|
657
|
-
*/
|
|
658
|
-
getActiveOrganization?(): Promise<Organization | null>;
|
|
659
|
-
/**
|
|
660
|
-
* Set the active organization
|
|
661
|
-
* Optional - only available if adapter supports organizations
|
|
662
|
-
*/
|
|
663
|
-
setActiveOrganization?(organizationId: string): Promise<void>;
|
|
664
|
-
/**
|
|
665
|
-
* Get organization memberships with roles and permissions
|
|
666
|
-
* Optional - only available if adapter supports organizations
|
|
667
|
-
*/
|
|
668
|
-
getOrganizationMemberships?(): Promise<OrganizationMembership[]>;
|
|
669
|
-
/**
|
|
670
|
-
* Get dynamic signup fields from the backend
|
|
671
|
-
* Optional - only available if adapter supports dynamic signup fields
|
|
672
|
-
*/
|
|
673
|
-
getSignupFields?(): Promise<FieldDefinition[]>;
|
|
674
|
-
/**
|
|
675
|
-
* Set request context for subsequent adapter calls
|
|
676
|
-
* Optional - only needed for edge runtime environments
|
|
677
|
-
*/
|
|
678
|
-
setContext?(context: RequestContext): void;
|
|
679
|
-
/**
|
|
680
|
-
* Get cookies that should be set by the framework
|
|
681
|
-
* Optional - only needed for edge runtime environments
|
|
682
|
-
*/
|
|
683
|
-
getCookies?(): CookieData[];
|
|
684
|
-
/**
|
|
685
|
-
* Clear request context
|
|
686
|
-
* Optional - only needed for edge runtime environments
|
|
687
|
-
*/
|
|
688
|
-
clearContext?(): void;
|
|
689
|
-
/**
|
|
690
|
-
* Send verification email to user
|
|
691
|
-
* Optional - only available if adapter supports email verification
|
|
692
|
-
*/
|
|
693
|
-
sendVerificationEmail?(request: SendVerificationEmailRequest): Promise<void>;
|
|
694
|
-
/**
|
|
695
|
-
* Verify email with token/code
|
|
696
|
-
* Optional - only available if adapter supports email verification
|
|
697
|
-
*/
|
|
698
|
-
verifyEmail?(request: VerifyEmailRequest): Promise<void>;
|
|
699
|
-
/**
|
|
700
|
-
* Resend verification email
|
|
701
|
-
* Optional - only available if adapter supports email verification
|
|
702
|
-
*/
|
|
703
|
-
resendVerificationEmail?(request: ResendVerificationRequest): Promise<void>;
|
|
704
|
-
/**
|
|
705
|
-
* Enroll a new MFA factor
|
|
706
|
-
* Optional - only available if adapter supports advanced MFA
|
|
707
|
-
*/
|
|
708
|
-
enrollMFAFactor?(request: EnrollMFAFactorRequest): Promise<MFAFactor>;
|
|
709
|
-
/**
|
|
710
|
-
* List all enrolled MFA factors
|
|
711
|
-
* Optional - only available if adapter supports advanced MFA
|
|
712
|
-
*/
|
|
713
|
-
listMFAFactors?(): Promise<MFAFactor[]>;
|
|
714
|
-
/**
|
|
715
|
-
* Get specific MFA factor details
|
|
716
|
-
* Optional - only available if adapter supports advanced MFA
|
|
717
|
-
*/
|
|
718
|
-
getMFAFactor?(factorId: string): Promise<MFAFactor>;
|
|
719
|
-
/**
|
|
720
|
-
* Delete an MFA factor
|
|
721
|
-
* Optional - only available if adapter supports advanced MFA
|
|
722
|
-
*/
|
|
723
|
-
deleteMFAFactor?(factorId: string): Promise<void>;
|
|
724
|
-
/**
|
|
725
|
-
* Verify an MFA factor
|
|
726
|
-
* Optional - only available if adapter supports advanced MFA
|
|
727
|
-
*/
|
|
728
|
-
verifyMFAFactor?(request: VerifyMFAFactorRequest): Promise<void>;
|
|
729
|
-
/**
|
|
730
|
-
* Initiate MFA challenge
|
|
731
|
-
* Optional - only available if adapter supports advanced MFA
|
|
732
|
-
*/
|
|
733
|
-
initiateMFAChallenge?(request: MFAChallengeRequest): Promise<MFAChallengeResponse>;
|
|
734
|
-
/**
|
|
735
|
-
* Get MFA status for current user
|
|
736
|
-
* Optional - only available if adapter supports advanced MFA
|
|
737
|
-
*/
|
|
738
|
-
getMFAStatus?(): Promise<{
|
|
739
|
-
enabled: boolean;
|
|
740
|
-
factors: MFAFactor[];
|
|
741
|
-
}>;
|
|
742
|
-
/**
|
|
743
|
-
* List all devices for current user
|
|
744
|
-
* Optional - only available if adapter supports device management
|
|
745
|
-
*/
|
|
746
|
-
listDevices?(): Promise<Device[]>;
|
|
747
|
-
/**
|
|
748
|
-
* Revoke a specific device
|
|
749
|
-
* Optional - only available if adapter supports device management
|
|
750
|
-
*/
|
|
751
|
-
revokeDevice?(deviceId: string): Promise<void>;
|
|
752
|
-
/**
|
|
753
|
-
* Trust a device for MFA
|
|
754
|
-
* Optional - only available if adapter supports device management
|
|
755
|
-
*/
|
|
756
|
-
trustDevice?(deviceId: string, name?: string): Promise<void>;
|
|
757
|
-
/**
|
|
758
|
-
* List all trusted devices
|
|
759
|
-
* Optional - only available if adapter supports device management
|
|
760
|
-
*/
|
|
761
|
-
listTrustedDevices?(): Promise<Device[]>;
|
|
762
|
-
/**
|
|
763
|
-
* Revoke trust from a device
|
|
764
|
-
* Optional - only available if adapter supports device management
|
|
765
|
-
*/
|
|
766
|
-
revokeTrustedDevice?(deviceId: string): Promise<void>;
|
|
767
|
-
/**
|
|
768
|
-
* List sessions with optional filtering and pagination
|
|
769
|
-
* Optional - only available if adapter supports session management
|
|
770
|
-
*
|
|
771
|
-
* @param options - Optional filter and pagination parameters
|
|
772
|
-
* @returns Paginated session list with metadata
|
|
773
|
-
*/
|
|
774
|
-
listSessions?(options?: ListSessionsOptions): Promise<ListSessionsResponse>;
|
|
775
|
-
/**
|
|
776
|
-
* Revoke a specific session
|
|
777
|
-
* Optional - only available if adapter supports session management
|
|
778
|
-
*/
|
|
779
|
-
revokeSession?(sessionId: string): Promise<void>;
|
|
780
|
-
/**
|
|
781
|
-
* Revoke all sessions except current
|
|
782
|
-
* Optional - only available if adapter supports session management
|
|
783
|
-
*/
|
|
784
|
-
revokeAllSessions?(): Promise<void>;
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
export { AuthErrorType as A, type FieldDefinition as B, type CookieData as C, type SignupFieldsResponse as D, type AuthResponse as E, type FieldValidation as F, type ProviderConfig as G, type SendVerificationEmailRequest as H, type VerifyEmailRequest as I, type ResendVerificationRequest as J, type MFAFactor as K, type EnrollMFAFactorRequest as L, type MagicLinkRequest as M, type VerifyMFAFactorRequest as N, type OAuthSignInRequest as O, type PasswordChangeRequest as P, type MFAChallengeRequest as Q, type RequestContext as R, type SignInRequest as S, type TwoFactorSetupRequest as T, type UpdateUserRequest as U, type ValidationError as V, type MFAChallengeResponse as W, type Device as X, type SessionInfo as Y, type ListSessionsOptions as Z, type ListSessionsResponse as _, AuthError as a, type AuthContext as b, type AuthProvider as c, type SignUpRequest as d, type PasswordResetRequest as e, type PasswordResetConfirmRequest as f, type OAuthCallbackRequest as g, OAuthProvider as h, type MagicLinkVerifyRequest as i, type PhoneAuthRequest as j, type PhoneVerifyRequest as k, type TwoFactorSetupResponse as l, type TwoFactorVerifyRequest as m, TwoFactorMethod as n, type PasskeyRegisterRequest as o, type PasskeyCredential as p, type PasskeyAuthRequest as q, type Organization as r, type OrganizationMembership as s, type User as t, type Session as u, AuthState as v, type SessionData as w, type OAuthConfig as x, type TwoFactorConfig as y, type FieldType as z };
|