docs(android-fingerprint-auth): add missing interfaces

This commit is contained in:
Daniel 2018-04-08 18:46:21 +02:00
parent d8f030b67d
commit dd4d35d9e0

View File

@ -1,9 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
export interface AFAAuthOptions { export interface AFAAuthOptions {
/** /**
* Required * Required
* Used as the alias for your key in the Android Key Store. * Used as the alias for your key in the Android Key Store.
@ -62,7 +60,6 @@ export interface AFAAuthOptions {
* Set the hint displayed by the fingerprint icon on the fingerprint authentication dialog. * Set the hint displayed by the fingerprint icon on the fingerprint authentication dialog.
*/ */
dialogHint?: string; dialogHint?: string;
} }
export interface AFADecryptOptions { export interface AFADecryptOptions {
@ -96,6 +93,17 @@ export interface AFAEncryptResponse {
token: string; token: string;
} }
export interface AFAAvailableResponse {
isAvailable: boolean;
isHardwareDetected: boolean;
hasEnrolledFingerprints: boolean;
}
export interface AFADeleteOptions {
clientId: string;
username: string;
}
/** /**
* @name Android Fingerprint Auth * @name Android Fingerprint Auth
* @description * @description
@ -139,6 +147,8 @@ export interface AFAEncryptResponse {
* AFAAuthOptions * AFAAuthOptions
* AFAEncryptResponse * AFAEncryptResponse
* AFADecryptOptions * AFADecryptOptions
* AFAAvailableResponse
* AFADeleteOptions
*/ */
@Plugin({ @Plugin({
pluginName: 'AndroidFingerprintAuth', pluginName: 'AndroidFingerprintAuth',
@ -149,55 +159,63 @@ export interface AFAEncryptResponse {
}) })
@Injectable() @Injectable()
export class AndroidFingerprintAuth extends IonicNativePlugin { export class AndroidFingerprintAuth extends IonicNativePlugin {
ERRORS: { ERRORS: {
BAD_PADDING_EXCEPTION: 'BAD_PADDING_EXCEPTION', BAD_PADDING_EXCEPTION: 'BAD_PADDING_EXCEPTION';
CERTIFICATE_EXCEPTION: 'CERTIFICATE_EXCEPTION', CERTIFICATE_EXCEPTION: 'CERTIFICATE_EXCEPTION';
FINGERPRINT_CANCELLED: 'FINGERPRINT_CANCELLED', FINGERPRINT_CANCELLED: 'FINGERPRINT_CANCELLED';
FINGERPRINT_DATA_NOT_DELETED: 'FINGERPRINT_DATA_NOT_DELETED', FINGERPRINT_DATA_NOT_DELETED: 'FINGERPRINT_DATA_NOT_DELETED';
FINGERPRINT_ERROR: 'FINGERPRINT_ERROR', FINGERPRINT_ERROR: 'FINGERPRINT_ERROR';
FINGERPRINT_NOT_AVAILABLE: 'FINGERPRINT_NOT_AVAILABLE', FINGERPRINT_NOT_AVAILABLE: 'FINGERPRINT_NOT_AVAILABLE';
FINGERPRINT_PERMISSION_DENIED: 'FINGERPRINT_PERMISSION_DENIED', FINGERPRINT_PERMISSION_DENIED: 'FINGERPRINT_PERMISSION_DENIED';
FINGERPRINT_PERMISSION_DENIED_SHOW_REQUEST: 'FINGERPRINT_PERMISSION_DENIED_SHOW_REQUEST', FINGERPRINT_PERMISSION_DENIED_SHOW_REQUEST: 'FINGERPRINT_PERMISSION_DENIED_SHOW_REQUEST';
ILLEGAL_BLOCK_SIZE_EXCEPTION: 'ILLEGAL_BLOCK_SIZE_EXCEPTION', ILLEGAL_BLOCK_SIZE_EXCEPTION: 'ILLEGAL_BLOCK_SIZE_EXCEPTION';
INIT_CIPHER_FAILED: 'INIT_CIPHER_FAILED', INIT_CIPHER_FAILED: 'INIT_CIPHER_FAILED';
INVALID_ALGORITHM_PARAMETER_EXCEPTION: 'INVALID_ALGORITHM_PARAMETER_EXCEPTION', INVALID_ALGORITHM_PARAMETER_EXCEPTION: 'INVALID_ALGORITHM_PARAMETER_EXCEPTION';
IO_EXCEPTION: 'IO_EXCEPTION', IO_EXCEPTION: 'IO_EXCEPTION';
JSON_EXCEPTION: 'JSON_EXCEPTION', JSON_EXCEPTION: 'JSON_EXCEPTION';
MINIMUM_SDK: 'MINIMUM_SDK', MINIMUM_SDK: 'MINIMUM_SDK';
MISSING_ACTION_PARAMETERS: 'MISSING_ACTION_PARAMETERS', MISSING_ACTION_PARAMETERS: 'MISSING_ACTION_PARAMETERS';
MISSING_PARAMETERS: 'MISSING_PARAMETERS', MISSING_PARAMETERS: 'MISSING_PARAMETERS';
NO_SUCH_ALGORITHM_EXCEPTION: 'NO_SUCH_ALGORITHM_EXCEPTION', NO_SUCH_ALGORITHM_EXCEPTION: 'NO_SUCH_ALGORITHM_EXCEPTION';
SECURITY_EXCEPTION: 'SECURITY_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. * Opens a native dialog fragment to use the device hardware fingerprint scanner to authenticate against fingerprints registered for the device.
* @param options {AFAAuthOptions} Options * @param {AFAAuthOptions} options Options
* @returns {Promise<any>} * @returns {Promise<AFAEncryptResponse>}
*/ */
@Cordova() @Cordova()
encrypt(options: AFAAuthOptions): Promise<AFAEncryptResponse> { return; } encrypt(options: AFAAuthOptions): Promise<AFAEncryptResponse> {
return;
}
/** /**
* Opens a native dialog fragment to use the device hardware fingerprint scanner to authenticate against fingerprints registered for the device. * Opens a native dialog fragment to use the device hardware fingerprint scanner to authenticate against fingerprints registered for the device.
* @param options {AFAAuthOptions} Options * @param {AFAAuthOptions} options Options
* @returns {Promise<any>} * @returns {Promise<AFADecryptOptions>}
*/ */
@Cordova() @Cordova()
decrypt(options: AFAAuthOptions): Promise<AFADecryptOptions> { return; } decrypt(options: AFAAuthOptions): Promise<AFADecryptOptions> {
return;
}
/** /**
* Check if service is available * Check if service is available
* @returns {Promise<any>} Returns a Promise that resolves if fingerprint auth is available on the device * @returns {Promise<AFAAvailableResponse>} Returns a Promise that resolves if fingerprint auth is available on the device
*/ */
@Cordova() @Cordova()
isAvailable(): Promise<{ isAvailable: boolean, isHardwareDetected: boolean, hasEnrolledFingerprints: boolean }> { return; } isAvailable(): Promise<AFAAvailableResponse> {
return;
}
/** /**
* Delete the cipher used for encryption and decryption by username * Delete the cipher used for encryption and decryption by username
* @returns {Promise<any>} Returns a Promise that resolves if the cipher was successfully deleted * @param {AFADeleteOptions} options Options
* @returns {Promise<{ deleted: boolean }>} Returns a Promise that resolves if the cipher was successfully deleted
*/ */
@Cordova() @Cordova()
delete(options: { clientId: string; username: string; }): Promise<{ deleted: boolean }> { return; } delete(options: AFADeleteOptions): Promise<{ deleted: boolean }> {
return;
}
} }