Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

capacitor-biometric-auth

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

capacitor-biometric-auth

Complete

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
121
decreased by-15.97%
Maintainers
1
Weekly downloads
 
Created
Source

Capacitor Biometric Auth

NPM Downloads CI

Installation

  • npm i capacitor-biometric-auth
  • yarn add capacitor-biometric-auth

Setup

Don't for get to run npx cap sync before doing the next steps.

Android

To get android working please add this code to your MainActivity file.

MainActivity.java

++ import com.ahm.capacitor.biometric.BiometricAuth;

this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
++ add(BiometricAuth.class);
}});

IOS

@TODO

Usage

import { Plugins } from "@capacitor/core";

const { BiometricAuth } = Plugins;

const available = await BiometricAuth.isAvailable()

if (available.has) {
  const authResult = await BiometricAuth.verify({...})
  if (authResult.verified) {
    // success authentication
  } else {
    // fail authentication
  }
} else {
  // biometric not available
}

Methods

verify(options)

Open biometric popup

optionvaluesdecription
reasonany stringPopup label for iOS
titleany stringTitle of prompt in Android
subTitleany stringSubtitle of prompt in Android
descriptionany stringDescription of prompt in Android
cancelany stringText for cancel button on prompt in Android
const result = await BiometricAuth.verify({reason: "Message ..."})

result

{
  verified: true // true if biometric auth was succes or false otherwise,
  status: {} // an object with errors matching biometric auth fails (on if verified === false)
}

status

errordescription
10The user failed to provide valid credentials
11Authentication was cancelled by application
12The context is invalid
13Not interactive
14Passcode is not set on the device
15Authentication was cancelled by the system
16The user did cancel
17The user chose to use the fallback

isAvailable()

Checks if biometric is enabled

const result = await BiometricAuth.isAvailable()

result

{
  has: true, // true if has biometric auth enabled, false otherwise
  status: {...} // an object with errors
}

status

errordescription
1Biometric not available
2Authentication could not continue because the user has been locked out of biometric authentication, due to failing authentication too many times.
3Authentication could not start because the user has not enrolled in biometric authentication.

Keywords

FAQs

Package last updated on 26 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc