1import{a as m}from"./chunk-GYK24QYJ.js";import{a}from"./chunk-VELJY6X5.js";import{a as t,b as r,d as y}from"./chunk-CR44U6OI.js";import"./chunk-XPNIDFOS.js";import"./chunk-CB6G7DI2.js";import{h as n}from"./chunk-QDSGMOWV.js";var c=class extends m{constructor(){super(...arguments),this.biometryType=t.none,this.biometryTypes=[],this.biometryIsEnrolled=!1,this.deviceIsSecure=!1}checkBiometry(){return n(this,null,function*(){let e=this.biometryType!==t.none,i=e&&this.biometryIsEnrolled,o="",s=r.none;return e?this.biometryIsEnrolled||(o="Biometry is not enrolled",s=r.biometryNotEnrolled):(o="No biometry is available",s=r.biometryNotAvailable),{isAvailable:i,strongBiometryIsAvailable:this.biometryIsEnrolled&&this.hasStrongBiometry(),biometryType:this.biometryType,biometryTypes:this.biometryTypes,deviceIsSecure:this.deviceIsSecure,reason:o,code:s}})}hasStrongBiometry(){return this.biometryTypes.some(e=>e===t.faceId||e===t.touchId||e===t.fingerprintAuthentication)}internalAuthenticate(e){return n(this,null,function*(){let i=yield this.checkBiometry();if(!(i.isAvailable&&confirm(e?.reason||`Authenticate with ${i.biometryTypes.map(o=>a(o)).join(" or ")}
1?`))){if(e?.allowDeviceCredential){if(i.deviceIsSecure){if(confirm("Authenticate with device security?"))return;throw new y("User cancelled",r.userCancel)}else if(i.isAvailable)throw new y("Device is not secure",r.noDeviceCredential)}else if(!i.isAvailable)throw i.biometryType===t.none?new y("Biometry is not available",r.biometryNotAvailable):new y("Biometry is not enrolled",r.biometryNotEnrolled);throw new y("User cancelled",r.userCancel)}})}setBiometryType(e){return n(this,null,function*(){if(e===void 0)return;let i=Array.isArray(e)?e:[e];if(this.biometryTypes=[],this.biometryType=t.none,i.length!==0)if(b(i))this.biometryType=i[0],this.biometryType!==t.none&&(this.biometryTypes=i);else for(let[o,s]of i.entries())h(s)&&(this.biometryType===t.none?this.biometryTypes=[]:this.biometryTypes.push(s),o===0&&(this.biometryType=s))})}setBiometryIsEnrolled(e){return n(this,null,function*(){this.biometryIsEnrolled=e})}setDeviceIsSecure(e){return n(this,null,function*(){this.deviceIsSecure=e})}};function h(l){return Object.values(t).includes(l)}function b(l){return l.every(e=>h(e))}export{c as BiometricAuthWeb};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.