UNPKG

onairos

Version:

The Onairos Library is a collection of functions that enable Applications to connect and communicate data with Onairos Identities via User Authorization. Integration for developers is designed to be seamless, simple and effective for all applications

31 lines (29 loc) 895 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.authenticateWithBiometrics = void 0; const authenticateWithBiometrics = async () => { if (!window.PublicKeyCredential) { throw new Error('WebAuthn not supported'); } try { const supported = await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable(); if (!supported) { throw new Error('Biometric authentication not available'); } // Trigger FaceID/TouchID const credential = await navigator.credentials.get({ publicKey: { challenge: new Uint8Array(32), rpId: window.location.hostname, userVerification: 'required' } }); return !!credential; } catch (error) { console.error('Biometric authentication failed:', error); return false; } }; exports.authenticateWithBiometrics = authenticateWithBiometrics;