FIX: Changes

This commit is contained in:
Marcos Rodriguez 2019-10-05 18:36:16 -04:00
parent c2b667c3ca
commit 68bb940a39
5 changed files with 25 additions and 33 deletions

View file

@ -3,7 +3,6 @@ import { View, Image, TouchableOpacity } from 'react-native';
import { Icon } from 'react-native-elements';
import Biometric from './class/biometrics';
import PropTypes from 'prop-types';
import Biometrics from 'react-native-biometrics';
import { SafeAreaView } from 'react-navigation';
/** @type {AppStorage} */
@ -52,14 +51,14 @@ export default class UnlockWith extends Component {
</View>
<View style={{ flex: 0.1, justifyContent: 'flex-end', marginBottom: 64 }}>
<View style={{ justifyContent: 'center', flexDirection: 'row' }}>
{this.state.biometricType === Biometrics.TouchID && (
{this.state.biometricType === Biometric.TouchID && (
<>
<TouchableOpacity disabled={this.state.isAuthenticating} onPress={this.unlockWithBiometrics}>
<Image source={require('./img/fingerprint.png')} style={{ width: 64, height: 64 }} />
</TouchableOpacity>
</>
)}
{this.state.biometricType === Biometrics.FaceID && (
{this.state.biometricType === Biometric.FaceID && (
<>
<TouchableOpacity disabled={this.state.isAuthenticating} onPress={this.unlockWithBiometrics}>
<Image source={require('./img/faceid.png')} style={{ width: 64, height: 64 }} />

View file

@ -3,6 +3,8 @@ const BlueApp = require('../BlueApp');
export default class Biometric {
static STORAGEKEY = 'Biometrics';
static FaceID = Biometrics.FaceID;
static TouchID = Biometrics.TouchID;
static async isDeviceBiometricCapable() {
const isDeviceBiometricCapable = await Biometric.biometricType();
@ -23,14 +25,14 @@ export default class Biometric {
return !!enabledBiometrics;
} catch (_e) {
await BlueApp.setItem(Biometric.STORAGEKEY, '');
return !!'';
return false;
}
}
static async isBiometricUseCapableAndEnabled() {
const isBiometricUseEnabled = await Biometric.isBiometricUseEnabled();
const isDeviceBiometricCapable = await Biometric.isDeviceBiometricCapable();
return !!isBiometricUseEnabled && isDeviceBiometricCapable;
return isBiometricUseEnabled && isDeviceBiometricCapable;
}
static async setBiometricUseEnabled(value) {

38
package-lock.json generated
View file

@ -4599,9 +4599,9 @@
}
},
"eslint-utils": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.0.tgz",
"integrity": "sha512-7ehnzPaP5IIEh1r1tkjuIrxqhNkzUJa9z3R92tLJdZIVdWaczEhr3EbhGtsMrVxi1KeR8qA7Off6SWc5WNQqyQ==",
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.2.tgz",
"integrity": "sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q==",
"dev": true,
"requires": {
"eslint-visitor-keys": "^1.0.0"
@ -5851,9 +5851,9 @@
"integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE="
},
"handlebars": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.2.tgz",
"integrity": "sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw==",
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.4.2.tgz",
"integrity": "sha512-cIv17+GhL8pHHnRJzGu2wwcthL5sb8uDKBHvZ2Dtu5s1YNt0ljbzKbamnc+gr69y7bzwQiBdr5+hOpRd5pnOdg==",
"dev": true,
"requires": {
"neo-async": "^2.6.0",
@ -5863,9 +5863,9 @@
},
"dependencies": {
"commander": {
"version": "2.20.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz",
"integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==",
"version": "2.20.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.1.tgz",
"integrity": "sha512-cCuLsMhJeWQ/ZpsFTbE765kvVfoeSddc4nU3up4fV+fDBcfUXnbITJ+JzhkdjzOqhURjZgujxaioam4RM9yGUg==",
"dev": true,
"optional": true
},
@ -10687,9 +10687,8 @@
}
},
"react-native-biometrics": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/react-native-biometrics/-/react-native-biometrics-1.6.1.tgz",
"integrity": "sha512-WYdZ6k3Miyl/+lEdhq6y4B6wz16d+PomO/xjR1hScYKeQWj1jaugPy0Ep+EjoWpJkPYLvnxasmIYR9v8OvWNHg=="
"version": "git+https://github.com/BlueWallet/react-native-biometrics.git#fed8efc3adbb1c7c028c15223605f87eb1944b64",
"from": "git+https://github.com/BlueWallet/react-native-biometrics.git"
},
"react-native-camera": {
"version": "3.4.0",
@ -11118,20 +11117,13 @@
"integrity": "sha1-kIe0CzaLEkZ0x7/Pn91q2YORSpc="
},
"react-test-render": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/react-test-render/-/react-test-render-1.1.1.tgz",
"integrity": "sha1-NZRrs4P4uCVkdo/Z2OrxIMMDKpo=",
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/react-test-render/-/react-test-render-1.1.2.tgz",
"integrity": "sha512-XurcR3Eh0TwFopBShDNgPny29Z8wczAFnKsxUqSSgNN6FrpsNg39Q3/13bK5oBFWOLod3enZG698HZNlJ3oRsw==",
"requires": {
"immutable": "3.7.x",
"lodash": "3.10.x",
"lodash": "^4.17.15",
"react-shallow-testutils": "2.0.x"
},
"dependencies": {
"lodash": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz",
"integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y="
}
}
},
"react-test-renderer": {

View file

@ -58,13 +58,13 @@
"bip21": "2.0.2",
"bip32": "2.0.3",
"bip39": "2.5.0",
"bitcoinjs-lib": "^5.1.6",
"bitcoinjs-lib": "5.1.6",
"buffer": "5.2.1",
"buffer-reverse": "1.0.1",
"coinselect": "3.1.11",
"crypto-js": "3.1.9-1",
"dayjs": "1.8.14",
"ecurve": "^1.0.6",
"ecurve": "1.0.6",
"electrum-client": "git+https://github.com/BlueWallet/rn-electrum-client.git",
"eslint-config-prettier": "6.0.0",
"eslint-config-standard": "12.0.0",
@ -84,7 +84,7 @@
"react": "16.8.6",
"react-localization": "1.0.13",
"react-native": "0.60.5",
"react-native-biometrics": "^1.6.1",
"react-native-biometrics": "git+https://github.com/BlueWallet/react-native-biometrics.git",
"react-native-camera": "3.4.0",
"react-native-device-info": "2.2.2",
"react-native-elements": "0.19.0",
@ -117,7 +117,7 @@
"react-native-watch-connectivity": "0.2.1",
"react-native-webview": "6.9.0",
"react-navigation": "3.11.0",
"react-test-render": "1.1.1",
"react-test-render": "1.1.2",
"readable-stream": "3.4.0",
"secure-random": "1.1.2",
"stream-browserify": "2.0.2",

View file

@ -85,7 +85,6 @@ export default class WalletMigrate {
const data = await AsyncStorage.getItem('data');
if (data) {
const isEncrypted = (await AsyncStorage.getItem('data_encrypted')) || '';
await RNSecureKeyStore.set('Biometrics', '', { accessible: ACCESSIBLE.WHEN_UNLOCKED });
await RNSecureKeyStore.set('data', data, { accessible: ACCESSIBLE.WHEN_UNLOCKED });
await RNSecureKeyStore.set('data_encrypted', isEncrypted, {
accessible: ACCESSIBLE.WHEN_UNLOCKED,