Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use a default pairing password Keycard #12811

Merged
merged 1 commit into from
Nov 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"react-native-shake": "^3.3.1",
"react-native-share": "^7.0.1",
"react-native-splash-screen": "^3.2.0",
"react-native-status-keycard": "git+https://github.com/status-im/react-native-status-keycard.git#v2.5.35",
"react-native-status-keycard": "git+https://github.com/status-im/react-native-status-keycard.git#v2.5.36",
"react-native-svg": "^9.8.4",
"react-native-touch-id": "^4.4.1",
"react-native-webview": "git+https://github.com/status-im/react-native-webview.git#v11.3.0-status",
Expand Down
15 changes: 13 additions & 2 deletions src/status_im/keycard/common.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
[status-im.utils.keychain.core :as keychain]
[status-im.utils.types :as types]
[taoensso.timbre :as log]
[status-im.utils.datetime :as utils.datetime]
[status-im.bottom-sheet.core :as bottom-sheet]
[status-im.utils.platform :as platform]
[status-im.popover.core :as popover]))
Expand Down Expand Up @@ -416,6 +417,14 @@

;; Get application info

(fx/defn update-pairings
[{:keys [db]} instance-uid pairing]
(let [paired-on (utils.datetime/timestamp)
pairings (-> (get-in db [:keycard :pairings])
(assoc instance-uid {:pairing pairing :paired-on paired-on}))]
{:keycard/persist-pairings pairings
:db (assoc-in db [:keycard :pairings] pairings)}))

(fx/defn get-application-info
{:events [:keycard/get-application-info]}
[{:keys [db]} on-card-read]
Expand All @@ -425,9 +434,8 @@
(fx/defn on-get-application-info-success
{:events [:keycard.callback/on-get-application-info-success]}
[{:keys [db] :as cofx} info on-success]
(let [{:keys [pin-retry-counter puk-retry-counter]} info
(let [{:keys [pin-retry-counter puk-retry-counter instance-uid new-pairing]} info
view-id (:view-id db)

{:keys [on-card-read]} (:keycard db)
on-success' (or on-success on-card-read)
enter-step (get-in db [:keycard :pin :enter-step])]
Expand All @@ -443,6 +451,8 @@
(assoc-in [:keycard :application-info :applet-installed?] true)
(assoc-in [:keycard :application-info-error] nil))}
(stash-on-card-read)
(when new-pairing
(update-pairings instance-uid new-pairing))
(when (and (zero? pin-retry-counter)
(pos? puk-retry-counter)
(not= enter-step :puk))
Expand All @@ -452,6 +462,7 @@
(blocked-keycard-popup cofx)
(when on-success'
(dispatch-event cofx on-success')))))))

(fx/defn on-get-application-info-error
{:events [:keycard.callback/on-get-application-info-error]}
[{:keys [db] :as cofx} error]
Expand Down
9 changes: 4 additions & 5 deletions src/status_im/keycard/onboarding.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,10 @@
[{:keys [db] :as cofx} secrets]
(let [secrets' (js->clj secrets :keywordize-keys true)]
(fx/merge cofx
{:keycard/get-application-info nil
:db (-> db
(assoc-in [:keycard :card-state] :init)
(assoc-in [:keycard :setup-step] :secret-keys)
(update-in [:keycard :secrets] merge secrets'))}
{:db (-> db
(assoc-in [:keycard :card-state] :init)
(assoc-in [:keycard :setup-step] :secret-keys)
(update-in [:keycard :secrets] merge secrets'))}
(load-pairing-screen))))

(fx/defn on-install-applet-and-init-card-error
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6735,9 +6735,9 @@ react-native-splash-screen@^3.2.0:
resolved "https://registry.yarnpkg.com/react-native-splash-screen/-/react-native-splash-screen-3.2.0.tgz#d47ec8557b1ba988ee3ea98d01463081b60fff45"
integrity sha512-Ls9qiNZzW/OLFoI25wfjjAcrf2DZ975hn2vr6U9gyuxi2nooVbzQeFoQS5vQcbCt9QX5NY8ASEEAtlLdIa6KVg==

"react-native-status-keycard@git+https://github.com/status-im/react-native-status-keycard.git#v2.5.35":
version "2.5.35"
resolved "git+https://github.com/status-im/react-native-status-keycard.git#8cf7cbff803b080b2069202ea6179703b8c69d2e"
"react-native-status-keycard@git+https://github.com/status-im/react-native-status-keycard.git#v2.5.36":
version "2.5.36"
resolved "git+https://github.com/status-im/react-native-status-keycard.git#7548329c597a6e1370010b8aa2d16a1d93610f11"

react-native-svg@^9.8.4:
version "9.13.6"
Expand Down