[fix #8375] unavailable for non bioauth devices

Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
tbenr 2019-06-08 12:34:15 +02:00 committed by Andrey Shovkoplyas
parent 49d5a3082e
commit 66dafaef25
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
2 changed files with 3 additions and 10 deletions

View File

@ -71,9 +71,9 @@
(defn get-supported [callback] (defn get-supported [callback]
(cond platform/ios? (do-get-supported callback) (cond platform/ios? (do-get-supported callback)
platform/android? (if android-device-blacklisted? platform/android? (if android-device-blacklisted?
(callback false) (callback nil)
(do-get-supported callback)) (do-get-supported callback))
:else (callback false))) :else (callback nil)))
(defn authenticate (defn authenticate
([cb] ([cb]

View File

@ -4,7 +4,6 @@
[status-im.react-native.js-dependencies :as rn] [status-im.react-native.js-dependencies :as rn]
[status-im.utils.platform :as platform] [status-im.utils.platform :as platform]
[status-im.utils.security :as security] [status-im.utils.security :as security]
[status-im.biometric-auth.core :as biometric-auth]
[status-im.native-module.core :as status])) [status-im.native-module.core :as status]))
(def key-bytes 64) (def key-bytes 64)
@ -85,10 +84,6 @@
(enum-val "ACCESS_CONTROL" "BIOMETRY_ANY_OR_DEVICE_PASSCODE")})) (enum-val "ACCESS_CONTROL" "BIOMETRY_ANY_OR_DEVICE_PASSCODE")}))
(.then callback))) (.then callback)))
;; Android and iOS
(defn- biometric-auth-available? [callback]
(biometric-auth/get-supported #(callback (some? %))))
;; Stores the password for the address to the Keychain ;; Stores the password for the address to the Keychain
(defn save-user-password [address password callback] (defn save-user-password [address password callback]
(-> (.setInternetCredentials (rn/keychain) address address password keychain-secure-hardware (clj->js keychain-restricted-availability)) (-> (.setInternetCredentials (rn/keychain) address address password keychain-secure-hardware (clj->js keychain-restricted-availability))
@ -118,13 +113,11 @@
(defn can-save-user-password? [callback] (defn can-save-user-password? [callback]
(cond (cond
platform/ios? (check-conditions callback platform/ios? (check-conditions callback
device-encrypted? device-encrypted?)
biometric-auth-available?)
platform/android? (check-conditions platform/android? (check-conditions
callback callback
secure-hardware-available? secure-hardware-available?
biometric-auth-available?
device-not-rooted?) device-not-rooted?)
:else (callback false))) :else (callback false)))