跳过主要内容
返回插件
@capgo/capacitor-native-biometric
教程
@capgo/capacitor-native-biometric

生物识别

使用 Face ID、Touch ID 和 Android 生物识别 API 进行安全认证

指南

原生生物识别教程

在设备上测试

下载Capgo应用程序,然后扫描QR code。

原生生物识别插件预览二维码code

使用@capgo/capacitor-native-biometric

该插件为 Android 和 iOS 提供原生生物识别 API

安装

bun add @capgo/capacitor-native-biometric
bunx cap sync

此插件暴露的内容

  • isAvailable - 检查生物识别认证硬件是否可用。
  • verifyIdentity - 向用户提示使用生物识别进行认证。
  • getCredentials - 获取给定服务器的存储凭据。
  • setCredentials - 为给定服务器存储指定的凭据。

示例使用

isAvailable

检查生物识别认证硬件是否可用。

import { NativeBiometric } from '@capgo/capacitor-native-biometric';

await NativeBiometric.isAvailable();

verifyIdentity

提示用户使用生物识别进行身份验证。

import { NativeBiometric } from '@capgo/capacitor-native-biometric';

await NativeBiometric.verifyIdentity();

getCredentials

获取给定服务器的存储凭据。

import { NativeBiometric } from '@capgo/capacitor-native-biometric';

await NativeBiometric.getCredentials({} as GetCredentialOptions);

setCredentials

为给定服务器存储给定的凭据。

import { NativeBiometric } from '@capgo/capacitor-native-biometric';

await NativeBiometric.setCredentials({} as SetCredentialOptions);

全局参考

从使用@capgo/capacitor-native-biometric继续

如果您正在使用 使用@capgo/capacitor-native-biometric 来规划身份验证和帐户流程,连接它与 @capgo/capacitor-native-biometric 为 @capgo/capacitor-native-biometric 的实现细节 Getting Started 为 Getting Started 的实现细节 @capgo/capacitor-social-login 的实现细节 为 @capgo/capacitor-social-login 的实现细节 @capgo/capacitor-passkey 的实现细节 为 @capgo/capacitor-passkey 的实现细节, 和 双因素认证 为双因素认证的实现细节