diff --git a/.re-natal b/.re-natal index 560c05a693..271adc62f3 100644 --- a/.re-natal +++ b/.re-natal @@ -25,6 +25,7 @@ "react-native-dialogs", "react-native-image-resizer", "react-native-image-crop-picker", + "react-native-securerandom", "react-native-webview-bridge", "react-native-fcm", "homoglyph-finder", @@ -36,6 +37,7 @@ "emojilib", "react-native-config", "react-native-svg", + "react-native-keychain", "rn-snoopy", "rn-snoopy/stream/bars", "rn-snoopy/stream/filter", diff --git a/android/app/build.gradle b/android/app/build.gradle index 471fef0033..93ad2080a0 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -208,11 +208,13 @@ dependencies { implementation project(':react-native-status') implementation project(':react-native-fs') implementation project(':react-native-image-crop-picker') + implementation project(':react-native-securerandom') implementation project(':react-native-webview-bridge') implementation project(':react-native-config') implementation project(':react-native-fcm') implementation 'com.google.firebase:firebase-core:10.0.1' //this decides your firebase SDK version compile project(':react-native-testfairy') + implementation project(':react-native-keychain') implementation project(':instabug-reactnative') implementation 'status-im:function:0.0.1' diff --git a/android/app/src/main/java/im/status/ethereum/MainApplication.java b/android/app/src/main/java/im/status/ethereum/MainApplication.java index 1e18833813..ee669818a4 100644 --- a/android/app/src/main/java/im/status/ethereum/MainApplication.java +++ b/android/app/src/main/java/im/status/ethereum/MainApplication.java @@ -4,6 +4,7 @@ import android.support.multidex.MultiDexApplication; import com.aakashns.reactnativedialogs.ReactNativeDialogsPackage; import org.devio.rn.splashscreen.SplashScreenReactPackage; import com.facebook.react.ReactApplication; +import net.rhogan.rnsecurerandom.RNSecureRandomPackage; import com.instabug.reactlibrary.RNInstabugReactnativePackage; import com.ocetnik.timer.BackgroundTimerPackage; import com.horcrux.svg.SvgPackage; @@ -24,6 +25,7 @@ import im.status.ethereum.module.StatusPackage; import io.realm.react.RealmReactPackage; import me.alwx.HttpServer.HttpServerReactPackage; import com.testfairy.react.TestFairyPackage; +import com.oblador.keychain.KeychainPackage; import java.util.ArrayList; import java.util.Arrays; @@ -59,6 +61,7 @@ public class MainApplication extends MultiDexApplication implements ReactApplica Function callRPC = statusPackage.getCallRPC(); List packages = new ArrayList(Arrays.asList( new MainReactPackage(), + new RNSecureRandomPackage(), new BackgroundTimerPackage(), new SvgPackage(), new FIRMessagingPackage(), @@ -76,6 +79,7 @@ public class MainApplication extends MultiDexApplication implements ReactApplica new TestFairyPackage(), new WebViewBridgePackage(webViewDebugEnabled, callRPC), new ReactNativeConfigPackage(), + new KeychainPackage(), new RNInstabugReactnativePackage.Builder(BuildConfig.INSTABUG_TOKEN,MainApplication.this) .setInvocationEvent("shake") .setPrimaryColor("#1D82DC") diff --git a/android/settings.gradle b/android/settings.gradle index 63a40d01e8..255ab5c5da 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,4 +1,6 @@ rootProject.name = 'StatusIm' +include ':react-native-securerandom' +project(':react-native-securerandom').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-securerandom/android') include ':instabug-reactnative' project(':instabug-reactnative').projectDir = new File(rootProject.projectDir, '../node_modules/instabug-reactnative/android') include ':react-native-background-timer' @@ -32,6 +34,8 @@ include ':react-native-fs' project(':react-native-fs').projectDir = new File(settingsDir, '../node_modules/react-native-fs/android') include ':react-native-image-crop-picker' project(':react-native-image-crop-picker').projectDir = new File(settingsDir, '../node_modules/react-native-image-crop-picker/android') +include ':react-native-keychain' +project(':react-native-keychain').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-keychain/android') include ':react-native-webview-bridge' project(':react-native-webview-bridge').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview-bridge/android') include ':react-native-config' diff --git a/ios/Podfile b/ios/Podfile index 155b82ff07..6e2524763f 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -21,6 +21,7 @@ target 'StatusIm' do pod 'React', :path => '../node_modules/react-native' pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga' pod 'react-native-background-timer', :path => '../node_modules/react-native-background-timer' + pod 'RNKeychain', :path => '../node_modules/react-native-keychain' target 'StatusImTests' do inherit! :search_paths diff --git a/ios/StatusIm.xcodeproj/project.pbxproj b/ios/StatusIm.xcodeproj/project.pbxproj index 5973478ee2..4d4f007215 100644 --- a/ios/StatusIm.xcodeproj/project.pbxproj +++ b/ios/StatusIm.xcodeproj/project.pbxproj @@ -5,7 +5,6 @@ }; objectVersion = 46; objects = { - /* Begin PBXBuildFile section */ 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; @@ -72,6 +71,7 @@ E0AD9E8F495A4907B65104BF /* libRCTImageResizer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BEE3436791D42248F853999 /* libRCTImageResizer.a */; }; F9238D6C1E5F055900C047B9 /* SF-UI-Text-Semibold.otf in Resources */ = {isa = PBXBuildFile; fileRef = F9238D6B1E5F055900C047B9 /* SF-UI-Text-Semibold.otf */; }; FD4F213C3873473CB703B1D2 /* libRNFS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 674B3D9595A047AB8D518F4E /* libRNFS.a */; }; + AB96C730942E49178F59AE6F /* libRNSecureRandom.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1464A9A9E12F45068947C28F /* libRNSecureRandom.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -604,6 +604,8 @@ F89A8F8005874B86B63C22E3 /* RNFIRMessaging.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNFIRMessaging.xcodeproj; path = "../node_modules/react-native-fcm/ios/RNFIRMessaging.xcodeproj"; sourceTree = ""; }; F9238D6B1E5F055900C047B9 /* SF-UI-Text-Semibold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Semibold.otf"; sourceTree = ""; }; FC1CBCFE6C906043D6CCEEE1 /* libPods-StatusImTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-StatusImTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + AF409BB755B94FB1BBA01927 /* RNSecureRandom.xcodeproj */ = {isa = PBXFileReference; name = "RNSecureRandom.xcodeproj"; path = "../node_modules/react-native-securerandom/ios/RNSecureRandom.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; + 1464A9A9E12F45068947C28F /* libRNSecureRandom.a */ = {isa = PBXFileReference; name = "libRNSecureRandom.a"; path = "libRNSecureRandom.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -664,6 +666,7 @@ 5974D2035B8B47E0946B63B6 /* libRNFIRMessaging.a in Frameworks */, 91446A820DA5E1C15C24D2A7 /* Instabug.framework in Frameworks */, 63AE4174241B852A045FAE1F /* InstabugCore.framework in Frameworks */, + AB96C730942E49178F59AE6F /* libRNSecureRandom.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -921,6 +924,7 @@ F3548417D8DA4362B6796A54 /* RNInstabug.xcodeproj */, 1E74DC52A1E449A2BA858B14 /* RNSVG.xcodeproj */, F89A8F8005874B86B63C22E3 /* RNFIRMessaging.xcodeproj */, + AF409BB755B94FB1BBA01927 /* RNSecureRandom.xcodeproj */, ); name = Libraries; sourceTree = ""; @@ -1161,7 +1165,7 @@ 83CBB9F71A601CBA00E9B192 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0830; + LastUpgradeCheck = 830; ORGANIZATIONNAME = Facebook; TargetAttributes = { 00E356ED1AD99517003FC87E = { @@ -1176,6 +1180,9 @@ com.apple.BackgroundModes = { enabled = 1; }; + com.apple.Keychain = { + enabled = 1; + }; com.apple.Push = { enabled = 1; }; @@ -1972,6 +1979,7 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); PRODUCT_BUNDLE_IDENTIFIER = im.status.ethereum; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -2014,6 +2022,7 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); PRODUCT_BUNDLE_IDENTIFIER = im.status.ethereum; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -2060,6 +2069,7 @@ "$(SRCROOT)/../node_modules/react-native-svg/ios/**", "$(SRCROOT)/../node_modules/react-native-fcm/ios", "$(SRCROOT)/../node_modules/react-native-testfairy/ios", + "$(SRCROOT)/../node_modules/react-native-securerandom/ios", ); INFOPLIST_FILE = StatusIm/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; @@ -2118,6 +2128,7 @@ "$(SRCROOT)/../node_modules/react-native-svg/ios/**", "$(SRCROOT)/../node_modules/react-native-fcm/ios", "$(SRCROOT)/../node_modules/react-native-testfairy/ios", + "$(SRCROOT)/../node_modules/react-native-securerandom/ios", ); INFOPLIST_FILE = StatusIm/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; diff --git a/ios/StatusIm/StatusIm.entitlements b/ios/StatusIm/StatusIm.entitlements index 903def2af5..d8b440bcd4 100644 --- a/ios/StatusIm/StatusIm.entitlements +++ b/ios/StatusIm/StatusIm.entitlements @@ -4,5 +4,9 @@ aps-environment development + keychain-access-groups + + $(AppIdentifierPrefix)im.status.ethereum + diff --git a/package-lock.json b/package-lock.json index 2118fad2a4..6b025e50b1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -231,7 +231,7 @@ "requires": { "bn.js": "4.11.8", "inherits": "2.0.1", - "minimalistic-assert": "1.0.0" + "minimalistic-assert": "1.0.1" } }, "assert": { @@ -290,9 +290,9 @@ "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" }, "aws4": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", - "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=" + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", + "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==" }, "axobject-query": { "version": "0.1.0", @@ -388,7 +388,7 @@ "requires": { "babel-core": "6.26.0", "babel-runtime": "6.26.0", - "core-js": "2.5.4", + "core-js": "2.5.5", "home-or-tmp": "2.0.0", "lodash": "4.17.5", "mkdirp": "0.5.1", @@ -1053,7 +1053,7 @@ "requires": { "babel-core": "6.24.1", "babel-runtime": "6.26.0", - "core-js": "2.5.4", + "core-js": "2.5.5", "home-or-tmp": "2.0.0", "lodash": "4.17.5", "mkdirp": "0.5.1", @@ -1065,7 +1065,7 @@ "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", "requires": { - "core-js": "2.5.4", + "core-js": "2.5.5", "regenerator-runtime": "0.11.1" } }, @@ -1139,6 +1139,32 @@ "requires": { "is-descriptor": "1.0.2" } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "6.0.2" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "6.0.2" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" + } } } }, @@ -1187,9 +1213,9 @@ "integrity": "sha1-5tXqjF2tABMEpwsiY4RH9pyy+Ak=" }, "big-integer": { - "version": "1.6.27", - "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.27.tgz", - "integrity": "sha512-NzUKMYW4SWme+H5K+mfEmBxEF/V04PhlzoxxXwSnDig78y2t7HLBVotfDBMUhRPRA3WWID3GmJB/OJSWPhVXtg==" + "version": "1.6.28", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.28.tgz", + "integrity": "sha512-OJT3rzgtsYca/5WmmEuFJDPMwROVh5SSjoEX9wIrpfbbWJ4KqRzShs8Cj6jWHaatBYAeWngBA+kmmrcHSklT1g==" }, "bignumber.js": { "version": "github:status-im/bignumber.js#cc066a0a3d6bfe0c436c9957f4ea8344bf963c89" @@ -1303,7 +1329,7 @@ "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.1.1.tgz", "integrity": "sha1-1g1dzCDLptx+HymbNdPh+V2vuuY=", "requires": { - "big-integer": "1.6.27" + "big-integer": "1.6.28" } }, "brace-expansion": { @@ -1316,17 +1342,15 @@ } }, "braces": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.1.tgz", - "integrity": "sha512-SO5lYHA3vO6gz66erVvedSCkp7AKWdv6VcQ2N4ysXfPxdAlxAMMAdwegGGcv1Bqwm7naF1hNdk5d6AAIEHV2nQ==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", "requires": { "arr-flatten": "1.1.0", "array-unique": "0.3.2", - "define-property": "1.0.0", "extend-shallow": "2.0.1", "fill-range": "4.0.0", "isobject": "3.0.1", - "kind-of": "6.0.2", "repeat-element": "1.1.2", "snapdragon": "0.8.2", "snapdragon-node": "2.1.1", @@ -1334,14 +1358,6 @@ "to-regex": "3.0.2" }, "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "requires": { - "is-descriptor": "1.0.2" - } - }, "extend-shallow": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", @@ -1364,26 +1380,26 @@ "requires": { "buffer-xor": "1.0.3", "cipher-base": "1.0.4", - "create-hash": "1.1.3", + "create-hash": "1.2.0", "evp_bytestokey": "1.0.3", "inherits": "2.0.1", "safe-buffer": "5.1.1" } }, "browserify-cipher": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.0.tgz", - "integrity": "sha1-mYgkSHS/XtTijalWZtzWasj8Njo=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", + "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", "requires": { "browserify-aes": "1.2.0", - "browserify-des": "1.0.0", + "browserify-des": "1.0.1", "evp_bytestokey": "1.0.3" } }, "browserify-des": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.0.tgz", - "integrity": "sha1-2qJ3cXRwki7S/hhZQRihdUOXId0=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.1.tgz", + "integrity": "sha512-zy0Cobe3hhgpiOM32Tj7KQ3Vl91m0njwsjzZQK1L+JDf11dzP9qIvjreVinsvXrgfjhStXwUWAEpB9D7Gwmayw==", "requires": { "cipher-base": "1.0.4", "des.js": "1.0.0", @@ -1406,11 +1422,11 @@ "requires": { "bn.js": "4.11.8", "browserify-rsa": "4.0.1", - "create-hash": "1.1.3", - "create-hmac": "1.1.6", + "create-hash": "1.2.0", + "create-hmac": "1.1.7", "elliptic": "6.4.0", "inherits": "2.0.1", - "parse-asn1": "5.1.0" + "parse-asn1": "5.1.1" } }, "bser": { @@ -1588,57 +1604,6 @@ "requires": { "is-descriptor": "0.1.6" } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "requires": { - "is-accessor-descriptor": "0.1.6", - "is-data-descriptor": "0.1.4", - "kind-of": "5.1.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" } } }, @@ -1959,9 +1924,9 @@ "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=" }, "core-js": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.4.tgz", - "integrity": "sha1-8si/GB8qgLkvNgEhQpzmOi8K6uA=" + "version": "2.5.5", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.5.tgz", + "integrity": "sha1-sU3ek2xkDAV5prUMq8wTLdYSfjs=" }, "core-util-is": { "version": "1.0.2", @@ -1974,32 +1939,33 @@ "integrity": "sha1-+mIuG8OIvyVzCQgta2UgDOZwkLo=" }, "create-ecdh": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.0.tgz", - "integrity": "sha1-iIxyNZbN92EvZJgjPuvXo1MBc30=", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.1.tgz", + "integrity": "sha512-iZvCCg8XqHQZ1ioNBTzXS/cQSkqkqcPs8xSX4upNB+DAk9Ht3uzQf2J32uAHNCne8LDmKr29AgZrEs4oIrwLuQ==", "requires": { "bn.js": "4.11.8", "elliptic": "6.4.0" } }, "create-hash": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.1.3.tgz", - "integrity": "sha1-YGBCrIuSYnUPSDyt2rD1gZFy2P0=", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", "requires": { "cipher-base": "1.0.4", "inherits": "2.0.1", + "md5.js": "1.3.4", "ripemd160": "2.0.1", "sha.js": "2.4.11" } }, "create-hmac": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.6.tgz", - "integrity": "sha1-rLniIaThe9sHbpBlfEK5PjcmzwY=", + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", "requires": { "cipher-base": "1.0.4", - "create-hash": "1.1.3", + "create-hash": "1.2.0", "inherits": "2.0.1", "ripemd160": "2.0.1", "safe-buffer": "5.1.1", @@ -2248,6 +2214,34 @@ "requires": { "is-descriptor": "1.0.2", "isobject": "3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "6.0.2" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "6.0.2" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" + } + } } }, "delayed-stream": { @@ -2276,7 +2270,7 @@ "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", "requires": { "inherits": "2.0.1", - "minimalistic-assert": "1.0.0" + "minimalistic-assert": "1.0.1" } }, "destroy": { @@ -2308,9 +2302,9 @@ "integrity": "sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I=" }, "diffie-hellman": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.2.tgz", - "integrity": "sha1-tYNXOScM/ias9jIJn97SoH8gnl4=", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", "requires": { "bn.js": "4.11.8", "miller-rabin": "4.0.1", @@ -2377,7 +2371,7 @@ "hash.js": "1.1.3", "hmac-drbg": "1.0.1", "inherits": "2.0.1", - "minimalistic-assert": "1.0.0", + "minimalistic-assert": "1.0.1", "minimalistic-crypto-utils": "1.0.1" } }, @@ -2401,7 +2395,7 @@ "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", "requires": { - "iconv-lite": "0.4.19" + "iconv-lite": "0.4.21" } }, "end-of-stream": { @@ -2603,57 +2597,6 @@ "requires": { "is-extendable": "0.1.1" } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "requires": { - "is-accessor-descriptor": "0.1.6", - "is-data-descriptor": "0.1.4", - "kind-of": "5.1.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" } } }, @@ -2780,7 +2723,7 @@ "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", "requires": { "chardet": "0.4.2", - "iconv-lite": "0.4.19", + "iconv-lite": "0.4.21", "tmp": "0.0.33" } }, @@ -2814,6 +2757,32 @@ "requires": { "is-extendable": "0.1.1" } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "6.0.2" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "6.0.2" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" + } } } }, @@ -2878,7 +2847,7 @@ "requires": { "babel-core": "6.24.1", "babel-preset-fbjs": "2.1.4", - "core-js": "2.5.4", + "core-js": "2.5.5", "cross-spawn": "5.1.0", "gulp-util": "3.0.8", "object-assign": "4.1.1", @@ -4325,11 +4294,12 @@ } }, "hash-base": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-2.0.2.tgz", - "integrity": "sha1-ZuodhW206KVHDK32/OI65SRO8uE=", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", + "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", "requires": { - "inherits": "2.0.1" + "inherits": "2.0.1", + "safe-buffer": "5.1.1" } }, "hash.js": { @@ -4338,7 +4308,7 @@ "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", "requires": { "inherits": "2.0.3", - "minimalistic-assert": "1.0.0" + "minimalistic-assert": "1.0.1" }, "dependencies": { "inherits": { @@ -4365,7 +4335,7 @@ "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", "requires": { "hash.js": "1.1.3", - "minimalistic-assert": "1.0.0", + "minimalistic-assert": "1.0.1", "minimalistic-crypto-utils": "1.0.1" } }, @@ -4448,9 +4418,12 @@ "integrity": "sha512-u144MQhV/8mz4Y5wP86SQAWMwS8gpe/JavIa9hugSI4WreezGgbhJPdk2Q60KcdIltKLiNefGtHNh1N8SSmQqQ==" }, "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" + "version": "0.4.21", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.21.tgz", + "integrity": "sha512-En5V9za5mBt2oUA03WGD3TwDv0MKAruqsuxstbMUZaj9W9k/m1CV/9py3l0L5kw9Bln8fdHQmzHSYtvpvTLpKw==", + "requires": { + "safer-buffer": "2.1.2" + } }, "identicon.js": { "version": "github:status-im/identicon.js#4cd179daaf6f01384502b4b2c1876f982db0f57e" @@ -4585,11 +4558,21 @@ "integrity": "sha1-OzSixI81mXLzUEKEkZOucmS2NWI=" }, "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "requires": { - "kind-of": "6.0.2" + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } + } } }, "is-arrayish": { @@ -4616,11 +4599,21 @@ "integrity": "sha1-hut1OSgF3cM69xySoO7fdO52BLI=" }, "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "requires": { - "kind-of": "6.0.2" + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } + } } }, "is-date-object": { @@ -4629,13 +4622,20 @@ "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=" }, "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", "requires": { - "is-accessor-descriptor": "1.0.0", - "is-data-descriptor": "1.0.0", - "kind-of": "6.0.2" + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" + } } }, "is-dotfile": { @@ -5030,9 +5030,9 @@ } }, "left-pad": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.2.0.tgz", - "integrity": "sha1-0wpzxrggHY99jnlWupYWCHpo4O4=" + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.3.0.tgz", + "integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA==" }, "level-blobs": { "version": "0.1.7", @@ -5411,17 +5411,6 @@ "requires": { "hash-base": "3.0.4", "inherits": "2.0.1" - }, - "dependencies": { - "hash-base": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", - "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", - "requires": { - "inherits": "2.0.1", - "safe-buffer": "5.1.1" - } - } } }, "media-typer": { @@ -5491,7 +5480,7 @@ "chalk": "1.1.3", "concat-stream": "1.6.2", "connect": "3.6.6", - "core-js": "2.5.4", + "core-js": "2.5.5", "debug": "2.6.9", "denodeify": "1.2.1", "eventemitter3": "3.0.1", @@ -5504,7 +5493,7 @@ "jest-worker": "22.1.0", "json-stable-stringify": "1.0.1", "json5": "0.4.0", - "left-pad": "1.2.0", + "left-pad": "1.3.0", "lodash.throttle": "4.1.1", "merge-stream": "1.0.1", "metro-core": "0.24.7", @@ -5555,7 +5544,7 @@ "requires": { "babel-core": "6.26.0", "babel-runtime": "6.26.0", - "core-js": "2.5.4", + "core-js": "2.5.5", "home-or-tmp": "2.0.0", "lodash": "4.17.5", "mkdirp": "0.5.1", @@ -5764,7 +5753,7 @@ "requires": { "arr-diff": "4.0.0", "array-unique": "0.3.2", - "braces": "2.3.1", + "braces": "2.3.2", "define-property": "2.0.2", "extend-shallow": "3.0.2", "extglob": "2.0.4", @@ -5818,9 +5807,9 @@ } }, "minimalistic-assert": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz", - "integrity": "sha1-cCvi3aazf0g2vLP121ZkG2Sh09M=" + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" }, "minimalistic-crypto-utils": { "version": "1.0.1", @@ -6155,7 +6144,7 @@ "integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=", "requires": { "aws-sign2": "0.6.0", - "aws4": "1.6.0", + "aws4": "1.7.0", "caseless": "0.12.0", "combined-stream": "1.0.6", "extend": "3.0.1", @@ -6277,39 +6266,6 @@ "is-descriptor": "0.1.6" } }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "requires": { - "kind-of": "3.2.2" - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "requires": { - "kind-of": "3.2.2" - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "requires": { - "is-accessor-descriptor": "0.1.6", - "is-data-descriptor": "0.1.4", - "kind-of": "5.1.0" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" - } - } - }, "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", @@ -6492,13 +6448,13 @@ "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=" }, "parse-asn1": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.0.tgz", - "integrity": "sha1-N8T5t+06tlx0gXtfJICTf7+XxxI=", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.1.tgz", + "integrity": "sha512-KPx7flKXg775zZpnp9SxJlz00gTd4BmJ2yJufSc44gMCRrRQ7NSzAcSJQfifuOLgW6bEi+ftrALtsgALeB2Adw==", "requires": { "asn1.js": "4.10.1", "browserify-aes": "1.2.0", - "create-hash": "1.1.3", + "create-hash": "1.2.0", "evp_bytestokey": "1.0.3", "pbkdf2": "3.0.8" } @@ -6585,7 +6541,7 @@ "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.8.tgz", "integrity": "sha1-L4q/FuvsyCJ3lF10irodeHYfYeI=", "requires": { - "create-hmac": "1.1.6" + "create-hmac": "1.1.7" } }, "pegjs": { @@ -6696,14 +6652,14 @@ "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" }, "public-encrypt": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.0.tgz", - "integrity": "sha1-OfaZ86RlYN1eusvKaTyvfGXBjMY=", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.2.tgz", + "integrity": "sha512-4kJ5Esocg8X3h8YgJsKAuoesBgB7mqH3eowiDzMUPKiRDDE7E/BqqZD1hnTByIaAFiwAw246YEltSq7tdrOH0Q==", "requires": { "bn.js": "4.11.8", "browserify-rsa": "4.0.1", - "create-hash": "1.1.3", - "parse-asn1": "5.1.0", + "create-hash": "1.2.0", + "parse-asn1": "5.1.1", "randombytes": "2.0.6" } }, @@ -6975,7 +6931,7 @@ "requires": { "babel-core": "6.26.0", "babel-runtime": "6.26.0", - "core-js": "2.5.4", + "core-js": "2.5.5", "home-or-tmp": "2.0.0", "lodash": "4.17.5", "mkdirp": "0.5.1", @@ -7115,15 +7071,15 @@ "resolved": "https://registry.npmjs.org/react-native-crypto/-/react-native-crypto-2.1.1.tgz", "integrity": "sha512-JHwX0zobeYqCAwdSffRoivXeqlZR54WpCj8ICGcoNh7bvOh8khr63zvNk+fcqdRH3eI9Jhglygswijza0f3D4Q==", "requires": { - "browserify-cipher": "1.0.0", + "browserify-cipher": "1.0.1", "browserify-sign": "4.0.4", - "create-ecdh": "4.0.0", - "create-hash": "1.1.3", - "create-hmac": "1.1.6", - "diffie-hellman": "5.0.2", + "create-ecdh": "4.0.1", + "create-hash": "1.2.0", + "create-hmac": "1.1.7", + "diffie-hellman": "5.0.3", "inherits": "2.0.1", "pbkdf2": "3.0.8", - "public-encrypt": "4.0.0" + "public-encrypt": "4.0.2" } }, "react-native-dialogs": { @@ -7189,6 +7145,11 @@ "react-native-scrollable-mixin": "1.0.1" } }, + "react-native-keychain": { + "version": "3.0.0-rc.3", + "resolved": "https://registry.npmjs.org/react-native-keychain/-/react-native-keychain-3.0.0-rc.3.tgz", + "integrity": "sha512-ijWfHmxTPKnrHtPJiDbKW3D6lRH8O9wbCNEE3xlxEg1WZT+VhP6iiF+HUansNYuxL7Hh7k41GSFfvr3xumfmXA==" + }, "react-native-level-fs": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/react-native-level-fs/-/react-native-level-fs-3.0.0.tgz", @@ -7218,6 +7179,14 @@ "resolved": "https://registry.npmjs.org/react-native-scrollable-mixin/-/react-native-scrollable-mixin-1.0.1.tgz", "integrity": "sha1-NKMhZ7ZCSFlBVP0NaosD8idAVI4=" }, + "react-native-securerandom": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/react-native-securerandom/-/react-native-securerandom-0.1.1.tgz", + "integrity": "sha1-8TBiOkEsM4sK+t7bwgTFy7i/IHA=", + "requires": { + "base64-js": "0.0.8" + } + }, "react-native-splash-screen": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/react-native-splash-screen/-/react-native-splash-screen-3.0.6.tgz", @@ -7520,7 +7489,7 @@ "integrity": "sha512-8H7Ehijd4js+s6wuVPLjwORxD4zeuyjYugprdOXlPSqaApmL/QOy+EB/beICHVCHkGMKNh5rvihb5ov+IDw4mg==", "requires": { "aws-sign2": "0.7.0", - "aws4": "1.6.0", + "aws4": "1.7.0", "caseless": "0.12.0", "combined-stream": "1.0.6", "extend": "3.0.1", @@ -7633,6 +7602,16 @@ "requires": { "hash-base": "2.0.2", "inherits": "2.0.1" + }, + "dependencies": { + "hash-base": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-2.0.2.tgz", + "integrity": "sha1-ZuodhW206KVHDK32/OI65SRO8uE=", + "requires": { + "inherits": "2.0.1" + } + } } }, "rn-snoopy": { @@ -7697,6 +7676,11 @@ "ret": "0.1.15" } }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, "sane": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/sane/-/sane-2.5.0.tgz", @@ -8019,57 +8003,6 @@ "requires": { "is-extendable": "0.1.1" } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "requires": { - "is-accessor-descriptor": "0.1.6", - "is-data-descriptor": "0.1.4", - "kind-of": "5.1.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" } } }, @@ -8090,6 +8023,32 @@ "requires": { "is-descriptor": "1.0.2" } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "6.0.2" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "6.0.2" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" + } } } }, @@ -8226,57 +8185,6 @@ "requires": { "is-descriptor": "0.1.6" } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "requires": { - "is-accessor-descriptor": "0.1.6", - "is-data-descriptor": "0.1.4", - "kind-of": "5.1.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" } } }, diff --git a/package.json b/package.json index 5b42eb3735..571995939b 100644 --- a/package.json +++ b/package.json @@ -48,9 +48,11 @@ "react-native-image-crop-picker": "0.18.1", "react-native-image-resizer": "1.0.0", "react-native-invertible-scroll-view": "1.1.0", + "react-native-keychain": "3.0.0-rc.3", "react-native-level-fs": "3.0.0", "react-native-os": "1.1.0", "react-native-qrcode": "0.2.6", + "react-native-securerandom": "0.1.1", "react-native-splash-screen": "3.0.6", "react-native-svg": "6.3.1", "react-native-tcp": "3.3.0", diff --git a/react-native/src/status_im/react_native/js_dependencies.cljs b/react-native/src/status_im/react_native/js_dependencies.cljs index ee0808c417..dc5326f059 100644 --- a/react-native/src/status_im/react_native/js_dependencies.cljs +++ b/react-native/src/status_im/react_native/js_dependencies.cljs @@ -12,6 +12,7 @@ (def image-crop-picker (js/require "react-native-image-crop-picker")) (def image-resizer (js/require "react-native-image-resizer")) (def instabug (js/require "instabug-reactnative")) +(def keychain (js/require "react-native-keychain")) (def nfc (js/require "nfc-react-native")) (def qr-code (js/require "react-native-qrcode")) (def react-native (js/require "react-native")) @@ -19,6 +20,7 @@ (def webview-bridge (js/require "react-native-webview-bridge")) (def svg (js/require "react-native-svg")) (def react-native-fcm (js/require "react-native-fcm")) +(def secure-random (.-generateSecureRandom (js/require "react-native-securerandom"))) (def snoopy (js/require "rn-snoopy")) (def snoopy-filter (js/require "rn-snoopy/stream/filter")) (def snoopy-bars (js/require "rn-snoopy/stream/bars")) diff --git a/src/status_im/data_store/core.cljs b/src/status_im/data_store/core.cljs index 930c94d4e0..eafca8b6b2 100644 --- a/src/status_im/data_store/core.cljs +++ b/src/status_im/data_store/core.cljs @@ -11,9 +11,10 @@ [status-im.data-store.realm.core :as data-source] [status-im.utils.handlers :as handlers])) +(defn init [encryption-key] + (when-not @data-source/base-realm + (data-source/open-base-realm encryption-key)) + (data-source/reset-account-realm encryption-key)) -(defn init [] - (data-source/reset-account)) - -(defn change-account [address new-account? handler] - (data-source/change-account address new-account? handler)) +(defn change-account [address new-account? encryption-key handler] + (data-source/change-account address new-account? encryption-key handler)) diff --git a/src/status_im/data_store/realm/accounts.cljs b/src/status_im/data_store/realm/accounts.cljs index 576c13cc7b..b2b9aca5c4 100644 --- a/src/status_im/data_store/realm/accounts.cljs +++ b/src/status_im/data_store/realm/accounts.cljs @@ -2,21 +2,21 @@ (:require [status-im.data-store.realm.core :as realm])) (defn get-all-as-list [] - (->> (realm/all-clj (realm/get-all realm/base-realm :account) :account) + (->> (realm/all-clj (realm/get-all @realm/base-realm :account) :account) (mapv #(update % :settings realm/deserialize)))) (defn get-by-address [address] - (-> realm/base-realm + (-> @realm/base-realm (realm/get-by-field :account :address address) (realm/single-clj :account) (update :settings realm/deserialize))) (defn- create-account-fn [account update?] - #(realm/create realm/base-realm :account account update?)) + #(realm/create @realm/base-realm :account account update?)) (defn save [account update?] - (realm/write realm/base-realm + (realm/write @realm/base-realm (-> account (update :settings realm/serialize) (update :networks vals) diff --git a/src/status_im/data_store/realm/core.cljs b/src/status_im/data_store/realm/core.cljs index 6c435d209a..400cc21202 100644 --- a/src/status_im/data_store/realm/core.cljs +++ b/src/status_im/data_store/realm/core.cljs @@ -12,15 +12,29 @@ [status-im.utils.utils :as utils]) (:refer-clojure :exclude [exists?])) -(defn- realm-version - [file-name] - (.schemaVersion rn-dependencies/realm file-name)) +(defn to-buffer [key] + (when key + (let [length (.-length key) + arr (js/Uint8Array. length)] + (dotimes [i length] + (aset arr i (aget key i))) + (.-buffer arr)))) -(defn- open-realm - [options file-name] - (let [options (merge options {:path file-name})] - (when (cljs.core/exists? js/window) - (rn-dependencies/realm. (clj->js options))))) +(defn realm-version + [file-name encryption-key] + (if encryption-key + (.schemaVersion rn-dependencies/realm file-name (to-buffer encryption-key)) + (.schemaVersion rn-dependencies/realm file-name))) + +(defn open-realm + [options file-name encryption-key] + (log/debug "Opening realm at " file-name "...") + (let [options-js (clj->js (assoc options :path file-name))] + (when encryption-key + (log/debug "Using encryption key...") + (set! (.-encryptionKey options-js) (to-buffer encryption-key))) + (when (cljs.core/exists? js/window) + (rn-dependencies/realm. options-js)))) (defn- delete-realm [file-name] @@ -30,38 +44,37 @@ (when realm (.close realm))) -(defn- migrate-realm [file-name schemas] - (let [current-version (realm-version file-name)] +(defn migrate-realm [file-name schemas encryption-key] + (let [current-version (realm-version file-name encryption-key)] (doseq [schema schemas :when (> (:schemaVersion schema) current-version) - :let [migrated-realm (open-realm schema file-name)]] + :let [migrated-realm (open-realm schema file-name encryption-key)]] (close migrated-realm))) - (open-realm (last schemas) file-name)) + (open-realm (last schemas) file-name encryption-key)) -(defn- reset-realm [file-name schemas] +(defn reset-realm [file-name schemas encryption-key] (utils/show-popup "Please note" "You must recover or create a new account with this upgrade. Also chatting with accounts in previous releases is incompatible") (delete-realm file-name) - (open-realm (last schemas) file-name)) + (open-realm (last schemas) file-name encryption-key)) -(defn- open-migrated-realm - [file-name schemas] +(defn open-migrated-realm + [file-name schemas encryption-key] ;; TODO: remove for release 0.9.18 ;; delete the realm file if its schema version is higher ;; than existing schema version (this means the previous ;; install has incompatible database schemas) - (if (> (realm-version file-name) + (if (> (realm-version file-name encryption-key) (apply max (map :schemaVersion base/schemas))) - (reset-realm file-name schemas) - (migrate-realm file-name schemas))) + (reset-realm file-name schemas encryption-key) + (migrate-realm file-name schemas encryption-key))) (defn- index-entity-schemas [all-schemas] (into {} (map (juxt :name identity)) (-> all-schemas last :schema))) (def new-account-filename "new-account") -(def base-realm (open-migrated-realm (.-defaultPath rn-dependencies/realm) base/schemas)) - -(def account-realm (atom (open-migrated-realm new-account-filename account/schemas))) +(def base-realm (atom nil)) +(def account-realm (atom nil)) (def entity->schemas (merge (index-entity-schemas base/schemas) (index-entity-schemas account/schemas))) @@ -72,20 +85,29 @@ (close @account-realm) (reset! account-realm nil)) -(defn reset-account [] +(defn open-base-realm [encryption-key] + (log/debug "Opening base realm... (first run)") + (when @base-realm + (close @base-realm)) + (reset! base-realm (open-migrated-realm (.-defaultPath rn-dependencies/realm) base/schemas encryption-key)) + (log/debug "Created @base-realm")) + +(defn reset-account-realm [encryption-key] + (log/debug "Resetting account realm...") (when @account-realm (close @account-realm)) - (reset! account-realm (open-migrated-realm new-account-filename account/schemas)) - (.write @account-realm #(.deleteAll @account-realm))) + (reset! account-realm (open-migrated-realm new-account-filename account/schemas encryption-key)) + (.write @account-realm #(.deleteAll @account-realm)) + (log/debug "Created @account-realm")) -(defn move-file-handler [address err handler] +(defn move-file-handler [address encryption-key err handler] (log/debug "Moved file with error: " err address) (if err (log/error "Error moving account realm: " (.-message err)) - (reset! account-realm (open-migrated-realm address account/schemas))) + (reset! account-realm (open-migrated-realm address account/schemas encryption-key))) (handler err)) -(defn change-account [address new-account? handler] +(defn change-account [address new-account? encryption-key handler] (let [path (.-path @account-realm)] (log/debug "closing account realm: " path) (close-account-realm) @@ -93,9 +115,9 @@ (if new-account? (let [new-path (string/replace path new-account-filename address)] (log/debug "Moving file " path " to " new-path) - (fs/move-file path new-path #(move-file-handler address % handler))) + (fs/move-file path new-path #(move-file-handler address encryption-key % handler))) (do - (reset! account-realm (open-migrated-realm address account/schemas)) + (reset! account-realm (open-migrated-realm address account/schemas encryption-key)) (handler nil))))) (declare realm-obj->clj) diff --git a/src/status_im/native_module/impl/module.cljs b/src/status_im/native_module/impl/module.cljs index 81aad99888..de1368e4dd 100644 --- a/src/status_im/native_module/impl/module.cljs +++ b/src/status_im/native_module/impl/module.cljs @@ -63,7 +63,7 @@ "JavaScriptCore" "OttoVM") " jail initialized")] - (.initJail status init-js' #(do (re-frame/dispatch [:initialize-app]) + (.initJail status init-js' #(do (re-frame/dispatch [:initialize-keychain]) (log/debug log-message)))))))) (defonce listener-initialized (atom false)) diff --git a/src/status_im/ui/screens/accounts/login/events.cljs b/src/status_im/ui/screens/accounts/login/events.cljs index 6532aae307..7fbb2a43bd 100644 --- a/src/status_im/ui/screens/accounts/login/events.cljs +++ b/src/status_im/ui/screens/accounts/login/events.cljs @@ -7,6 +7,7 @@ [status-im.data-store.core :as data-store] [status-im.native-module.core :as status] [status-im.utils.config :as config] + [status-im.utils.keychain :as keychain] [status-im.utils.utils :as utils] [status-im.constants :as constants])) @@ -29,13 +30,16 @@ (fn [[address]] ;; if we don't add delay when running app without status-go ;; "null is not an object (evaluating 'realm.schema')" error appears - (let [change-account-fn (fn [] (data-store/change-account address - false - #(dispatch [:change-account-handler % address])))] - (if config/stub-status-go? - (utils/set-timeout change-account-fn - 300) - (change-account-fn))))) + (keychain/get-encryption-key-then + (fn [encryption-key] + (let [change-account-fn (fn [] (data-store/change-account address + false + encryption-key + #(dispatch [:change-account-handler % address])))] + (if config/stub-status-go? + (utils/set-timeout change-account-fn + 300) + (change-account-fn))))))) ;;;; Handlers diff --git a/src/status_im/ui/screens/desktop/main/tabs/profile/views.cljs b/src/status_im/ui/screens/desktop/main/tabs/profile/views.cljs index 2a748f9764..e73b727df8 100644 --- a/src/status_im/ui/screens/desktop/main/tabs/profile/views.cljs +++ b/src/status_im/ui/screens/desktop/main/tabs/profile/views.cljs @@ -1,6 +1,7 @@ (ns status-im.ui.screens.desktop.main.tabs.profile.views (:require-macros [status-im.utils.views :as views]) (:require [re-frame.core :as re-frame] + [status-im.utils.keychain :as keychain] [status-im.ui.components.react :as react] [status-im.ui.screens.profile.user.views :as profile])) @@ -35,7 +36,9 @@ [react/view [my-profile-info current-account]] [react/view {:style {:height 1 :background-color "#e8ebec" :margin-horizontal 16}}] - [react/touchable-highlight {:on-press #(re-frame/dispatch [:logout]) + [react/touchable-highlight {:on-press #(keychain/get-encryption-key-then + (fn [encryption-key] + (re-frame/dispatch [:logout encryption-key]))) :style {:margin-top 60}} [react/view [react/text {:style {:color :red}} "Log out"]]]])) diff --git a/src/status_im/ui/screens/events.cljs b/src/status_im/ui/screens/events.cljs index d6a8ea2981..00ea8073d9 100644 --- a/src/status_im/ui/screens/events.cljs +++ b/src/status_im/ui/screens/events.cljs @@ -43,6 +43,7 @@ [status-im.utils.handlers-macro :as handlers-macro] [status-im.utils.http :as http] [status-im.utils.instabug :as instabug] + [status-im.utils.keychain :as keychain] [status-im.utils.mixpanel :as mixpanel] [status-im.utils.platform :as platform] [status-im.utils.types :as types] @@ -126,13 +127,25 @@ (re-frame/reg-fx ::init-store - (fn [] - (data-store/init))) + (fn [encryption-key] + (data-store/init encryption-key))) (defn move-to-internal-storage [config] (status/move-to-internal-storage #(status/start-node config))) +(re-frame/reg-fx + ::initialize-keychain-fx + (fn [] + (keychain/get-encryption-key-then + (fn [encryption-key] + (re-frame/dispatch [:initialize-app encryption-key]))))) + +(re-frame/reg-fx + ::got-encryption-key-fx + (fn [{:keys [encryption-key callback]}] + (callback encryption-key))) + (re-frame/reg-fx :initialize-geth-fx (fn [config] @@ -201,10 +214,20 @@ (assoc-in db path v))) (handlers/register-handler-fx - :initialize-app + :initialize-keychain (fn [_ _] + {::initialize-keychain-fx nil})) + +(handlers/register-handler-fx + :got-encryption-key + (fn [_ [_ opts]] + {::got-encryption-key-fx opts})) + +(handlers/register-handler-fx + :initialize-app + (fn [_ [_ encryption-key]] {::testfairy-alert nil - :dispatch-n [[:initialize-db] + :dispatch-n [[:initialize-db encryption-key] [:load-accounts] [:initialize-views] [:listen-to-network-status] @@ -212,11 +235,11 @@ (handlers/register-handler-fx :logout - (fn [{:keys [db] :as cofx} _] + (fn [{:keys [db] :as cofx} [_ encryption-key]] (let [{:transport/keys [chats]} db sharing-usage-data? (get-in db [:account/account :sharing-usage-data?])] (handlers-macro/merge-fx cofx - {:dispatch-n (concat [[:initialize-db] + {:dispatch-n (concat [[:initialize-db encryption-key] [:load-accounts] [:listen-to-network-status] [:navigate-to :accounts]] @@ -228,8 +251,9 @@ :initialize-db (fn [{{:keys [status-module-initialized? status-node-started? network-status network] - :or {network (get app-db :network)}} :db} _] - {::init-store nil + :or {network (get app-db :network)}} :db} + [_ encryption-key]] + {::init-store encryption-key :db (assoc app-db :contacts/contacts {} :network-status network-status diff --git a/src/status_im/ui/screens/profile/user/views.cljs b/src/status_im/ui/screens/profile/user/views.cljs index 466fe0e319..9b544e8531 100644 --- a/src/status_im/ui/screens/profile/user/views.cljs +++ b/src/status_im/ui/screens/profile/user/views.cljs @@ -16,6 +16,7 @@ [status-im.ui.screens.profile.user.styles :as styles] [status-im.utils.build :as build] [status-im.utils.config :as config] + [status-im.utils.keychain :as keychain] [status-im.utils.platform :as platform] [status-im.utils.utils :as utils] [status-im.ui.components.icons.vector-icons :as icons] @@ -90,7 +91,9 @@ (defn- handle-logout [] (utils/show-confirmation (i18n/label :t/logout-title) (i18n/label :t/logout-are-you-sure) - (i18n/label :t/logout) #(re-frame/dispatch [:logout]))) + (i18n/label :t/logout) #(keychain/get-encryption-key-then + (fn [encryption-key] + (re-frame/dispatch [:logout encryption-key]))))) (defn- my-profile-settings [{:keys [seed-backed-up? mnemonic]} sharing-usage-data?] (let [show-backup-seed? (and (not seed-backed-up?) (not (string/blank? mnemonic)))] diff --git a/src/status_im/utils/keychain.cljs b/src/status_im/utils/keychain.cljs new file mode 100644 index 0000000000..338fb98086 --- /dev/null +++ b/src/status_im/utils/keychain.cljs @@ -0,0 +1,48 @@ +(ns status-im.utils.keychain + (:require [re-frame.core :as re-frame] + [taoensso.timbre :as log] + [status-im.react-native.js-dependencies :as rn])) + +(def key-bytes 64) +(def username "status-im.encryptionkey") + +(defn- encryption-key-fetch [{:keys [resolve reject]}] + (-> (.getGenericPassword rn/keychain) + (.then + (fn [res] + (if (not res) + (when reject + (reject)) + (let [encryption-key (.parse js/JSON (.-password res))] + (log/debug "Found existing encryption key!") + (re-frame/dispatch [:got-encryption-key {:encryption-key encryption-key + :callback resolve}]))))) + (.catch + (fn [err] + (log/debug err))))) + +(defn encryption-key-reset [] + (log/debug "Resetting key...") + (-> (.resetGenericPassword rn/keychain))) + +(defn get-encryption-key-then [callback] + (log/debug "Initializing realm encryption key...") + (encryption-key-fetch {:resolve callback + :reject (fn [] + (log/debug "No key exists, creating...") + (-> (rn/secure-random key-bytes) + (.then + (fn [encryption-key] + (-> (.setGenericPassword + rn/keychain + username + (.stringify js/JSON (.from js/Array encryption-key))) + (.then + (fn [res] + (encryption-key-fetch {:resolve callback}))) + (.catch + (fn [err] + (log/debug err)))))) + (.catch + (fn [err] + (log/debug err)))))})) \ No newline at end of file