EddyVerbruggen / cordova-plugin-touch-id

:nail_care: 👱‍♂️ Forget passwords, use a fingerprint scanner!
MIT License
214 stars 72 forks source link

Add typing interface (index.d.ts) in `types` folder #85

Open WuglyakBolgoink opened 4 years ago

WuglyakBolgoink commented 4 years ago

it will be great to have this interface in project too. (like https://github.com/apache/cordova-plugin-device)

// Type definitions for cordova-plugin-touch-id
// Project: https://github.com/EddyVerbruggen/cordova-plugin-touch-id
//
// Licensed under the MIT license.

declare enum TouchIDResult {
    TOUCH = 'touch',
    FACE = 'face'
}

/**
 * Scan the fingerprint of your user with the TouchID sensor (iPhone 5S).
 * - Compatible with Cordova Plugman.
 * - Minimum iOS version is 8 (error callbacks will be gracefully invoked on lower versions).
 * - Requires a fingerprint scanner, so an iPhone 5S or newer is required.
 */
interface TouchID {
    isAvailable(successCallback: () => TouchIDResult, errorCallback: () => any): void;

    didFingerprintDatabaseChange(successCallback: () => any, errorCallback: () => any): void;

    verifyFingerprint(message: string, successCallback: () => any, errorCallback: () => any): void;

    verifyFingerprintWithCustomPasswordFallback(message: string, successCallback: () => any, errorCallback: () => any): void;

    verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel(message: string, enterPasswordLabel: string, successCallback: () => any, errorCallback: () => any): void;
}

interface Window {
    plugins: {
        touchid: TouchID
    }
}