简体   繁体   English

使用 JS 确定设备的生物识别能力

[英]Determining the biometric capability of a device using JS

I am trying to detect if a browser on the device running my app supports biometric capability, using Javascript. Specifically, I would like to detect, if the device is capable of FaceId or TouchId.我正在尝试使用 Javascript 检测运行我的应用程序的设备上的浏览器是否支持生物识别功能。具体来说,我想检测设备是否支持 FaceId 或 TouchId。 I know that though WebAuthn you can do this:我知道虽然 WebAuthn 你可以这样做:

if (window.PublicKeyCredential) {
 PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()
   .then((available) => {
     if (available) {
       console.log("Supported.");
     } else {
       console.log(
         "WebAuthn supported, Platform Authenticator *not* supported."
       );
     }
   })
   .catch((err) => console.log("Something went wrong."));
} else {
 console.log("Not supported.");
}

But, this would only let me know if the device is biometric capable.但是,这只会让我知道该设备是否具有生物识别功能。 It wouldn't distinguish between FaceId or TouchId.它不会区分 FaceId 或 TouchId。 How do I get that level of detail through Javascript?我如何通过 Javascript 获得该级别的详细信息?

isUserVerifyingPlatformAuthenticatorAvailable does not mean a biometric. isUserVerifyingPlatformAuthenticatorAvailable并不意味着生物识别。 It means a platform authenticator with user verification capabilities.是指具有用户验证能力的平台认证器。 User verification could be a PIN, local password, or biometric.用户验证可以是 PIN、本地密码或生物识别。

The biometric capabilities of a platform authenticator are not currently disclosed via WebAuthn.平台身份验证器的生物识别功能目前未通过 WebAuthn 公开。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM