@authsome/ui-core 0.1.7 → 0.1.9
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/adapters/index.d.mts +21 -1
- package/dist/adapters/index.d.ts +21 -1
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/index.mjs.map +1 -1
- package/dist/index.d.mts +55 -2
- package/dist/index.d.ts +55 -2
- package/dist/index.js +103 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +103 -1
- package/dist/index.mjs.map +1 -1
- package/dist/{provider-Du6Oe4tD.d.mts → provider-DWklI8Wr.d.mts} +312 -1
- package/dist/{provider-Du6Oe4tD.d.ts → provider-DWklI8Wr.d.ts} +312 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -171,6 +171,83 @@ interface OrganizationMembership {
|
|
|
171
171
|
role: 'owner' | 'admin' | 'member';
|
|
172
172
|
permissions?: string[];
|
|
173
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
|
+
}
|
|
174
251
|
|
|
175
252
|
/**
|
|
176
253
|
* Sign in request
|
|
@@ -405,6 +482,123 @@ interface CookieData {
|
|
|
405
482
|
expires?: Date;
|
|
406
483
|
};
|
|
407
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
|
+
}
|
|
408
602
|
/**
|
|
409
603
|
* Auth provider interface
|
|
410
604
|
*
|
|
@@ -569,6 +763,123 @@ interface AuthProvider {
|
|
|
569
763
|
* Optional - only needed for edge runtime environments
|
|
570
764
|
*/
|
|
571
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>;
|
|
572
883
|
}
|
|
573
884
|
|
|
574
|
-
export { AuthErrorType as A, type
|
|
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 };
|
|
@@ -171,6 +171,83 @@ interface OrganizationMembership {
|
|
|
171
171
|
role: 'owner' | 'admin' | 'member';
|
|
172
172
|
permissions?: string[];
|
|
173
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
|
+
}
|
|
174
251
|
|
|
175
252
|
/**
|
|
176
253
|
* Sign in request
|
|
@@ -405,6 +482,123 @@ interface CookieData {
|
|
|
405
482
|
expires?: Date;
|
|
406
483
|
};
|
|
407
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
|
+
}
|
|
408
602
|
/**
|
|
409
603
|
* Auth provider interface
|
|
410
604
|
*
|
|
@@ -569,6 +763,123 @@ interface AuthProvider {
|
|
|
569
763
|
* Optional - only needed for edge runtime environments
|
|
570
764
|
*/
|
|
571
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>;
|
|
572
883
|
}
|
|
573
884
|
|
|
574
|
-
export { AuthErrorType as A, type
|
|
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 };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b as AuthContext, a as AuthError, A as AuthErrorType, c as AuthProvider,
|
|
1
|
+
export { b as AuthContext, a as AuthError, A as AuthErrorType, c as AuthProvider, Q as AuthResponse, v as AuthState, C as CookieData, 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, M as MagicLinkRequest, i as MagicLinkVerifyRequest, g as OAuthCallbackRequest, x as OAuthConfig, h as OAuthProvider, O as OAuthSignInRequest, r as Organization, s as OrganizationMembership, q as PasskeyAuthRequest, p as PasskeyCredential, o as PasskeyRegisterRequest, P as PasswordChangeRequest, f as PasswordResetConfirmRequest, e as PasswordResetRequest, j as PhoneAuthRequest, k as PhoneVerifyRequest, R as ProviderConfig, W as RequestContext, Z as ResendVerificationRequest, X as SendVerificationEmailRequest, u as Session, w as SessionData, a4 as SessionInfo, S as SignInRequest, d as SignUpRequest, N as SignupFieldsResponse, y as TwoFactorConfig, n as TwoFactorMethod, T as TwoFactorSetupRequest, l as TwoFactorSetupResponse, m as TwoFactorVerifyRequest, U as UpdateUserRequest, t as User, V as ValidationError, Y as VerifyEmailRequest, a0 as VerifyMFAFactorRequest } from '../provider-DWklI8Wr.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Storage abstraction for auth tokens and data
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b as AuthContext, a as AuthError, A as AuthErrorType, c as AuthProvider,
|
|
1
|
+
export { b as AuthContext, a as AuthError, A as AuthErrorType, c as AuthProvider, Q as AuthResponse, v as AuthState, C as CookieData, 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, M as MagicLinkRequest, i as MagicLinkVerifyRequest, g as OAuthCallbackRequest, x as OAuthConfig, h as OAuthProvider, O as OAuthSignInRequest, r as Organization, s as OrganizationMembership, q as PasskeyAuthRequest, p as PasskeyCredential, o as PasskeyRegisterRequest, P as PasswordChangeRequest, f as PasswordResetConfirmRequest, e as PasswordResetRequest, j as PhoneAuthRequest, k as PhoneVerifyRequest, R as ProviderConfig, W as RequestContext, Z as ResendVerificationRequest, X as SendVerificationEmailRequest, u as Session, w as SessionData, a4 as SessionInfo, S as SignInRequest, d as SignUpRequest, N as SignupFieldsResponse, y as TwoFactorConfig, n as TwoFactorMethod, T as TwoFactorSetupRequest, l as TwoFactorSetupResponse, m as TwoFactorVerifyRequest, U as UpdateUserRequest, t as User, V as ValidationError, Y as VerifyEmailRequest, a0 as VerifyMFAFactorRequest } from '../provider-DWklI8Wr.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Storage abstraction for auth tokens and data
|