Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private async updateState() {
this.setState({
hasHardware: await LocalAuthentication.hasHardwareAsync()
});
}
}
async checkDevicePossibilities() {
const hasHardware = await LocalAuthentication.hasHardwareAsync();
const isEnrolled = await LocalAuthentication.isEnrolledAsync();
this.setState({ hasHardware, isEnrolled });
}
async checkDevicePossibilities() {
const hasHardware = await LocalAuthentication.hasHardwareAsync();
const isEnrolled = await LocalAuthentication.isEnrolledAsync();
this.setState({ hasHardware, isEnrolled });
}
.map(type => {
switch (type) {
case LocalAuthentication.AuthenticationType.FINGERPRINT:
return 'FINGERPRINT';
case LocalAuthentication.AuthenticationType.FACIAL_RECOGNITION:
return 'FACIAL_RECOGNITION';
default:
throw new Error(`Unrecognised authentication type returned: '${type}'`);
}
})
.join(', ');
private async authenticate() {
const authenticated = await LocalAuthentication.authenticateAsync({
promptMessage: "Authentication message"
});
if (authenticated.success) {
this.setState({
authenticationError: "None"
});
} else {
this.setState({
authenticationError: authenticated.error
});
}
this.setState({
authenticated: authenticated.success
});
checkAuthenticationsTypes = async () => {
const result = await LocalAuthentication.supportedAuthenticationTypesAsync();
const stringResult = result
.map(type => {
switch (type) {
case LocalAuthentication.AuthenticationType.FINGERPRINT:
return 'FINGERPRINT';
case LocalAuthentication.AuthenticationType.FACIAL_RECOGNITION:
return 'FACIAL_RECOGNITION';
default:
throw new Error(`Unrecognised authentication type returned: '${type}'`);
}
})
.join(', ');
alert(stringResult ? `Available types: ${stringResult}` : 'No available authentication types!');
};