mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-20 16:09:25 +02:00
feat(auth): structured error codes + conditional passkey UI
- Add AuthErrorCode union and typed twoFactorRedirect/retryAfter fields on AuthResult so the frontend can branch on stable codes instead of locale-dependent error strings.
- Extend signInWithPasskey with an optional { conditional } flag, threaded through to @simplewebauthn/browser via useBrowserAutofill, so hosts can opt into WebAuthn Conditional UI (passkey suggestions inline in the email autofill dropdown).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3c91691d26
commit
ff7dc5d875
4 changed files with 35 additions and 7 deletions
|
|
@ -186,11 +186,11 @@ export function createManaAuthStore(config: ManaAuthStoreConfig = {}) {
|
|||
return authService.isPasskeyAvailable();
|
||||
},
|
||||
|
||||
async signInWithPasskey() {
|
||||
async signInWithPasskey(options?: { conditional?: boolean }) {
|
||||
const authService = getAuthService();
|
||||
if (!authService) return { success: false, error: 'Auth not available on server' };
|
||||
try {
|
||||
const result = await authService.signInWithPasskey();
|
||||
const result = await authService.signInWithPasskey(options);
|
||||
if (!result.success)
|
||||
return { success: false, error: result.error || 'Passkey authentication failed' };
|
||||
user = await authService.getUserFromToken();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue