rn-biometric-authentication
Version:
React Native library biometric authentication.
52 lines (51 loc) • 1.83 kB
TypeScript
/**
* Type alias for possible biometry types
*/
export declare type BiometryType = 'TouchID' | 'FaceID' | 'Biometrics';
interface IsSensorAvailableResult {
available: boolean;
biometryType?: BiometryType;
error?: string;
}
interface SimplePromptOptions {
promptMessage: string;
cancelButtonText?: string;
}
interface SimplePromptOptionAndroid extends SimplePromptOptions {
isDeviceAuthEnabled: boolean;
}
interface SimplePromptOptionIOS extends SimplePromptOptions {
fallbackText?: string;
}
interface SimplePromptResult {
success: boolean;
error?: string;
}
declare module ReactNativeBiometricAuth {
/**
* Enum for touch id sensor type
*/
const TouchID = "TouchID";
/**
* Enum for face id sensor type
*/
const FaceID = "FaceID";
/**
* Enum for generic biometrics (this is the only value available on android)
*/
const Biometrics = "Biometrics";
/**
* Returns promise that resolves to an object with object.biometryType = Biometrics | TouchID | FaceID
* @returns {Promise<Object>} Promise that resolves to an object with details about biometrics available
*/
function isSensorAvailable(): Promise<IsSensorAvailableResult>;
/**
* Prompts user with biometrics dialog using the passed in prompt message and
* returns promise that resolves to an object with object.success = true if the user passes,
* object.success = false if the user cancels, and rejects if anything fails
* @param {Object} simplePromptOption
* @returns {Promise<Object>} Promise that resolves an object with details about the biometrics result
*/
function simplePrompt(simplePromptOption: SimplePromptOptionAndroid | SimplePromptOptionIOS): Promise<SimplePromptResult>;
}
export default ReactNativeBiometricAuth;