// =================== // © AngelaMos | 2025 // PasskeyButton.tsx // =================== import type { JSX } from 'solid-js' import { createSignal, onMount, Show } from 'solid-js' import { isPlatformAuthenticatorAvailable, isWebAuthnSupported, } from '../../services' import { Button } from '../UI/Button' interface PasskeyButtonProps { mode: 'register' | 'login' onClick: () => void | Promise loading?: boolean disabled?: boolean class?: string } export function PasskeyButton(props: PasskeyButtonProps): JSX.Element { const [webAuthnSupported, setWebAuthnSupported] = createSignal(true) const [platformAvailable, setPlatformAvailable] = createSignal(false) onMount(() => { const supported = isWebAuthnSupported() setWebAuthnSupported(supported) if (supported) { void isPlatformAuthenticatorAvailable().then((available) => { setPlatformAvailable(available) }) } }) const buttonText = (): string => { if (!webAuthnSupported()) { return 'WEBAUTHN NOT SUPPORTED' } return props.mode === 'register' ? 'REGISTER WITH PASSKEY' : 'LOGIN WITH PASSKEY' } const isDisabled = (): boolean => { return !webAuthnSupported() || (props.disabled ?? false) } return (

YOUR BROWSER DOES NOT SUPPORT PASSKEYS

BIOMETRIC AUTH AVAILABLE

) } function PasskeyIcon(): JSX.Element { return ( ) }