MIT License

项目介绍

NiklasMerz/cordova-plugin-fingerprint-aio 是一个托管在 GitHub 上的开源项目,主要使用 Java 编写,采用 MIT License 许可证,目前获得 328 个 Star、175 次 Fork。

仓库全名
NiklasMerz/cordova-plugin-fingerprint-aio
开源许可证
MIT License
Star 数
328
Fork 数
175
未关闭 Issue
49

README 摘要

Cordova Plugin Fingerprint All-In-One For Android and iOS This plugin provides a single and simple interface for accessing fingerprint APIs on both Android 6+ and iOS. Features Check if a fingerprint scanner is available Fingerprint authentication Ionic Native support Fallback options FaceID support ⚡️ Works with Capacitor. Try it out ⚡️ Encrypt and save secrets behind a biometric prompt Version 4.0 Version 4.0 of…

完整内容见 GitHub 原始 README 或本页 。

常见问题

cordova-plugin-fingerprint-aio 用什么语言开发?

主要使用 Java 编写,采用 MIT License 许可证,目前有 328 个 Star。

cordova-plugin-fingerprint-aio 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 cordova-plugin-fingerprint-aio 的源码?

可以直接克隆仓库:git clone https://github.com/NiklasMerz/cordova-plugin-fingerprint-aio.git,默认分支为 master;安装与运行步骤见仓库 README。

cordova-plugin-fingerprint-aio 最近还在维护吗?

仓库最近一次更新为 2025年6月29日,当前有 49 个未关闭 Issue;Star 数为 328,可作为社区活跃度的参考。

关于

Cordova Plugin for fingerprint sensors (and FaceID) with Android and iOS support

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

语言占比

Java
JavaScript
Objective-C
Swift

Release

README

Cordova Plugin Fingerprint All-In-One

For Android and iOS

GitHub license Issue Count

NPM

This plugin provides a single and simple interface for accessing fingerprint APIs on both Android 6+ and iOS.

Features

Version 4.0

Version 4.0 of this plugin is a significant upgrade over the previous versions. Previous versions only allowed a visual fingerprint prompt. Version 4.0 allows saving an encrypted secret behind the biometric prompt for true security. Please test it out and report any issues. If this plugin has security issues please check the security policy. If you do audits using this plugin please let me know the results. My email is on my Github profile.

Version 4 was developed almost 100% by other people than me (@NiklasMerz). Please thank these awesome people for their work: @exxbrain, @leolio86400. This is a community driven plugin and I don’t do any real development anymore. But triaging issues and rewiewing and testing PRs is cumbersome work. If you depend on this plugin for your product please consider becoming my sponsor on Github to keep it going for a while. Some day I may consider stop working on it and pass it on to somebody interested.

Version 4.0 is awesome so please us it and let us fix it:smile:.

Platforms

  • Android - Minimum SDK 23
  • iOS - latest XCode is required. Plugin sets Swift version 4.
    • Please set <preference name="SwiftVersion" value="5.0" /> in your config.xml
  • Mac via Catalyst. If you run the iOS platform on a Mac the plugin will ask for the user password and work with like on other platforms.
  • The cordova-osx platform is not supported

How to use

Tutorial about using this plugin with Ionic thanks to Paul Halliday (old plugin version!!)


Install

Install from NPM

cordova plugin add cordova-plugin-fingerprint-aio --save

If you want to set a FaceID description use:

cordova plugin add cordova-plugin-fingerprint-aio --variable FACEID_USAGE_DESCRIPTION="Login now...."

Use the release candidate for testing the latest fixes

You can use preview versions with the rc tag on npm.

cordova plugin add cordova-plugin-fingerprint-aio@rc

Use this Github repo

Get the latest development version. Not recommended!

cordova plugin add https://github.com/NiklasMerz/cordova-plugin-fingerprint-aio.git

Check if fingerprint authentication is available

Fingerprint.isAvailable(isAvailableSuccess, isAvailableError, optionalParams);

    function isAvailableSuccess(result) {
      /*
      result depends on device and os. 
      iPhone X will return 'face' other Android or iOS devices will return 'finger' Android P+ will return 'biometric'
      */
      alert("Fingerprint available");
    }

    function isAvailableError(error) {
      // 'error' will be an object with an error code and message
      alert(error.message);
    }

Optional parameters

  • allowBackup (iOS): If true checks if backup authentication option is available, e.g. passcode. Default: false, which means check for biometrics only.
  • requireStrongBiometrics (Android): If true will only return success if Class 3 (BIOMETRIC_STRONG) Biometrics are enrolled on the device. It is reccomended you use this if planning on using the registerBiometricSecret and loadBiometricSecret methods.

Show authentication dialogue

Fingerprint.show({
      description: "Some biometric description"
    }, successCallback, errorCallback);

    function successCallback(){
      alert("Authentication successful");
    }

    function errorCallback(error){
      alert("Authentication invalid " + error.message);
    }

