mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-22 23:08:07 +01:00
ADD: Password/Passcode/Apple Watch unlock for iOS and macOS
This commit is contained in:
parent
9f677330b9
commit
13a0d006e7
4 changed files with 34 additions and 25 deletions
|
@ -1,5 +1,5 @@
|
|||
/* global alert */
|
||||
import Biometrics from 'react-native-biometrics';
|
||||
import FingerprintScanner from 'react-native-fingerprint-scanner';
|
||||
import { Platform, Alert } from 'react-native';
|
||||
import PasscodeAuth from 'react-native-passcode-auth';
|
||||
import * as NavigationService from '../NavigationService';
|
||||
|
@ -10,13 +10,13 @@ const BlueApp = require('../BlueApp');
|
|||
|
||||
export default class Biometric {
|
||||
static STORAGEKEY = 'Biometrics';
|
||||
static FaceID = Biometrics.FaceID;
|
||||
static TouchID = Biometrics.TouchID;
|
||||
static Biometrics = Biometrics.Biometrics;
|
||||
static FaceID = 'Face ID';
|
||||
static TouchID = 'Touch ID';
|
||||
static Biometrics = 'Biometrics';
|
||||
|
||||
static async isDeviceBiometricCapable() {
|
||||
const isDeviceBiometricCapable = await Biometrics.isSensorAvailable();
|
||||
if (isDeviceBiometricCapable.available) {
|
||||
const isDeviceBiometricCapable = await FingerprintScanner.isSensorAvailable();
|
||||
if (isDeviceBiometricCapable) {
|
||||
return true;
|
||||
}
|
||||
Biometric.setBiometricUseEnabled(false);
|
||||
|
@ -25,8 +25,8 @@ export default class Biometric {
|
|||
|
||||
static async biometricType() {
|
||||
try {
|
||||
const isSensorAvailable = await Biometrics.isSensorAvailable();
|
||||
return isSensorAvailable.biometryType;
|
||||
const isSensorAvailable = await FingerprintScanner.isSensorAvailable();
|
||||
return isSensorAvailable;
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ export default class Biometric {
|
|||
static async isBiometricUseCapableAndEnabled() {
|
||||
const isBiometricUseEnabled = await Biometric.isBiometricUseEnabled();
|
||||
const isDeviceBiometricCapable = await Biometric.isDeviceBiometricCapable();
|
||||
console.warn(isBiometricUseEnabled && isDeviceBiometricCapable)
|
||||
return isBiometricUseEnabled && isDeviceBiometricCapable;
|
||||
}
|
||||
|
||||
|
@ -57,8 +58,8 @@ export default class Biometric {
|
|||
const isDeviceBiometricCapable = await Biometric.isDeviceBiometricCapable();
|
||||
if (isDeviceBiometricCapable) {
|
||||
try {
|
||||
const isConfirmed = await Biometrics.simplePrompt({ promptMessage: 'Please confirm your identity.' });
|
||||
return isConfirmed.success;
|
||||
const isConfirmed = await FingerprintScanner.authenticate({ description: 'Please confirm your identity.', fallbackEnabled: true });
|
||||
return isConfirmed;
|
||||
} catch (_e) {
|
||||
return false;
|
||||
}
|
||||
|
@ -109,10 +110,18 @@ export default class Biometric {
|
|||
'Storage',
|
||||
`You have attempted to enter your password 10 times. Would you like to reset your storage? This will remove all wallets and decrypt your storage.`,
|
||||
[
|
||||
{ text: loc._.cancel, onPress: () => {
|
||||
NavigationService.dispatch(CommonActions.setParams({index: 0, routes: [
|
||||
{ name: 'UnlockWithScreenRoot' }, { params: { unlockOnComponentMount: false }}]}));
|
||||
}, style: 'cancel' },
|
||||
{
|
||||
text: loc._.cancel,
|
||||
onPress: () => {
|
||||
NavigationService.dispatch(
|
||||
CommonActions.setParams({
|
||||
index: 0,
|
||||
routes: [{ name: 'UnlockWithScreenRoot' }, { params: { unlockOnComponentMount: false } }],
|
||||
}),
|
||||
);
|
||||
},
|
||||
style: 'cancel',
|
||||
},
|
||||
{
|
||||
text: loc._.ok,
|
||||
onPress: () => Biometric.requestDevicePasscode(),
|
||||
|
|
|
@ -244,8 +244,6 @@ PODS:
|
|||
- React-cxxreact (= 0.62.2)
|
||||
- React-jsi (= 0.62.2)
|
||||
- React-jsinspector (0.62.2)
|
||||
- react-native-biometrics (2.0.0):
|
||||
- React
|
||||
- react-native-blue-crypto (1.0.0):
|
||||
- React
|
||||
- react-native-blur (0.8.0):
|
||||
|
@ -260,6 +258,8 @@ PODS:
|
|||
- React
|
||||
- react-native-document-picker (3.5.4):
|
||||
- React
|
||||
- react-native-fingerprint-scanner (6.0.0):
|
||||
- React
|
||||
- react-native-geolocation (2.0.2):
|
||||
- React
|
||||
- react-native-image-picker (2.3.3):
|
||||
|
@ -435,11 +435,11 @@ DEPENDENCIES:
|
|||
- React-jsi (from `../node_modules/react-native/ReactCommon/jsi`)
|
||||
- React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
|
||||
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
|
||||
- react-native-biometrics (from `../node_modules/react-native-biometrics`)
|
||||
- react-native-blue-crypto (from `../node_modules/react-native-blue-crypto`)
|
||||
- "react-native-blur (from `../node_modules/@react-native-community/blur`)"
|
||||
- react-native-camera (from `../node_modules/react-native-camera`)
|
||||
- react-native-document-picker (from `../node_modules/react-native-document-picker`)
|
||||
- react-native-fingerprint-scanner (from `../node_modules/react-native-fingerprint-scanner`)
|
||||
- "react-native-geolocation (from `../node_modules/@react-native-community/geolocation`)"
|
||||
- react-native-image-picker (from `../node_modules/react-native-image-picker`)
|
||||
- react-native-randombytes (from `../node_modules/react-native-randombytes`)
|
||||
|
@ -540,8 +540,6 @@ EXTERNAL SOURCES:
|
|||
:path: "../node_modules/react-native/ReactCommon/jsiexecutor"
|
||||
React-jsinspector:
|
||||
:path: "../node_modules/react-native/ReactCommon/jsinspector"
|
||||
react-native-biometrics:
|
||||
:path: "../node_modules/react-native-biometrics"
|
||||
react-native-blue-crypto:
|
||||
:path: "../node_modules/react-native-blue-crypto"
|
||||
react-native-blur:
|
||||
|
@ -550,6 +548,8 @@ EXTERNAL SOURCES:
|
|||
:path: "../node_modules/react-native-camera"
|
||||
react-native-document-picker:
|
||||
:path: "../node_modules/react-native-document-picker"
|
||||
react-native-fingerprint-scanner:
|
||||
:path: "../node_modules/react-native-fingerprint-scanner"
|
||||
react-native-geolocation:
|
||||
:path: "../node_modules/@react-native-community/geolocation"
|
||||
react-native-image-picker:
|
||||
|
@ -670,11 +670,11 @@ SPEC CHECKSUMS:
|
|||
React-jsi: b6dc94a6a12ff98e8877287a0b7620d365201161
|
||||
React-jsiexecutor: 1540d1c01bb493ae3124ed83351b1b6a155db7da
|
||||
React-jsinspector: 512e560d0e985d0e8c479a54a4e5c147a9c83493
|
||||
react-native-biometrics: c892904948a32295b128f633bcc11eda020645c5
|
||||
react-native-blue-crypto: 23f1558ad3d38d7a2edb7e2f6ed1bc520ed93e56
|
||||
react-native-blur: cad4d93b364f91e7b7931b3fa935455487e5c33c
|
||||
react-native-camera: 9a0db39fc97a479fe472e86ce424545478133a2f
|
||||
react-native-document-picker: c5752781fbc0c126c627c1549b037c139444a4cf
|
||||
react-native-fingerprint-scanner: c68136ca57e3704d7bdf5faa554ea535ce15b1d0
|
||||
react-native-geolocation: cbd9d6bd06bac411eed2671810f454d4908484a8
|
||||
react-native-image-picker: a6c3d644751a388b0fc8b56822ff7cbd398a3008
|
||||
react-native-randombytes: 991545e6eaaf700b4ee384c291ef3d572e0b2ca8
|
||||
|
|
8
package-lock.json
generated
8
package-lock.json
generated
|
@ -14971,10 +14971,6 @@
|
|||
"prop-types": "^15.7.2"
|
||||
}
|
||||
},
|
||||
"react-native-biometrics": {
|
||||
"version": "git+https://github.com/BlueWallet/react-native-biometrics.git#f62b0b193e10376d4a0e8195c700a364ed4e5aaa",
|
||||
"from": "git+https://github.com/BlueWallet/react-native-biometrics.git#f62b0b193e10376d4a0e8195c700a364ed4e5aaa"
|
||||
},
|
||||
"react-native-blue-crypto": {
|
||||
"version": "git+https://github.com/Overtorment/react-native-blue-crypto.git#841cd9e5abdc468888c76682c95a944ec34c1be7",
|
||||
"from": "git+https://github.com/Overtorment/react-native-blue-crypto.git"
|
||||
|
@ -15017,6 +15013,10 @@
|
|||
"react-native-status-bar-height": "^2.5.0"
|
||||
}
|
||||
},
|
||||
"react-native-fingerprint-scanner": {
|
||||
"version": "git+https://github.com/BlueWallet/react-native-fingerprint-scanner.git#5988a07c31e0600d187ec8a0593681dcdd6daa20",
|
||||
"from": "git+https://github.com/BlueWallet/react-native-fingerprint-scanner.git#5988a07c31e0600d187ec8a0593681dcdd6daa20"
|
||||
},
|
||||
"react-native-fs": {
|
||||
"version": "2.16.6",
|
||||
"resolved": "https://registry.npmjs.org/react-native-fs/-/react-native-fs-2.16.6.tgz",
|
||||
|
|
|
@ -111,13 +111,13 @@
|
|||
"react": "16.11.0",
|
||||
"react-localization": "1.0.15",
|
||||
"react-native": "0.62.2",
|
||||
"react-native-biometrics": "git+https://github.com/BlueWallet/react-native-biometrics.git#f62b0b193e10376d4a0e8195c700a364ed4e5aaa",
|
||||
"react-native-blue-crypto": "git+https://github.com/Overtorment/react-native-blue-crypto.git",
|
||||
"react-native-camera": "3.38.0",
|
||||
"react-native-default-preference": "1.4.3",
|
||||
"react-native-device-info": "6.0.1",
|
||||
"react-native-document-picker": "git+https://github.com/BlueWallet/react-native-document-picker.git#3684d4fcc2bc0b47c32be39024e4796004c3e428",
|
||||
"react-native-elements": "2.2.1",
|
||||
"react-native-fingerprint-scanner": "git+https://github.com/BlueWallet/react-native-fingerprint-scanner.git#5988a07c31e0600d187ec8a0593681dcdd6daa20",
|
||||
"react-native-fs": "2.16.6",
|
||||
"react-native-gesture-handler": "1.7.0",
|
||||
"react-native-handoff": "git+https://github.com/marcosrdz/react-native-handoff.git",
|
||||
|
|
Loading…
Add table
Reference in a new issue