npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ionic-capacitor-biometric

v1.2.1

Published

Ionic Capacitor Biometric authentication plugin

Downloads

106

Readme

ionic-capacitor-biometric

CI Pipeline npm version

Project Purpose and Goal

The primary goal of this project was personal learning, but I decided to make it public. There are still features to be added, such as Swift tests. If you're interested, feel free to contribute!

Warning: This is not production ready.

Overview

The ionic-capacitor-biometric plugin allows you to add biometric authentication (e.g., Face ID, Touch ID) to your Ionic applications. This plugin supports iOS, and Android support is currently a work in progress.

Installation

Install the plugin using npm:

npm install ionic-capacitor-biometric
npx cap sync

iOS Configuration

To use biometric features on iOS, you need to add a key to your Info.plist file:

<key>NSFaceIDUsageDescription</key>
<string>We need to use Face ID for secure authentication.</string>

This key is required to provide a description for why your app needs access to Face ID or Touch ID.

Android Configuration

Note: Android support is still a work in progress. Check back for updates.

Methods

The plugin provides several methods for interacting with biometric authentication. Below is a list of available methods with examples.

Importing the Plugin

import { IonicCapacitorBiometric } from 'ionic-capacitor-biometric';

1. isAvailable()

Checks if biometric authentication is available and enabled on the device.

try {
  const response = await IonicCapacitorBiometric.isAvailable();
  console.log(response.message);
} catch (error) {
  console.error('Error:', error);
}

2. requestBiometricPermissions()

Requests biometric permissions from the user.

try {
  const response = await IonicCapacitorBiometric.requestBiometricPermissions();
  console.log(response.message);
} catch (error) {
  console.error('Error:', error);
}

3. authenticate()

Authenticates the user using biometrics.

try {
  const response = await IonicCapacitorBiometric.authenticate();
  console.log(response.message);
} catch (error) {
  console.error('Error:', error);
}

4. storeCredentials(options)

Stores user credentials securely in the keychain.

try {
  const response = await IonicCapacitorBiometric.storeCredentials({ username: 'user123', trustedToken: 'secureToken' });
  console.log(response.message);
} catch (error) {
  console.error('Error:', error);
}

5. retrieveCredentials()

Retrieves user credentials from the keychain.

try {
  const response = await IonicCapacitorBiometric.retrieveCredentials();
  console.log(response.message);
  console.log('Username:', response.username);
  console.log('Trusted Token:', response.trustedToken);
} catch (error) {
  console.error('Error:', error);
}

Security

  • iOS: Trusted tokens are stored securely in the iOS Keychain, which is a secure storage mechanism provided by the operating system. The Keychain is designed to protect sensitive information, such as passwords and authentication tokens, ensuring they are encrypted and accessible only by authorized processes. This provides a high level of security and helps users trust that their credentials are safely managed.

Notes

  • iOS: Ensure that you have added the necessary key (NSFaceIDUsageDescription) to your Info.plist file to avoid runtime errors.
  • Android: The Android implementation is still under development and will be released in a future update.

License

This project is licensed under the MIT License.