capacitor-biometric
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Capacitor Face ID Plugin

npm version

Allow users to authenticate with Face ID or Touch ID on iOS devices

Logo

Instalation

npm install capacitor-biometric

iOS Notes

iOS requires the following usage description be added and filled out for your app in Info.plist:

Name: Privacy - Face ID Usage Description
Key: NSFaceIDUsageDescription

Example

import { Plugins, PluginResultError } from '@capacitor/core';
 
const { FaceId } = Plugins;
 
...
// check if device supports Face ID or Touch ID
FaceId.isAvailable().then(checkResult => {
  if(checkResult.value) {
    FaceId.auth().then(() => {
      console.log('authenticated');
    }).catch((error: PluginResultError) => {
      // handle rejection errors
      console.error(error.message);
    });
  } else {
    // use custom fallback authentication here
  }
});
 

API

Method Default Type Description
isAvailable() Promise<{ value: string }> Checks if Face ID or Touch ID is available, and returns type if so.
auth(options?: {reason?: string}) options: {reason: "Access requires authentication"} Promise<void> Displays the Face ID or Touch ID screen

Readme

Keywords

Package Sidebar

Install

npm i capacitor-biometric

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

190 kB

Total Files

62

Last publish

Collaborators

  • mkwjs