@parsrun/auth 0.2.6 → 0.2.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.
@@ -2,10 +2,696 @@ import { T as TokenPair, d as JwtPayload, J as JwtManager } from './jwt-manager-
2
2
  import * as hono_types from 'hono/types';
3
3
  import { Context, MiddlewareHandler, Hono } from 'hono';
4
4
  import { K as KVStorage } from './types-DSjafxJ4.js';
5
- import { h as AuthAdapter, u as AdapterTenant, v as AdapterMembership, l as TenantResolutionStrategy, i as ParsAuthConfig, a as ProviderInfo, r as AdapterUser, s as AdapterSession } from './base-BI-SilX-.js';
6
- import { R as RequestOTPInput, d as RequestOTPResult } from './index-DC7A0IbX.js';
5
+ import { A as AuthProvider, b as AuthInput, c as AuthResult, a as ProviderInfo, T as TwoFactorProvider, e as TwoFactorSetupResult, h as AuthAdapter, u as AdapterTenant, v as AdapterMembership, l as TenantResolutionStrategy, i as ParsAuthConfig, r as AdapterUser, s as AdapterSession } from './base-DbUdEGJ4.js';
6
+ import { R as RequestOTPInput, d as RequestOTPResult } from './index-Bcldwbx0.js';
7
7
  import { f as PermissionPattern } from './authorization-By1Xp8Za.js';
8
8
 
