Füge Unterstützung für Firefox-Browser hinzu, indem die Registrierung von Passkeys ohne bevorzugten Authentifikator-Typ ermöglicht wird.
This commit is contained in:
@@ -393,6 +393,12 @@ const loadPasskeys = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isFirefoxBrowser = () => {
|
||||||
|
if (!process.client) return false
|
||||||
|
const ua = navigator.userAgent || ''
|
||||||
|
return /firefox/i.test(ua)
|
||||||
|
}
|
||||||
|
|
||||||
const addPasskey = async () => {
|
const addPasskey = async () => {
|
||||||
passkeyError.value = ''
|
passkeyError.value = ''
|
||||||
passkeyLoading.value = true
|
passkeyLoading.value = true
|
||||||
@@ -400,13 +406,15 @@ const addPasskey = async () => {
|
|||||||
const name = window.prompt('Name für den Passkey (z.B. "iPhone", "Laptop"):', 'Passkey') || 'Passkey'
|
const name = window.prompt('Name für den Passkey (z.B. "iPhone", "Laptop"):', 'Passkey') || 'Passkey'
|
||||||
const mod = await import('@simplewebauthn/browser')
|
const mod = await import('@simplewebauthn/browser')
|
||||||
|
|
||||||
// Kein preferredAuthenticatorType setzen → kein authenticatorAttachment gesetzt
|
// Firefox/Linux kommt mit localDevice teils nicht klar. Für Chromium bevorzugen wir lokal.
|
||||||
// → Browser (inkl. Firefox) wählt selbst: interner Passkey-Store, Smartphone oder Security Key
|
const registrationOptionsRequest = isFirefoxBrowser()
|
||||||
// Firefox speichert den Passkey dann intern wie ein Passwort (kein Hardware-Key nötig)
|
? { method: 'POST' }
|
||||||
const res = await $fetch('/api/auth/passkeys/registration-options', { method: 'POST' })
|
: { method: 'POST', body: { preferredAuthenticatorType: 'localDevice' } }
|
||||||
|
|
||||||
// @simplewebauthn/browser v13+ erwartet { optionsJSON: options }
|
const res = await $fetch('/api/auth/passkeys/registration-options', registrationOptionsRequest)
|
||||||
const credential = await mod.startRegistration({ optionsJSON: res.options })
|
|
||||||
|
// @simplewebauthn/browser v13+ erwartet { optionsJSON: options }
|
||||||
|
const credential = await mod.startRegistration({ optionsJSON: res.options })
|
||||||
|
|
||||||
await $fetch('/api/auth/passkeys/register', {
|
await $fetch('/api/auth/passkeys/register', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|||||||
Reference in New Issue
Block a user