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

指纹识别

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

指南

原生生物识别教程

使用 @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, 入门 实现细节在入门, @capgo/capacitor-social-login for the implementation detail in @capgo/capacitor-social-login, @capgo/capacitor-passkey for the implementation detail in @capgo/capacitor-passkey, and Two-factor authentication for the implementation detail in Two-factor authentication.