9
+ /**
10
+ * Password Provider
11
+ * Traditional password-based authentication
12
+ * DISABLED BY DEFAULT - use passwordless methods when possible
13
+ */
14
+
15
+ /**
16
+ * Password configuration
17
+ */
18
+ interface PasswordConfig {
19
+ /** Minimum password length (default: 8) */
20
+ minLength?: number;
21
+ /** Maximum password length (default: 128) */
22
+ maxLength?: number;
23
+ /** Require uppercase letter (default: true) */
24
+ requireUppercase?: boolean;
25
+ /** Require lowercase letter (default: true) */
26
+ requireLowercase?: boolean;
27
+ /** Require number (default: true) */
28
+ requireNumber?: boolean;
29
+ /** Require special character (default: false) */
30
+ requireSpecial?: boolean;
31
+ /** Bcrypt cost factor (default: 12) */
32
+ bcryptCost?: number;
33
+ /** Password hash function (for custom implementations) */
34
+ hashPassword?: (password: string) => Promise<string>;
35
+ /** Password verify function (for custom implementations) */
36
+ verifyPassword?: (password: string, hash: string) => Promise<boolean>;
37
+ }
38
+ /**
39
+ * Password validation result
40
+ */
41
+ interface PasswordValidationResult {
42
+ valid: boolean;
43
+ errors: string[];
44
+ }
45
+ /**
46
+ * Password strength levels
47
+ */
48
+ type PasswordStrength = 'weak' | 'fair' | 'strong' | 'very-strong';
49
+ /**
50
+ * Password Provider
51
+ * WARNING: This provider is disabled by default.
52
+ * Consider using passwordless authentication (OTP, Magic Link, OAuth) for better security.
53
+ */
54
+ declare class PasswordProvider implements AuthProvider {
55
+ readonly name = "password";
56
+ readonly type: "password";
57
+ private storage;
58
+ private config;
59
+ private _enabled;
60
+ constructor(storage: KVStorage, config?: PasswordConfig);
61
+ get enabled(): boolean;
62
+ /**
63
+ * Enable the password provider
64
+ * Must be explicitly called to enable password authentication
65
+ */
66
+ enable(): void;
67
+ /**
68
+ * Disable the password provider
69
+ */
70
+ disable(): void;
71
+ /**
72
+ * Validate password against policy
73
+ */
74
+ validatePassword(password: string): PasswordValidationResult;
75
+ /**
76
+ * Check password strength
77
+ */
78
+ checkStrength(password: string): PasswordStrength;
79
+ /**
80
+ * Hash a password
81
+ * Uses Web Crypto API for PBKDF2 (bcrypt alternative for edge runtime)
82
+ */
83
+ hashPassword(password: string): Promise<string>;
84
+ /**
85
+ * Verify a password against a hash
86
+ */
87
+ verifyPassword(password: string, hash: string): Promise<boolean>;
88
+ /**
89
+ * Authenticate with password (implements AuthProvider)
90
+ */
91
+ authenticate(input: AuthInput): Promise<AuthResult>;
92
+ /**
93
+ * Store password hash for a user
94
+ */
95
+ setPassword(userId: string, password: string): Promise<{
96
+ success: boolean;
97
+ errors?: string[];
98
+ }>;
99
+ /**
100
+ * Verify password for a user
101
+ */
102
+ verifyUserPassword(userId: string, password: string): Promise<boolean>;
103
+ /**
104
+ * Check if user has password set
105
+ */
106
+ hasPassword(userId: string): Promise<boolean>;
107
+ /**
108
+ * Remove password for a user (switch to passwordless)
109
+ */
110
+ removePassword(userId: string): Promise<void>;
111
+ /**
112
+ * Get provider info
113
+ */
114
+ getInfo(): ProviderInfo;
115
+ /**
116
+ * Constant-time comparison to prevent timing attacks
117
+ */
118
+ private constantTimeEquals;
119
+ }
120
+ /**
121
+ * Create Password provider
122
+ */
123
+ declare function createPasswordProvider(storage: KVStorage, config?: PasswordConfig): PasswordProvider;
124
+
125
+ /**
126
+ * Magic Link Provider
127
+ * Passwordless email authentication via secure links
128
+ */
129
+
130
+ /**
131
+ * Magic Link configuration
132
+ */
133
+ interface MagicLinkConfig {
134
+ /** Base URL for magic links (e.g., https://app.example.com) */
135
+ baseUrl: string;
136
+ /** Path for callback (default: /auth/magic-link/callback) */
137
+ callbackPath?: string;
138
+ /** Token expiration in seconds (default: 900 = 15 minutes) */
139
+ expiresIn?: number;
140
+ /** Token length in bytes (default: 32) */
141
+ tokenLength?: number;
142
+ /** Email sender function */
143
+ send: (email: string, url: string, expiresIn: number) => Promise<void>;
144
+ }
145
+ /**
146
+ * Send magic link result
147
+ */
148
+ interface SendMagicLinkResult {
149
+ success: boolean;
150
+ expiresAt?: Date;
151
+ error?: string;
152
+ }
153
+ /**
154
+ * Verify magic link result
155
+ */
156
+ interface VerifyMagicLinkResult {
157
+ success: boolean;
158
+ email?: string;
159
+ tenantId?: string;
160
+ redirectUrl?: string;
161
+ error?: string;
162
+ }
163
+ /**
164
+ * Magic Link Provider
165
+ */
166
+ declare class MagicLinkProvider implements AuthProvider {
167
+ readonly name = "magic-link";
168
+ readonly type: "magic-link";
169
+ private storage;
170
+ private config;
171
+ private _enabled;
172
+ constructor(storage: KVStorage, config: MagicLinkConfig);
173
+ get enabled(): boolean;
174
+ /**
175
+ * Send magic link to email
176
+ */
177
+ sendMagicLink(email: string, options?: {
178
+ tenantId?: string;
179
+ redirectUrl?: string;
180
+ }): Promise<SendMagicLinkResult>;
181
+ /**
182
+ * Verify magic link token
183
+ */
184
+ verifyMagicLink(token: string): Promise<VerifyMagicLinkResult>;
185
+ /**
186
+ * Authenticate with magic link token (implements AuthProvider)
187
+ */
188
+ authenticate(input: AuthInput): Promise<AuthResult>;
189
+ /**
190
+ * Get provider info
191
+ */
192
+ getInfo(): ProviderInfo;
193
+ /**
194
+ * Request magic link (for use in auth routes)
195
+ */
196
+ requestMagicLink(email: string, options?: {
197
+ tenantId?: string;
198
+ redirectUrl?: string;
199
+ }): Promise<SendMagicLinkResult>;
200
+ }
201
+ /**
202
+ * Create Magic Link provider
203
+ */
204
+ declare function createMagicLinkProvider(storage: KVStorage, config: MagicLinkConfig): MagicLinkProvider;
205
+
206
+ /**
207
+ * TOTP Provider (Time-based One-Time Password)
208
+ * RFC 6238 compliant, Google Authenticator compatible
209
+ */
210
+
211
+ /**
212
+ * TOTP Configuration
213
+ */
214
+ interface TOTPConfig {
215
+ /** Issuer name (your app name) */
216
+ issuer: string;
217
+ /** Hash algorithm (default: SHA1 for compatibility) */
218
+ algorithm?: 'SHA1' | 'SHA256' | 'SHA512';
219
+ /** Number of digits (default: 6) */
220
+ digits?: 6 | 8;
221
+ /** Time period in seconds (default: 30) */
222
+ period?: number;
223
+ /** Time window for drift tolerance (default: 1) */
224
+ window?: number;
225
+ /** Number of backup codes (default: 10) */
226
+ backupCodeCount?: number;
227
+ /** Encryption key for storing secrets */
228
+ encryptionKey?: string;
229
+ }
230
+ /**
231
+ * TOTP setup result
232
+ */
233
+ interface TOTPSetupData {
234
+ /** Base32 encoded secret */
235
+ secret: string;
236
+ /** QR code URL */
237
+ qrCodeUrl: string;
238
+ /** Backup codes */
239
+ backupCodes: string[];
240
+ /** otpauth:// URI */
241
+ otpauthUri: string;
242
+ }
243
+ /**
244
+ * TOTP verify result
245
+ */
246
+ interface TOTPVerifyResult {
247
+ valid: boolean;
248
+ usedBackupCode?: boolean;
249
+ }
250
+ /**
251
+ * TOTP Provider
252
+ */
253
+ declare class TOTPProvider implements TwoFactorProvider {
254
+ readonly name = "totp";
255
+ readonly type: "totp";
256
+ private storage;
257
+ private config;
258
+ private _enabled;
259
+ constructor(storage: KVStorage, config: TOTPConfig);
260
+ get enabled(): boolean;
261
+ /**
262
+ * Setup TOTP for a user
263
+ * Note: Use setupWithEmail for full setup including QR code URL
264
+ */
265
+ setup(userId: string): Promise<TwoFactorSetupResult>;
266
+ /**
267
+ * Setup TOTP for a user with email for QR code label
268
+ */
269
+ setupWithEmail(userId: string, userEmail: string): Promise<TwoFactorSetupResult & {
270
+ qrCodeUrl: string;
271
+ otpauthUri: string;
272
+ }>;
273
+ /**
274
+ * Verify TOTP and activate 2FA (for TwoFactorProvider interface)
275
+ */
276
+ verifySetup(userId: string, token: string): Promise<boolean>;
277
+ /**
278
+ * Verify TOTP during login (for TwoFactorProvider interface)
279
+ */
280
+ verifyLogin(userId: string, code: string): Promise<boolean>;
281
+ /**
282
+ * Authenticate (for AuthProvider interface)
283
+ */
284
+ authenticate(_input: AuthInput): Promise<AuthResult>;
285
+ /**
286
+ * Verify TOTP token
287
+ */
288
+ verifyCode(userId: string, token: string): Promise<TOTPVerifyResult>;
289
+ /**
290
+ * Disable TOTP for user
291
+ */
292
+ disable(userId: string): Promise<void>;
293
+ /**
294
+ * Regenerate backup codes
295
+ */
296
+ regenerateBackupCodes(userId: string): Promise<string[]>;
297
+ /**
298
+ * Get remaining backup codes count
299
+ */
300
+ getBackupCodesCount(userId: string): Promise<number>;
301
+ /**
302
+ * Check if TOTP is enabled for user
303
+ */
304
+ isEnabled(userId: string): Promise<boolean>;
305
+ /**
306
+ * Generate current TOTP (for testing)
307
+ */
308
+ generateCurrent(userId: string): Promise<string>;
309
+ /**
310
+ * Get provider info
311
+ */
312
+ getInfo(): ProviderInfo;
313
+ /**
314
+ * Create otpauth URI for QR code
315
+ */
316
+ private createOtpauthUri;
317
+ }
318
+ /**
319
+ * Create TOTP provider
320
+ */
321
+ declare function createTOTPProvider(storage: KVStorage, config: TOTPConfig): TOTPProvider;
322
+
323
+ /**
324
+ * WebAuthn Provider (Passkeys)
325
+ * FIDO2 passwordless authentication
326
+ */
327
+
328
+ /**
329
+ * WebAuthn Configuration
330
+ */
331
+ interface WebAuthnConfig {
332
+ /** Relying Party name (your app name) */
333
+ rpName: string;
334
+ /** Relying Party ID (domain without protocol) */
335
+ rpId: string;
336
+ /** Full origin (e.g., https://example.com) */
337
+ origin: string;
338
+ /** Timeout in milliseconds (default: 60000) */
339
+ timeout?: number;
340
+ /** Attestation preference (default: none) */
341
+ attestation?: 'none' | 'indirect' | 'direct';
342
+ /** User verification preference (default: preferred) */
343
+ userVerification?: 'required' | 'preferred' | 'discouraged';
344
+ }
345
+ /**
346
+ * Registration options returned to client
347
+ */
348
+ interface RegistrationOptions {
349
+ challenge: string;
350
+ rp: {
351
+ name: string;
352
+ id: string;
353
+ };
354
+ user: {
355
+ id: string;
356
+ name: string;
357
+ displayName: string;
358
+ };
359
+ pubKeyCredParams: Array<{
360
+ type: 'public-key';
361
+ alg: number;
362
+ }>;
363
+ timeout: number;
364
+ attestation: 'none' | 'indirect' | 'direct';
365
+ authenticatorSelection: {
366
+ authenticatorAttachment?: 'platform' | 'cross-platform';
367
+ residentKey: 'required' | 'preferred' | 'discouraged';
368
+ userVerification: 'required' | 'preferred' | 'discouraged';
369
+ };
370
+ excludeCredentials: Array<{
371
+ id: string;
372
+ type: 'public-key';
373
+ transports?: string[];
374
+ }>;
375
+ }
376
+ /**
377
+ * Authentication options returned to client
378
+ */
379
+ interface AuthenticationOptions {
380
+ challenge: string;
381
+ timeout: number;
382
+ rpId: string;
383
+ allowCredentials: Array<{
384
+ id: string;
385
+ type: 'public-key';
386
+ transports?: string[];
387
+ }>;
388
+ userVerification: 'required' | 'preferred' | 'discouraged';
389
+ }
390
+ /**
391
+ * Registration response from client
392
+ */
393
+ interface RegistrationResponse {
394
+ id: string;
395
+ rawId: string;
396
+ type: 'public-key';
397
+ response: {
398
+ clientDataJSON: string;
399
+ attestationObject: string;
400
+ transports?: string[];
401
+ };
402
+ }
403
+ /**
404
+ * Authentication response from client
405
+ */
406
+ interface AuthenticationResponse {
407
+ id: string;
408
+ rawId: string;
409
+ type: 'public-key';
410
+ response: {
411
+ clientDataJSON: string;
412
+ authenticatorData: string;
413
+ signature: string;
414
+ userHandle?: string;
415
+ };
416
+ }
417
+ /**
418
+ * Client data JSON structure
419
+ */
420
+ interface ClientDataJSON {
421
+ type: 'webauthn.create' | 'webauthn.get';
422
+ challenge: string;
423
+ origin: string;
424
+ crossOrigin?: boolean;
425
+ }
426
+ /**
427
+ * Authenticator data structure
428
+ */
429
+ interface AuthenticatorData {
430
+ rpIdHash: Uint8Array;
431
+ flags: {
432
+ userPresent: boolean;
433
+ userVerified: boolean;
434
+ attestedCredentialData: boolean;
435
+ extensionDataIncluded?: boolean;
436
+ };
437
+ signCount: number;
438
+ attestedCredentialData?: {
439
+ aaguid: Uint8Array;
440
+ credentialId: Uint8Array;
441
+ publicKey: Uint8Array;
442
+ };
443
+ }
444
+ /**
445
+ * Stored credential (exported as WebAuthnCredential)
446
+ */
447
+ interface WebAuthnCredential {
448
+ id: string;
449
+ credentialId: string;
450
+ userId: string;
451
+ publicKey: string;
452
+ counter: number;
453
+ transports: string[];
454
+ name: string;
455
+ deviceType?: string;
456
+ createdAt: string;
457
+ lastUsedAt?: string;
458
+ }
459
+ /**
460
+ * WebAuthn Provider
461
+ */
462
+ declare class WebAuthnProvider implements TwoFactorProvider {
463
+ readonly name = "webauthn";
464
+ readonly type: "webauthn";
465
+ private storage;
466
+ private config;
467
+ private _enabled;
468
+ constructor(storage: KVStorage, config: WebAuthnConfig);
469
+ get enabled(): boolean;
470
+ /**
471
+ * Generate registration options
472
+ */
473
+ generateRegistrationOptions(userId: string, userName: string, userDisplayName: string, authenticatorType?: 'platform' | 'cross-platform'): Promise<RegistrationOptions>;
474
+ /**
475
+ * Verify registration response
476
+ */
477
+ verifyRegistration(response: RegistrationResponse, challenge: string, credentialName?: string): Promise<{
478
+ success: boolean;
479
+ credentialId?: string;
480
+ error?: string;
481
+ }>;
482
+ /**
483
+ * Generate authentication options
484
+ */
485
+ generateAuthenticationOptions(userId?: string): Promise<AuthenticationOptions>;
486
+ /**
487
+ * Verify authentication response
488
+ */
489
+ verifyAuthentication(response: AuthenticationResponse, challenge: string): Promise<{
490
+ success: boolean;
491
+ userId?: string;
492
+ credentialId?: string;
493
+ error?: string;
494
+ }>;
495
+ /**
496
+ * Get user's credentials
497
+ */
498
+ getUserCredentials(userId: string): Promise<WebAuthnCredential[]>;
499
+ /**
500
+ * Remove a credential
501
+ */
502
+ removeCredential(userId: string, credentialId: string): Promise<boolean>;
503
+ /**
504
+ * Check if user has any passkeys
505
+ */
506
+ hasPasskeys(userId: string): Promise<boolean>;
507
+ /**
508
+ * Setup (for TwoFactorProvider interface)
509
+ */
510
+ setup(userId: string): Promise<TwoFactorSetupResult>;
511
+ /**
512
+ * Verify setup (for TwoFactorProvider interface)
513
+ */
514
+ verifySetup(userId: string, _code: string): Promise<boolean>;
515
+ /**
516
+ * Verify login (for TwoFactorProvider interface)
517
+ */
518
+ verifyLogin(userId: string, _code: string): Promise<boolean>;
519
+ /**
520
+ * Disable 2FA for user
521
+ */
522
+ disable(userId: string): Promise<void>;
523
+ /**
524
+ * Authenticate (for AuthProvider interface)
525
+ */
526
+ authenticate(_input: AuthInput): Promise<AuthResult>;
527
+ /**
528
+ * Get provider info
529
+ */
530
+ getInfo(): ProviderInfo;
531
+ }
532
+ /**
533
+ * Create WebAuthn provider
534
+ */
535
+ declare function createWebAuthnProvider(storage: KVStorage, config: WebAuthnConfig): WebAuthnProvider;
536
+
537
+ /**
538
+ * OAuth Types
539
+ */
540
+ interface OAuthUserInfo {
541
+ /** Provider-specific user ID */
542
+ id: string;
543
+ /** User email */
544
+ email: string;
545
+ /** Display name */
546
+ name?: string;
547
+ /** Avatar URL */
548
+ avatarUrl?: string;
549
+ /** Whether email is verified */
550
+ emailVerified: boolean;
551
+ /** Raw provider response */
552
+ raw: Record<string, unknown>;
553
+ }
554
+ interface OAuthTokens {
555
+ accessToken: string;
556
+ refreshToken?: string;
557
+ expiresIn?: number;
558
+ idToken?: string;
559
+ tokenType?: string;
560
+ scope?: string;
561
+ }
562
+ interface OAuthProviderConfig {
563
+ clientId: string;
564
+ clientSecret: string;
565
+ redirectUri: string;
566
+ scopes?: string[];
567
+ }
568
+ interface GoogleConfig extends OAuthProviderConfig {
569
+ }
570
+ interface GitHubConfig extends OAuthProviderConfig {
571
+ }
572
+ interface MicrosoftConfig extends OAuthProviderConfig {
573
+ tenantId?: string;
574
+ }
575
+ interface AppleConfig {
576
+ clientId: string;
577
+ teamId: string;
578
+ keyId: string;
579
+ privateKey: string;
580
+ redirectUri: string;
581
+ scopes?: string[];
582
+ }
583
+ interface OAuthProvider {
584
+ readonly name: string;
585
+ getAuthorizationUrl(state: string, codeChallenge?: string): Promise<string>;
586
+ exchangeCode(code: string, codeVerifier?: string): Promise<OAuthTokens>;
587
+ getUserInfo(accessToken: string): Promise<OAuthUserInfo>;
588
+ /**
589
+ * Refresh access token using refresh token
590
+ * Not all providers support refresh tokens
591
+ */
592
+ refreshToken?(refreshToken: string): Promise<OAuthTokens>;
593
+ }
594
+ type OAuthProviderName = 'google' | 'github' | 'microsoft' | 'apple';
595
+ interface OAuthState {
596
+ state: string;
597
+ provider: OAuthProviderName;
598
+ codeVerifier?: string;
599
+ tenantId?: string;
600
+ redirectUrl?: string;
601
+ expiresAt: Date;
602
+ }
603
+
604
+ /**
605
+ * OAuth Provider
606
+ * Manages OAuth2 authentication flows with PKCE support
607
+ */
608
+
609
+ /**
610
+ * OAuth configuration
611
+ */
612
+ interface OAuthConfig {
613
+ google?: GoogleConfig;
614
+ github?: GitHubConfig;
615
+ microsoft?: MicrosoftConfig;
616
+ apple?: AppleConfig;
617
+ }
618
+ /**
619
+ * OAuth flow result
620
+ */
621
+ interface OAuthFlowResult {
622
+ authorizationUrl: string;
623
+ state: string;
624
+ }
625
+ /**
626
+ * OAuth callback result
627
+ */
628
+ interface OAuthCallbackResult {
629
+ userInfo: OAuthUserInfo;
630
+ tokens: OAuthTokens;
631
+ tenantId?: string;
632
+ redirectUrl?: string;
633
+ }
634
+ /**
635
+ * Generate PKCE code verifier and challenge
636
+ */
637
+ declare function generatePKCE(): Promise<{
638
+ codeVerifier: string;
639
+ codeChallenge: string;
640
+ }>;
641
+ /**
642
+ * Generate secure random state
643
+ */
644
+ declare function generateState(): string;
645
+ /**
646
+ * OAuth Manager
647
+ * Handles OAuth flows with state management via KVStorage
648
+ */
649
+ declare class OAuthManager {
650
+ private storage;
651
+ private providers;
652
+ private stateExpirySeconds;
653
+ constructor(storage: KVStorage, config: OAuthConfig, options?: {
654
+ stateExpirySeconds?: number;
655
+ });
656
+ /**
657
+ * Get available providers
658
+ */
659
+ getAvailableProviders(): OAuthProviderName[];
660
+ /**
661
+ * Check if a provider is configured
662
+ */
663
+ hasProvider(name: string): boolean;
664
+ /**
665
+ * Get a provider by name
666
+ */
667
+ getProvider(name: string): OAuthProvider | undefined;
668
+ /**
669
+ * Start OAuth flow - returns authorization URL
670
+ */
671
+ startFlow(providerName: OAuthProviderName, options?: {
672
+ tenantId?: string;
673
+ redirectUrl?: string;
674
+ }): Promise<OAuthFlowResult>;
675
+ /**
676
+ * Handle OAuth callback
677
+ */
678
+ handleCallback(providerName: OAuthProviderName, code: string, state: string): Promise<OAuthCallbackResult>;
679
+ /**
680
+ * Refresh OAuth tokens (if supported by provider)
681
+ */
682
+ refreshTokens(providerName: OAuthProviderName, refreshToken: string): Promise<OAuthTokens>;
683
+ /**
684
+ * Check if provider supports token refresh
685
+ */
686
+ supportsRefresh(providerName: OAuthProviderName): boolean;
687
+ }
688
+ /**
689
+ * Create OAuth manager
690
+ */
691
+ declare function createOAuthManager(storage: KVStorage, config: OAuthConfig, options?: {
692
+ stateExpirySeconds?: number;
693
+ }): OAuthManager;
694
+
9
695
  /**
10
696
  * Tenant Manager
11
697
  * CRUD operations for tenants and memberships
@@ -514,6 +1200,8 @@ interface SignInResult {
514
1200
  tokens?: TokenPair;
515
1201
  requiresTwoFactor?: boolean;
516
1202
  twoFactorChallengeId?: string;
1203
+ requiresRedirect?: boolean;
1204
+ redirectUrl?: string;
517
1205
  error?: string;
518
1206
  errorCode?: string;
519
1207
  }
@@ -529,6 +1217,8 @@ interface SignUpInput {
529
1217
  name?: string;
530
1218
  /** Avatar URL */