Optional parameters

  • title: Title in authentication dialogue. Default: "<APP_NAME> Biometric Sign On"
  • subtitle: Subtitle in authentication dialogue. Default: null
  • description: Description in authentication dialogue. Defaults:
    • iOS: "Authenticate" (iOS’ evaluatePolicy() requires this field)
    • Android: null
  • fallbackButtonTitle: Title of fallback button. Defaults:
    • When disableBackup is true
      • "Cancel"
    • When disableBackup is false
      • iOS: "Use PIN"
      • Android: "Use Backup" (Because backup could be anything pin/pattern/password …haven’t figured out a reliable way to determine lock type yet source)
  • disableBackup: If true remove backup option on authentication dialogue. Default: false. This is useful if you want to implement your own fallback.
  • cancelButtonTitle: For cancel button on Android
  • confirmationRequired (Android): If false user confirmation is NOT required after a biometric has been authenticated . Default: true. See docs.

Register secret

Fingerprint.registerBiometricSecret({
      description: "Some biometric description",
      secret: "my-super-secret",
      invalidateOnEnrollment: true,
      disableBackup: true, // always disabled on Android
    }, successCallback, errorCallback);

    function successCallback(){
      alert("Authentication successful");
    }

    function errorCallback(error){
      alert("Authentication invalid " + error.message);
    }

This may show an authentication prompt.

Optional parameters

  • title: Title in authentication dialogue. Default: "<APP_NAME> Biometric Sign On"
  • subtitle: Subtitle in authentication dialogue. Default: null
  • description: Description in authentication dialogue. Defaults:
    • iOS: "Authenticate" (iOS’ evaluatePolicy() requires this field)
    • Android: null
  • fallbackButtonTitle: Title of fallback button. Defaults:
    • When disableBackup is true
      • "Cancel"
    • When disableBackup is false
      • iOS: "Use PIN"
      • Android: "Use Backup" (Because backup could be anything pin/pattern/password …haven’t figured out a reliable way to determine lock type yet source)
  • disableBackup: If true remove backup option on authentication dialogue. Default: false. This is useful if you want to implement your own fallback. NOTE: it will be disabled on Android
  • cancelButtonTitle: For cancel button on Android
  • confirmationRequired (Android): If false user confirmation is NOT required after a biometric has been authenticated . Default: true. See docs.
  • secret: String secret to encrypt and save, use simple strings matching the regex [a-zA-Z0-9-]+
  • invalidateOnEnrollment: If true secret will be deleted when biometry items are deleted or enrolled

Show authentication dialogue and load secret

Fingerprint.loadBiometricSecret({
      description: "Some biometric description",
      disableBackup: true, // always disabled on Android
    }, successCallback, errorCallback);

    function successCallback(secret){
      alert("Authentication successful, secret: " + secret);
    }

    function errorCallback(error){
      alert("Authentication invalid " + error.message);
    }

Optional parameters

  • title: Title in authentication dialogue. Default: "<APP_NAME> Biometric Sign On"
  • subtitle: Subtitle in authentication dialogue. Default: null
  • description: Description in authentication dialogue. Defaults:
    • iOS: "Authenticate" (iOS’ evaluatePolicy() requires this field)
    • Android: null
  • fallbackButtonTitle: Title of fallback button. Defaults:
    • When disableBackup is true
      • "Cancel"
    • When disableBackup is false
      • iOS: "Use PIN"
      • Android: "Use Backup" (Because backup could be anything pin/pattern/password …haven’t figured out a reliable way to determine lock type yet source)
  • disableBackup: If true remove backup option on authentication dialogue. Default: false. This is useful if you want to implement your own fallback. NOTE: it will be disabled on Android
  • cancelButtonTitle: For cancel button on Android
  • confirmationRequired (Android): If false user confirmation is NOT required after a biometric has been authenticated . Default: true. See docs.

Constants

  • BIOMETRIC_UNKNOWN_ERROR = -100;
  • BIOMETRIC_UNAVAILABLE = -101;
  • BIOMETRIC_AUTHENTICATION_FAILED = -102;
  • BIOMETRIC_SDK_NOT_SUPPORTED = -103;
  • BIOMETRIC_HARDWARE_NOT_SUPPORTED = -104;
  • BIOMETRIC_PERMISSION_NOT_GRANTED = -105;
  • BIOMETRIC_NOT_ENROLLED = -106;
  • BIOMETRIC_INTERNAL_PLUGIN_ERROR = -107;
  • BIOMETRIC_DISMISSED = -108;
  • BIOMETRIC_PIN_OR_PATTERN_DISMISSED = -109;
  • BIOMETRIC_SCREEN_GUARD_UNSECURED = -110;
  • BIOMETRIC_LOCKED_OUT = -111;
  • BIOMETRIC_LOCKED_OUT_PERMANENT = -112;
  • BIOMETRIC_SECRET_NOT_FOUND = -113;

Thanks to the authors of the original fingerprint plugins

Some code is refactored from their projects and I learned how to make Cordova plugins from their great plugins:

@EddyVerbruggen and @mjwheatley

Android

iOS

Starting with version 3.0.0 the iOS and Android parts are written from scratch.

License

The project is MIT licensed: MIT.

评论

暂无评论