mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-21 00:23:00 +08:00
parent
b8f475f188
commit
df326f773f
@ -6,6 +6,7 @@ declare var window;
|
||||
|
||||
import {ActionSheet} from './plugins/actionsheet';
|
||||
import {AdMob} from './plugins/admob';
|
||||
import { AndroidFingerprintAuth } from './plugins/android-fingerprint-auth';
|
||||
import {AppAvailability} from './plugins/appavailability';
|
||||
import {AppRate} from './plugins/apprate';
|
||||
import {AppVersion} from './plugins/appversion';
|
||||
@ -109,6 +110,7 @@ export * from './plugins/twitter-connect';
|
||||
export {
|
||||
ActionSheet,
|
||||
AdMob,
|
||||
AndroidFingerprintAuth,
|
||||
AppAvailability,
|
||||
AppRate,
|
||||
AppVersion,
|
||||
@ -159,6 +161,7 @@ export * from './plugins/plugin';
|
||||
window['IonicNative'] = {
|
||||
ActionSheet: ActionSheet,
|
||||
AdMob: AdMob,
|
||||
AndroidFingerprintAuth: AndroidFingerprintAuth,
|
||||
AppAvailability: AppAvailability,
|
||||
AppRate: AppRate,
|
||||
AppVersion: AppVersion,
|
||||
|
77
src/plugins/android-fingerprint-auth.ts
Normal file
77
src/plugins/android-fingerprint-auth.ts
Normal file
@ -0,0 +1,77 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
/**
|
||||
* @name Android Fingerprint Auth
|
||||
* @description
|
||||
* This plugin will open a native dialog fragment prompting the user to authenticate using their fingerprint. If the device has a secure lockscreen (pattern, PIN, or password), the user may opt to authenticate using that method as a backup.
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { AndroidFingerprintAuth } from 'ionic-native';
|
||||
*
|
||||
* AndroidFingerprintAuth.isAvailable()
|
||||
* .then((result)=> {
|
||||
* if(result.isAvailable){
|
||||
* // it is available
|
||||
*
|
||||
* AndroidFingerprintAuth.show({ clientId: "myAppName", clientSecret: "so_encrypted_much_secure_very_secret" })
|
||||
* .then(result => {
|
||||
* if(result.withFingerprint) {
|
||||
* console.log('Successfully authenticated with fingerprint!');
|
||||
* } else if(result.withPassword) {
|
||||
* console.log('Successfully authenticated with backup password!');
|
||||
* } else console.log('Didn\'t authenticate!');
|
||||
* })
|
||||
* .catch(error => console.error(error));
|
||||
*
|
||||
* } else {
|
||||
* // fingerprint auth isn't available
|
||||
* }
|
||||
* })
|
||||
* .catch(error => console.error(error));
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-android-fingerprint-auth',
|
||||
pluginRef: 'FingerprintAuth',
|
||||
repo: 'https://github.com/mjwheatley/cordova-plugin-android-fingerprint-auth'
|
||||
})
|
||||
export class AndroidFingerprintAuth {
|
||||
/**
|
||||
* Opens a native dialog fragment to use the device hardware fingerprint scanner to authenticate against fingerprints registered for the device.
|
||||
* @param params {any}
|
||||
*/
|
||||
@Cordova()
|
||||
static show(params: {
|
||||
/**
|
||||
* Used as the alias for your key in the Android Key Store.
|
||||
*/
|
||||
clientId: string;
|
||||
/**
|
||||
* Used to encrypt the token returned upon successful fingerprint authentication.
|
||||
*/
|
||||
clientSecret: string;
|
||||
/**
|
||||
* Set to true to remove the "USE BACKUP" button
|
||||
*/
|
||||
disableBackup?: boolean;
|
||||
/**
|
||||
* Change the language. (en_US or es)
|
||||
*/
|
||||
locale?: string
|
||||
}): Promise<{
|
||||
/**
|
||||
* Base64 encoded string
|
||||
*/
|
||||
withFingerprint: string;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
withPassword: boolean;
|
||||
}> {return; }
|
||||
|
||||
/**
|
||||
* Check if service is available
|
||||
*/
|
||||
@Cordova()
|
||||
static isAvailable(): Promise<{isAvailable: boolean}> {return; }
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user