@authsome/ui-core 0.1.9 → 1.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.
@@ -1,885 +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
- * Device Flow types (RFC 8628 - OAuth 2.0 Device Authorization Grant)
176
- */
177
- /**
178
- * Request to initiate device flow
179
- * Used by CLI/device applications to start the authorization process
180
- */
181
- interface DeviceFlowInitiateRequest {
182
- clientId: string;
183
- scope?: string;
184
- }
185
- /**
186
- * Response from device flow initiation
187
- * Contains codes and URIs needed for user authorization
188
- */
189
- interface DeviceFlowInitiateResponse {
190
- /** The device verification code (long, secret code for polling) */
191
- deviceCode: string;
192
- /** The user-facing code to enter in browser (short, easy-to-type) */
193
- userCode: string;
194
- /** The URL to visit for verification */
195
- verificationUri: string;
196
- /** Optional complete URL with user_code pre-filled */
197
- verificationUriComplete?: string;
198
- /** Lifetime of device_code and user_code in seconds */
199
- expiresIn: number;
200
- /** Minimum polling interval in seconds */
201
- interval: number;
202
- }
203
- /**
204
- * Request to verify a user-entered device code
205
- * Used by the web UI when user enters their code
206
- */
207
- interface DeviceCodeVerifyRequest {
208
- userCode: string;
209
- }
210
- /**
211
- * Response from device code verification
212
- * Contains information about the pending authorization
213
- */
214
- interface DeviceCodeVerifyResponse {
215
- /** Whether the code is valid */
216
- valid: boolean;
217
- /** Client application name requesting access */
218
- clientName?: string;
219
- /** Scopes being requested */
220
- scopes?: string[];
221
- /** Time remaining before code expires */
222
- expiresIn?: number;
223
- }
224
- /**
225
- * Request to authorize/deny a device
226
- * Used when user approves or denies the authorization request
227
- */
228
- interface DeviceAuthorizeRequest {
229
- userCode: string;
230
- action: 'approve' | 'deny';
231
- }
232
- /**
233
- * Request to poll for device token
234
- * Used by CLI/device to check if user has authorized
235
- */
236
- interface DeviceTokenPollRequest {
237
- deviceCode: string;
238
- clientId: string;
239
- }
240
- /**
241
- * Status returned when polling is not yet complete
242
- */
243
- type DeviceTokenPollStatus = 'authorization_pending' | 'slow_down' | 'expired_token' | 'access_denied';
244
- /**
245
- * Response from device token polling
246
- * Either contains the auth response or a status indicator
247
- */
248
- interface DeviceTokenPollResponse {
249
- status: DeviceTokenPollStatus;
250
- }
251
-
252
- /**
253
- * Sign in request
254
- */
255
- interface SignInRequest {
256
- email?: string;
257
- username?: string;
258
- phone?: string;
259
- password?: string;
260
- remember?: boolean;
261
- }
262
- /**
263
- * Sign up request
264
- */
265
- interface SignUpRequest {
266
- email?: string;
267
- username?: string;
268
- phone?: string;
269
- password: string;
270
- name?: string;
271
- firstName?: string;
272
- lastName?: string;
273
- metadata?: Record<string, unknown>;
274
- [key: string]: unknown;
275
- }
276
- /**
277
- * OAuth sign in request
278
- */
279
- interface OAuthSignInRequest {
280
- provider: OAuthProvider;
281
- redirectUri?: string;
282
- state?: string;
283
- scope?: string[];
284
- }
285
- /**
286
- * OAuth callback request
287
- */
288
- interface OAuthCallbackRequest {
289
- provider: OAuthProvider;
290
- code: string;
291
- state?: string;
292
- }
293
- /**
294
- * Magic link request
295
- */
296
- interface MagicLinkRequest {
297
- email: string;
298
- redirectUri?: string;
299
- }
300
- /**
301
- * Magic link verify request
302
- */
303
- interface MagicLinkVerifyRequest {
304
- token: string;
305
- }
306
- /**
307
- * Phone auth request
308
- */
309
- interface PhoneAuthRequest {
310
- phone: string;
311
- }
312
- /**
313
- * Phone verify request
314
- */
315
- interface PhoneVerifyRequest {
316
- phone: string;
317
- code: string;
318
- }
319
- /**
320
- * 2FA setup request
321
- */
322
- interface TwoFactorSetupRequest {
323
- method: TwoFactorMethod;
324
- phone?: string;
325
- email?: string;
326
- }
327
- /**
328
- * 2FA setup response
329
- */
330
- interface TwoFactorSetupResponse {
331
- method: TwoFactorMethod;
332
- secret?: string;
333
- qrCode?: string;
334
- backupCodes?: string[];
335
- }
336
- /**
337
- * 2FA verify request
338
- */
339
- interface TwoFactorVerifyRequest {
340
- code: string;
341
- method?: TwoFactorMethod;
342
- remember?: boolean;
343
- }
344
- /**
345
- * Passkey registration request
346
- */
347
- interface PasskeyRegisterRequest {
348
- name?: string;
349
- }
350
- /**
351
- * Passkey authentication request
352
- */
353
- interface PasskeyAuthRequest {
354
- credentialId?: string;
355
- }
356
- /**
357
- * Password reset request
358
- */
359
- interface PasswordResetRequest {
360
- email: string;
361
- }
362
- /**
363
- * Password reset confirm request
364
- */
365
- interface PasswordResetConfirmRequest {
366
- token: string;
367
- password: string;
368
- }
369
- /**
370
- * Password change request
371
- */
372
- interface PasswordChangeRequest {
373
- currentPassword: string;
374
- newPassword: string;
375
- }
376
- /**
377
- * Update user request
378
- */
379
- interface UpdateUserRequest {
380
- name?: string;
381
- firstName?: string;
382
- lastName?: string;
383
- avatar?: string;
384
- metadata?: Record<string, unknown>;
385
- }
386
- /**
387
- * Field validation rules for dynamic signup fields
388
- */
389
- interface FieldValidation {
390
- required?: boolean;
391
- minLength?: number;
392
- maxLength?: number;
393
- min?: number;
394
- max?: number;
395
- pattern?: string;
396
- errorMessage?: string;
397
- }
398
- /**
399
- * Field type for dynamic signup forms
400
- */
401
- type FieldType = 'text' | 'email' | 'tel' | 'number' | 'select' | 'checkbox' | 'textarea' | 'date' | 'url' | 'password' | 'group';
402
- /**
403
- * Dynamic field definition for signup forms
404
- */
405
- interface FieldDefinition {
406
- name: string;
407
- label: string;
408
- type: FieldType;
409
- placeholder?: string;
410
- helperText?: string;
411
- defaultValue?: string | number | boolean;
412
- options?: Array<{
413
- value: string;
414
- label: string;
415
- }>;
416
- validation?: FieldValidation;
417
- /**
418
- * Nested fields for 'group' type
419
- * Groups render multiple fields in a horizontal row with a gap
420
- */
421
- fields?: FieldDefinition[];
422
- /**
423
- * Gap between fields in a group (CSS gap value)
424
- * @default '1rem'
425
- */
426
- gap?: string;
427
- /**
428
- * Order priority for field positioning
429
- * Lower numbers appear first. Fields without order are sorted after ordered fields.
430
- * @default undefined
431
- */
432
- order?: number;
433
- }
434
- /**
435
- * Response containing dynamic signup fields
436
- */
437
- interface SignupFieldsResponse {
438
- fields: FieldDefinition[];
439
- }
440
- /**
441
- * Auth response
442
- */
443
- interface AuthResponse {
444
- user: User;
445
- session: Session;
446
- requiresTwoFactor?: boolean;
447
- twoFactorMethods?: TwoFactorMethod[];
448
- }
449
- /**
450
- * Provider configuration
451
- */
452
- interface ProviderConfig {
453
- apiUrl?: string;
454
- apiKey?: string;
455
- [key: string]: unknown;
456
- }
457
- /**
458
- * Generic request context (framework-agnostic)
459
- * Used to pass request information to adapters in edge runtime environments
460
- */
461
- interface RequestContext {
462
- headers?: Record<string, string>;
463
- cookies?: Record<string, string>;
464
- url?: string;
465
- method?: string;
466
- [key: string]: unknown;
467
- }
468
- /**
469
- * Cookie data to be set by the framework
470
- * Adapters return this data; the framework is responsible for setting cookies
471
- */
472
- interface CookieData {
473
- name: string;
474
- value: string;
475
- options?: {
476
- path?: string;
477
- domain?: string;
478
- secure?: boolean;
479
- httpOnly?: boolean;
480
- sameSite?: 'strict' | 'lax' | 'none';
481
- maxAge?: number;
482
- expires?: Date;
483
- };
484
- }
485
- /**
486
- * Email verification request
487
- */
488
- interface SendVerificationEmailRequest {
489
- email: string;
490
- }
491
- /**
492
- * Verify email request
493
- */
494
- interface VerifyEmailRequest {
495
- token: string;
496
- code?: string;
497
- }
498
- /**
499
- * Resend verification email request
500
- */
501
- interface ResendVerificationRequest {
502
- email: string;
503
- }
504
- /**
505
- * MFA Factor representation
506
- */
507
- interface MFAFactor {
508
- id: string;
509
- type: string;
510
- name: string;
511
- status: string;
512
- createdAt: Date;
513
- metadata?: Record<string, unknown>;
514
- }
515
- /**
516
- * Enroll MFA factor request
517
- */
518
- interface EnrollMFAFactorRequest {
519
- type: string;
520
- name: string;
521
- metadata?: Record<string, unknown>;
522
- }
523
- /**
524
- * Verify MFA factor request
525
- */
526
- interface VerifyMFAFactorRequest {
527
- factorId: string;
528
- code: string;
529
- }
530
- /**
531
- * MFA challenge request
532
- */
533
- interface MFAChallengeRequest {
534
- userId?: string;
535
- factorTypes?: string[];
536
- }
537
- /**
538
- * MFA challenge response
539
- */
540
- interface MFAChallengeResponse {
541
- challengeId: string;
542
- availableFactors: MFAFactor[];
543
- expiresAt: Date;
544
- }
545
- /**
546
- * Device information
547
- */
548
- interface Device {
549
- id: string;
550
- userId: string;
551
- name?: string;
552
- type?: string;
553
- lastUsedAt: Date;
554
- ipAddress?: string;
555
- userAgent?: string;
556
- }
557
- /**
558
- * Extended session information with device and location
559
- */
560
- interface SessionInfo extends Session {
561
- device?: Device;
562
- location?: string;
563
- }
564
- /**
565
- * Options for listing sessions with filtering and pagination
566
- */
567
- interface ListSessionsOptions {
568
- /** Filter by active sessions only */
569
- active?: boolean;
570
- /** Filter by IP address */
571
- ipAddress?: string;
572
- /** Filter by user agent */
573
- userAgent?: string;
574
- /** Filter sessions created after this date (ISO string or Date) */
575
- createdFrom?: string | Date;
576
- /** Filter sessions created before this date (ISO string or Date) */
577
- createdTo?: string | Date;
578
- /** Field to sort by (e.g., 'createdAt', 'lastUsedAt') */
579
- sortBy?: string;
580
- /** Sort order */
581
- sortOrder?: 'asc' | 'desc';
582
- /** Maximum number of sessions to return (default: 50) */
583
- limit?: number;
584
- /** Number of sessions to skip for pagination (default: 0) */
585
- offset?: number;
586
- }
587
- /**
588
- * Paginated response for session listing
589
- */
590
- interface ListSessionsResponse {
591
- /** Array of session information */
592
- sessions: SessionInfo[];
593
- /** Total number of sessions matching the filter */
594
- total: number;
595
- /** Current page number */
596
- page: number;
597
- /** Total number of pages */
598
- totalPages: number;
599
- /** Number of sessions per page */
600
- limit: number;
601
- }
602
- /**
603
- * Auth provider interface
604
- *
605
- * This interface defines the contract that all auth providers must implement.
606
- * Providers can be for different backends like AuthSome, Clerk, Supabase, etc.
607
- */
608
- interface AuthProvider {
609
- /**
610
- * Provider name/identifier
611
- */
612
- readonly name: string;
613
- /**
614
- * Initialize the provider
615
- */
616
- initialize(config: ProviderConfig): Promise<void>;
617
- /**
618
- * Sign in with email/username/phone and password
619
- */
620
- signIn(request: SignInRequest): Promise<AuthResponse>;
621
- /**
622
- * Sign up with email/username/phone and password
623
- */
624
- signUp(request: SignUpRequest): Promise<AuthResponse>;
625
- /**
626
- * Sign out
627
- */
628
- signOut(): Promise<void>;
629
- /**
630
- * Get current user
631
- */
632
- getCurrentUser(): Promise<User | null>;
633
- /**
634
- * Get current session
635
- */
636
- getCurrentSession(): Promise<Session | null>;
637
- /**
638
- * Get current session data (user + session combined)
639
- * More efficient than calling getCurrentUser() and getCurrentSession() separately
640
- */
641
- getCurrentSessionData(): Promise<SessionData | null>;
642
- /**
643
- * Refresh session
644
- */
645
- refreshSession(): Promise<Session>;
646
- /**
647
- * Update user profile
648
- */
649
- updateUser(request: UpdateUserRequest): Promise<User>;
650
- /**
651
- * Change password
652
- */
653
- changePassword(request: PasswordChangeRequest): Promise<void>;
654
- /**
655
- * Request password reset
656
- */
657
- requestPasswordReset(request: PasswordResetRequest): Promise<void>;
658
- /**
659
- * Confirm password reset
660
- */
661
- confirmPasswordReset(request: PasswordResetConfirmRequest): Promise<void>;
662
- /**
663
- * Initiate OAuth sign in
664
- */
665
- oauthSignIn(request: OAuthSignInRequest): Promise<string>;
666
- /**
667
- * Handle OAuth callback
668
- */
669
- oauthCallback(request: OAuthCallbackRequest): Promise<AuthResponse>;
670
- /**
671
- * Get available OAuth providers
672
- */
673
- getOAuthProviders(): Promise<OAuthProvider[]>;
674
- /**
675
- * Send magic link
676
- */
677
- sendMagicLink(request: MagicLinkRequest): Promise<void>;
678
- /**
679
- * Verify magic link
680
- */
681
- verifyMagicLink(request: MagicLinkVerifyRequest): Promise<AuthResponse>;
682
- /**
683
- * Send phone verification code
684
- */
685
- sendPhoneCode(request: PhoneAuthRequest): Promise<void>;
686
- /**
687
- * Verify phone code
688
- */
689
- verifyPhoneCode(request: PhoneVerifyRequest): Promise<AuthResponse>;
690
- /**
691
- * Setup 2FA
692
- */
693
- setupTwoFactor(request: TwoFactorSetupRequest): Promise<TwoFactorSetupResponse>;
694
- /**
695
- * Verify 2FA
696
- */
697
- verifyTwoFactor(request: TwoFactorVerifyRequest): Promise<AuthResponse>;
698
- /**
699
- * Disable 2FA
700
- */
701
- disableTwoFactor(): Promise<void>;
702
- /**
703
- * Get 2FA status
704
- */
705
- getTwoFactorStatus(): Promise<TwoFactorMethod[]>;
706
- /**
707
- * Register passkey
708
- */
709
- registerPasskey(request: PasskeyRegisterRequest): Promise<PasskeyCredential>;
710
- /**
711
- * Authenticate with passkey
712
- */
713
- authenticatePasskey(request: PasskeyAuthRequest): Promise<AuthResponse>;
714
- /**
715
- * List passkeys
716
- */
717
- listPasskeys(): Promise<PasskeyCredential[]>;
718
- /**
719
- * Delete passkey
720
- */
721
- deletePasskey(credentialId: string): Promise<void>;
722
- /**
723
- * Normalize provider-specific errors to AuthError
724
- */
725
- normalizeError(error: unknown): AuthError;
726
- /**
727
- * Get all organizations the user belongs to
728
- * Optional - only available if adapter supports organizations
729
- */
730
- getOrganizations?(): Promise<Organization[]>;
731
- /**
732
- * Get the currently active organization
733
- * Optional - only available if adapter supports organizations
734
- */
735
- getActiveOrganization?(): Promise<Organization | null>;
736
- /**
737
- * Set the active organization
738
- * Optional - only available if adapter supports organizations
739
- */
740
- setActiveOrganization?(organizationId: string): Promise<void>;
741
- /**
742
- * Get organization memberships with roles and permissions
743
- * Optional - only available if adapter supports organizations
744
- */
745
- getOrganizationMemberships?(): Promise<OrganizationMembership[]>;
746
- /**
747
- * Get dynamic signup fields from the backend
748
- * Optional - only available if adapter supports dynamic signup fields
749
- */
750
- getSignupFields?(): Promise<FieldDefinition[]>;
751
- /**
752
- * Set request context for subsequent adapter calls
753
- * Optional - only needed for edge runtime environments
754
- */
755
- setContext?(context: RequestContext): void;
756
- /**
757
- * Get cookies that should be set by the framework
758
- * Optional - only needed for edge runtime environments
759
- */
760
- getCookies?(): CookieData[];
761
- /**
762
- * Clear request context
763
- * Optional - only needed for edge runtime environments
764
- */
765
- clearContext?(): void;
766
- /**
767
- * Send verification email to user
768
- * Optional - only available if adapter supports email verification
769
- */
770
- sendVerificationEmail?(request: SendVerificationEmailRequest): Promise<void>;
771
- /**
772
- * Verify email with token/code
773
- * Optional - only available if adapter supports email verification
774
- */
775
- verifyEmail?(request: VerifyEmailRequest): Promise<void>;
776
- /**
777
- * Resend verification email
778
- * Optional - only available if adapter supports email verification
779
- */
780
- resendVerificationEmail?(request: ResendVerificationRequest): Promise<void>;
781
- /**
782
- * Enroll a new MFA factor
783
- * Optional - only available if adapter supports advanced MFA
784
- */
785
- enrollMFAFactor?(request: EnrollMFAFactorRequest): Promise<MFAFactor>;
786
- /**
787
- * List all enrolled MFA factors
788
- * Optional - only available if adapter supports advanced MFA
789
- */
790
- listMFAFactors?(): Promise<MFAFactor[]>;
791
- /**
792
- * Get specific MFA factor details
793
- * Optional - only available if adapter supports advanced MFA
794
- */
795
- getMFAFactor?(factorId: string): Promise<MFAFactor>;
796
- /**
797
- * Delete an MFA factor
798
- * Optional - only available if adapter supports advanced MFA
799
- */
800
- deleteMFAFactor?(factorId: string): Promise<void>;
801
- /**
802
- * Verify an MFA factor
803
- * Optional - only available if adapter supports advanced MFA
804
- */
805
- verifyMFAFactor?(request: VerifyMFAFactorRequest): Promise<void>;
806
- /**
807
- * Initiate MFA challenge
808
- * Optional - only available if adapter supports advanced MFA
809
- */
810
- initiateMFAChallenge?(request: MFAChallengeRequest): Promise<MFAChallengeResponse>;
811
- /**
812
- * Get MFA status for current user
813
- * Optional - only available if adapter supports advanced MFA
814
- */
815
- getMFAStatus?(): Promise<{
816
- enabled: boolean;
817
- factors: MFAFactor[];
818
- }>;
819
- /**
820
- * List all devices for current user
821
- * Optional - only available if adapter supports device management
822
- */
823
- listDevices?(): Promise<Device[]>;
824
- /**
825
- * Revoke a specific device
826
- * Optional - only available if adapter supports device management
827
- */
828
- revokeDevice?(deviceId: string): Promise<void>;
829
- /**
830
- * Trust a device for MFA
831
- * Optional - only available if adapter supports device management
832
- */
833
- trustDevice?(deviceId: string, name?: string): Promise<void>;
834
- /**
835
- * List all trusted devices
836
- * Optional - only available if adapter supports device management
837
- */
838
- listTrustedDevices?(): Promise<Device[]>;
839
- /**
840
- * Revoke trust from a device
841
- * Optional - only available if adapter supports device management
842
- */
843
- revokeTrustedDevice?(deviceId: string): Promise<void>;
844
- /**
845
- * List sessions with optional filtering and pagination
846
- * Optional - only available if adapter supports session management
847
- *
848
- * @param options - Optional filter and pagination parameters
849
- * @returns Paginated session list with metadata
850
- */
851
- listSessions?(options?: ListSessionsOptions): Promise<ListSessionsResponse>;
852
- /**
853
- * Revoke a specific session
854
- * Optional - only available if adapter supports session management
855
- */
856
- revokeSession?(sessionId: string): Promise<void>;
857
- /**
858
- * Revoke all sessions except current
859
- * Optional - only available if adapter supports session management
860
- */
861
- revokeAllSessions?(): Promise<void>;
862
- /**
863
- * Initiate device authorization flow
864
- * Used by CLI/device applications to start the authorization process
865
- * Returns device code, user code, and verification URI
866
- */
867
- initiateDeviceFlow?(request: DeviceFlowInitiateRequest): Promise<DeviceFlowInitiateResponse>;
868
- /**
869
- * Verify a user-entered device code
870
- * Called by web UI when user enters the code shown on their device
871
- */
872
- verifyDeviceCode?(request: DeviceCodeVerifyRequest): Promise<DeviceCodeVerifyResponse>;
873
- /**
874
- * Authorize or deny the device request
875
- * Called when user approves or denies the authorization
876
- */
877
- authorizeDevice?(request: DeviceAuthorizeRequest): Promise<void>;
878
- /**
879
- * Poll for device token (used by CLI/device)
880
- * Returns auth response when authorized, or status when still pending
881
- */
882
- pollDeviceToken?(request: DeviceTokenPollRequest): Promise<AuthResponse | DeviceTokenPollResponse>;
883
- }
884
-
885
- export { type EnrollMFAFactorRequest as $, AuthErrorType as A, type DeviceCodeVerifyRequest as B, type CookieData as C, type DeviceFlowInitiateRequest as D, type DeviceCodeVerifyResponse as E, type DeviceAuthorizeRequest as F, type DeviceTokenPollRequest as G, type DeviceTokenPollStatus as H, type DeviceTokenPollResponse as I, type FieldValidation as J, type FieldType as K, type FieldDefinition as L, type MagicLinkRequest as M, type SignupFieldsResponse as N, type OAuthSignInRequest as O, type PasswordChangeRequest as P, type AuthResponse as Q, type ProviderConfig as R, type SignInRequest as S, type TwoFactorSetupRequest as T, type UpdateUserRequest as U, type ValidationError as V, type RequestContext as W, type SendVerificationEmailRequest as X, type VerifyEmailRequest as Y, type ResendVerificationRequest as Z, type MFAFactor as _, AuthError as a, type VerifyMFAFactorRequest as a0, type MFAChallengeRequest as a1, type MFAChallengeResponse as a2, type Device as a3, type SessionInfo as a4, type ListSessionsOptions as a5, type ListSessionsResponse as a6, 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 DeviceFlowInitiateResponse as z };