Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(AndroidFingerprintAuth): add Errors #1470

Merged
merged 3 commits into from
May 9, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions src/@ionic-native/plugins/android-fingerprint-auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export interface AFAEncryptResponse {
* 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, AFAAuthOptions } from '@ionic-native/android-fingerprint-auth';
* import { AndroidFingerprintAuth } from '@ionic-native/android-fingerprint-auth';
*
* constructor(private androidFingerprintAuth: AndroidFingerprintAuth) { }
*
Expand All @@ -124,7 +124,7 @@ export interface AFAEncryptResponse {
* } else console.log('Didn\'t authenticate!');
* })
* .catch(error => {
* if (error === 'Cancelled') {
* if (error === this.androidFingerprintAuth.ERRORS.FINGERPRINT_CANCELLED) {
* console.log('Fingerprint authentication cancelled');
* } else console.error(error)
* });
Expand All @@ -150,6 +150,27 @@ export interface AFAEncryptResponse {
@Injectable()
export class AndroidFingerprintAuth extends IonicNativePlugin {

ERRORS: {
BAD_PADDING_EXCEPTION: 'BAD_PADDING_EXCEPTION',
CERTIFICATE_EXCEPTION: 'CERTIFICATE_EXCEPTION',
FINGERPRINT_CANCELLED: 'FINGERPRINT_CANCELLED',
FINGERPRINT_DATA_NOT_DELETED: 'FINGERPRINT_DATA_NOT_DELETED',
FINGERPRINT_ERROR: 'FINGERPRINT_ERROR',
FINGERPRINT_NOT_AVAILABLE: 'FINGERPRINT_NOT_AVAILABLE',
FINGERPRINT_PERMISSION_DENIED: 'FINGERPRINT_PERMISSION_DENIED',
FINGERPRINT_PERMISSION_DENIED_SHOW_REQUEST: 'FINGERPRINT_PERMISSION_DENIED_SHOW_REQUEST',
ILLEGAL_BLOCK_SIZE_EXCEPTION: 'ILLEGAL_BLOCK_SIZE_EXCEPTION',
INIT_CIPHER_FAILED: 'INIT_CIPHER_FAILED',
INVALID_ALGORITHM_PARAMETER_EXCEPTION: 'INVALID_ALGORITHM_PARAMETER_EXCEPTION',
IO_EXCEPTION: 'IO_EXCEPTION',
JSON_EXCEPTION: 'JSON_EXCEPTION',
MINIMUM_SDK: 'MINIMUM_SDK',
MISSING_ACTION_PARAMETERS: 'MISSING_ACTION_PARAMETERS',
MISSING_PARAMETERS: 'MISSING_PARAMETERS',
NO_SUCH_ALGORITHM_EXCEPTION: 'NO_SUCH_ALGORITHM_EXCEPTION',
SECURITY_EXCEPTION: 'SECURITY_EXCEPTION'
};

/**
* Opens a native dialog fragment to use the device hardware fingerprint scanner to authenticate against fingerprints registered for the device.
* @param options {AFAAuthOptions} Options
Expand Down