expo-local-authentication
Advanced tools
Comparing version 7.0.0 to 8.0.0
@@ -25,3 +25,3 @@ import { UnavailabilityError } from '@unimodules/core'; | ||
} | ||
export async function authenticateAsync(options = { promptMessage: 'Authenticate' }) { | ||
export async function authenticateAsync(options = {}) { | ||
if (!ExpoLocalAuthentication.authenticateAsync) { | ||
@@ -36,4 +36,7 @@ throw new UnavailabilityError('expo-local-authentication', 'authenticateAsync'); | ||
if (Platform.OS === 'ios') { | ||
invariant(typeof options.promptMessage === 'string' && options.promptMessage.length, 'LocalAuthentication.authenticateAsync must be called with a non-empty `options.promptMessage` string on iOS'); | ||
const result = await ExpoLocalAuthentication.authenticateAsync(options); | ||
if (options.hasOwnProperty('promptMessage')) { | ||
invariant(typeof options.promptMessage === 'string' && options.promptMessage.length, 'LocalAuthentication.authenticateAsync : `options.promptMessage` must be a non-empty string.'); | ||
} | ||
const promptMessage = options.promptMessage || 'Authenticate'; | ||
const result = await ExpoLocalAuthentication.authenticateAsync({ ...options, promptMessage }); | ||
if (result.warning) { | ||
@@ -40,0 +43,0 @@ console.warn(result.warning); |
@@ -12,4 +12,4 @@ export declare type LocalAuthenticationResult = { | ||
export declare type AuthOptions = { | ||
promptMessage: string; | ||
promptMessage?: string; | ||
fallbackLabel?: string; | ||
}; |
{ | ||
"name": "expo-local-authentication", | ||
"version": "7.0.0", | ||
"version": "8.0.0", | ||
"description": "Provides an API for FaceID and TouchID (iOS) or the Fingerprint API (Android) to authenticate the user with a face or fingerprint scan.", | ||
@@ -50,3 +50,3 @@ "main": "build/LocalAuthentication.js", | ||
}, | ||
"gitHead": "4e13b3cb88d9205f14bee7764038ab2dd9ef1fbd" | ||
"gitHead": "ec7878b9ce54f2537721218ae0fe4017e4004806" | ||
} |
@@ -21,3 +21,3 @@ # expo-local-authentication | ||
``` | ||
npm install expo-local-authentication | ||
expo install expo-local-authentication | ||
``` | ||
@@ -24,0 +24,0 @@ |
@@ -36,3 +36,3 @@ import { UnavailabilityError } from '@unimodules/core'; | ||
export async function authenticateAsync( | ||
options: AuthOptions = { promptMessage: 'Authenticate' } | ||
options: AuthOptions = {} | ||
): Promise<LocalAuthenticationResult> { | ||
@@ -52,8 +52,11 @@ if (!ExpoLocalAuthentication.authenticateAsync) { | ||
if (Platform.OS === 'ios') { | ||
invariant( | ||
typeof options.promptMessage === 'string' && options.promptMessage.length, | ||
'LocalAuthentication.authenticateAsync must be called with a non-empty `options.promptMessage` string on iOS' | ||
); | ||
if (options.hasOwnProperty('promptMessage')) { | ||
invariant( | ||
typeof options.promptMessage === 'string' && options.promptMessage.length, | ||
'LocalAuthentication.authenticateAsync : `options.promptMessage` must be a non-empty string.' | ||
); | ||
} | ||
const result = await ExpoLocalAuthentication.authenticateAsync(options); | ||
const promptMessage = options.promptMessage || 'Authenticate'; | ||
const result = await ExpoLocalAuthentication.authenticateAsync({ ...options, promptMessage }); | ||
@@ -60,0 +63,0 @@ if (result.warning) { |
@@ -10,4 +10,4 @@ export type LocalAuthenticationResult = { success: true } | { success: false; error: string }; | ||
// iOS only | ||
promptMessage: string; | ||
promptMessage?: string; | ||
fallbackLabel?: string; | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35071
31
262