0.1.2 • Published 2 years ago

capacitor4-fingerprint-auth v0.1.2

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
2 years ago

Capacitor4 FingerPrint Auth

npm npm Build Status

Installation

  • npm i capacitor4-fingerprint-auth

Usage

import { FingerPrintAuth } from 'capacitor4-fingerprint-auth';
const auth = new FingerPrintAuth();
const data = await auth.available();
//
const hasFingerPrintOrFaceAuth = data.has;
const touch = data.touch;
const face = data.face;

auth.verify(
    {
        title: 'Android title', // optional title (used only on Android)
        message: 'Scan your finger', // optional (used on both platforms) - for FaceID on iOS see the notes about NSFaceIDUsageDescription
        authenticationValidityDuration: 10, // optional (used on Android, default 5)
        useCustomAndroidUI: false, // set to true to use a different authentication screen (see below)
        fallbackTitle: "Enter your PaSsWorD ", //The localized title for the fallback button in the dialog presented to the user during authentication.
        cancelTitle:"Get me out //The localized title for the cancel button in the dialog presented to the user during authentication"
    })
    .then(() => console.log("Biometric ID OK"))
    .catch(err => console.log(`Biometric ID NOT OK: ${JSON.stringify(err)}`)
    );

await auth.verifyWithFallback(); //Falls back to password on IOS

Api

MethodDefaultTypeDescription
available()Promise<any>Checks if the device has fingerprint/touch id / faceid support
verify()Promise<any>Shows the prompt
verifyWithFallback()Promise<any>Falls back to passcode IOS

verify

auth.verify(
	{
	  title: 'Android title', // optional title (used only on Android)
	  message: 'Scan your finger', // optional (used on both platforms) - for FaceID on iOS see the notes about NSFaceIDUsageDescription
	  authenticationValidityDuration: 10, // optional (used on Android, default 5)
	  useCustomAndroidUI: false // set to true to use a different authentication screen (see below)
      fallbackTitle: "Enter your PaSsWorD " //The localized title for the fallback button in the dialog presented to the user during authentication.
      cancelTitle:"Get me out //The localized title for the cancel button in the dialog presented to the user during authentication"
	})
	.then(() => console.log("Biometric ID OK"))
	.catch(err => console.log(`Biometric ID NOT OK: ${JSON.stringify(err)}`)
	);

Face ID (iOS)

iOS 11 added support for Face ID and was first supported by the iPhone X. The developer needs to provide a value for NSFaceIDUsageDescription, otherwise your app may crash.

You can provide this value (the reason for using Face ID) by adding something like this to App/info.plist:

<key>NSFaceIDUsageDescription</key>
<string>For easy authentication with our app.</string>

Example Image

IOSAndroid
Coming SoonComing Soon
0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago