使用 @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);
完整参考
- GitHub: https://github.com/Cap-go/capacitor-native-biometric/
- 文档:/docs/plugins/native-biometric/
继续使用@capgo/capacitor-native-biometric
如果您正在使用 使用@capgo/capacitor-native-biometric 以规划身份验证和帐户流程,连接它与 @capgo/capacitor-native-biometric 为 @capgo/capacitor-native-biometric 的实现细节 开始使用 为 Getting Started 的实现细节 @capgo/capacitor-social-login 为 @capgo/capacitor-social-login 的实现细节 @capgo/capacitor-passkey 为 @capgo/capacitor-passkey 的实现细节, 和 双因素认证 为双因素认证的实现细节。