使用@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 为 Getting Started 的实现细节 @capgo/capacitor-social-login 的实现细节 为 @capgo/capacitor-social-login 的实现细节 @capgo/capacitor-passkey 的实现细节 为 @capgo/capacitor-passkey 的实现细节, 和 双因素认证 为双因素认证的实现细节