531
1219
  avatar?: string;
1220
+ /** Whether the auth method should be marked as verified (default: false) */
1221
+ verified?: boolean;
532
1222
  /** Request metadata */
533
1223
  metadata?: {
534
1224
  ipAddress?: string;
@@ -593,6 +1283,7 @@ declare class ParsAuthEngine {
593
1283
  private tenantManager;
594
1284
  private tenantResolver?;
595
1285
  private invitationService?;
1286
+ private oauthManager?;
596
1287
  constructor(config: ParsAuthConfig);
597
1288
  /**
598
1289
  * Initialize the auth engine (async operations)
@@ -763,6 +1454,30 @@ declare class ParsAuthEngine {
763
1454
  * Get tenant resolver instance
764
1455
  */
765
1456
  getTenantResolver(): TenantResolver | undefined;
1457
+ /**
1458
+ * Handle OAuth callback after user authorization
1459
+ */
1460
+ handleOAuthCallback(provider: 'google' | 'github' | 'microsoft' | 'apple', code: string, state: string, metadata?: SignInInput['metadata']): Promise<SignInResult>;
1461
+ /**
1462
+ * Get the OAuth manager
1463
+ */
1464
+ getOAuthManager(): OAuthManager | undefined;
1465
+ /**
1466
+ * Get TOTP provider for 2FA setup
1467
+ */
1468
+ getTOTPProvider(): TOTPProvider | undefined;
1469
+ /**
1470
+ * Get WebAuthn provider for passkey management
1471
+ */
1472
+ getWebAuthnProvider(): WebAuthnProvider | undefined;
1473
+ /**
1474
+ * Get Password provider
1475
+ */
1476
+ getPasswordProvider(): PasswordProvider | undefined;
1477
+ /**
1478
+ * Get Magic Link provider
1479
+ */
1480
+ getMagicLinkProvider(): MagicLinkProvider | undefined;
766
1481
  }
767
1482
 
768
1483
  /**
@@ -1080,4 +1795,4 @@ declare function requireAny(...middlewares: MiddlewareHandler<{
1080
1795
  Variables: AuthVariables;
1081
1796
  }>;
1082
1797
 
1083
- export { type VerifyOtpBody as $, type AuthContext$1 as A, createAuthCookies as B, type CreateTenantInput as C, createLogoutCookies as D, requireRole as E, requirePermission as F, requireAnyPermission as G, requireTenant as H, InvitationService as I, requireTenantAccess as J, requireAdmin as K, requireOwnerOrPermission as L, MultiStrategyTenantResolver as M, requireAll as N, requireAny as O, ParsAuthEngine as P, type AuthVariables as Q, type RefreshTokenResult as R, type SignInInput as S, TenantResolver as T, type UpdateTenantInput as U, type VerifyTokenResult as V, type HonoAdapterConfig as W, type AuthContext as X, type CookieOptions as Y, type AuthResponse as Z, type RequestOtpBody as _, type SignInResult as a, type SignInBody as a0, type RefreshBody as a1, type SignUpInput as b, type SignUpResult as c, type SessionInfo as d, createTenantResolver as e, createMultiStrategyResolver as f, type TenantResolverConfig as g, type TenantResolutionResult as h, TenantManager as i, createTenantManager as j, type AddMemberInput as k, type UpdateMemberInput as l, type TenantWithMembers as m, type UserTenantMembership as n, createInvitationService as o, type InvitationConfig as p, type InvitationRecord as q, type SendInvitationInput as r, type SendInvitationResult as s, type AcceptInvitationInput as t, type AcceptInvitationResult as u, type InvitationStatusResult as v, createAuthMiddleware as w, createOptionalAuthMiddleware as x, createAuthRoutes as y, createHonoAuth as z };
1798
+ export { TOTPProvider as $, type AppleConfig as A, type InvitationStatusResult as B, type CreateTenantInput as C, OAuthManager as D, createOAuthManager as E, generatePKCE as F, type GoogleConfig as G, generateState as H, InvitationService as I, type OAuthConfig as J, type OAuthFlowResult as K, type OAuthCallbackResult as L, type MicrosoftConfig as M, type OAuthState as N, type OAuthProvider as O, ParsAuthEngine as P, type OAuthProviderName as Q, type RefreshTokenResult as R, type SignInInput as S, TenantResolver as T, type UpdateTenantInput as U, type VerifyTokenResult as V, MagicLinkProvider as W, createMagicLinkProvider as X, type MagicLinkConfig as Y, type SendMagicLinkResult as Z, type VerifyMagicLinkResult as _, type OAuthTokens as a, createTOTPProvider as a0, type TOTPConfig as a1, type TOTPSetupData as a2, type TOTPVerifyResult as a3, WebAuthnProvider as a4, createWebAuthnProvider as a5, type WebAuthnConfig as a6, type RegistrationOptions as a7, type AuthenticationOptions as a8, type WebAuthnCredential as a9, type AuthResponse as aA, type RequestOtpBody as aB, type VerifyOtpBody as aC, type SignInBody as aD, type RefreshBody as aE, type ClientDataJSON as aa, type AuthenticatorData as ab, PasswordProvider as ac, createPasswordProvider as ad, type PasswordConfig as ae, type PasswordValidationResult as af, type PasswordStrength as ag, createAuthMiddleware as ah, createOptionalAuthMiddleware as ai, createAuthRoutes as aj, createHonoAuth as ak, createAuthCookies as al, createLogoutCookies as am, requireRole as an, requirePermission as ao, requireAnyPermission as ap, requireTenant as aq, requireTenantAccess as ar, requireAdmin as as, requireOwnerOrPermission as at, requireAll as au, requireAny as av, type AuthVariables as aw, type HonoAdapterConfig as ax, type AuthContext as ay, type CookieOptions as az, type OAuthUserInfo as b, type GitHubConfig as c, type AuthContext$1 as d, type SignInResult as e, type SignUpInput as f, type SignUpResult as g, type SessionInfo as h, MultiStrategyTenantResolver as i, createTenantResolver as j, createMultiStrategyResolver as k, type TenantResolverConfig as l, type TenantResolutionResult as m, TenantManager as n, createTenantManager as o, type AddMemberInput as p, type UpdateMemberInput as q, type TenantWithMembers as r, type UserTenantMembership as s, createInvitationService as t, type InvitationConfig as u, type InvitationRecord as v, type SendInvitationInput as w, type SendInvitationResult as x, type AcceptInvitationInput as y, type AcceptInvitationResult as z };