support PUK and seed recovery during onboarding

Signed-off-by: Michele Balistreri <michele@bitgamma.com>
This commit is contained in:
Michele Balistreri 2021-12-27 11:37:31 +03:00
parent cd86a1065b
commit e45f959c27
No known key found for this signature in database
GPG Key ID: E9567DA33A4F791A
4 changed files with 15 additions and 6 deletions

View File

@ -16,7 +16,7 @@
(fx/merge cofx
{:db (-> db
(assoc-in [:keycard :creating-backup?] backup-type))}
(when-not (:multiaccounts/login db)
(when (:multiaccount db)
(navigation/change-tab :profile))
(navigation/navigate-to-cofx :seed-phrase nil)))

View File

@ -66,7 +66,7 @@
:error nil
:status nil))
:hide-popover nil})
(when-not (:multiaccounts/login db)
(when (:multiaccount db)
(navigation/change-tab :profile))
(when-not (:multiaccounts/login db)
(if (:popover/popover db)

View File

@ -217,9 +217,15 @@
:t/keycard-access-reset :t/keycard-backup-success-title))
:content (i18n/label (if (= backup-type :recovery-card)
:t/keycard-can-use-with-new-passcode :t/keycard-backup-success-body))}}
(if (multiaccounts.model/logged-in? cofx)
(cond
(multiaccounts.model/logged-in? cofx)
(navigation/set-stack-root :profile-stack [:my-profile :keycard-settings])
(return-to-keycard-login))))
(:multiaccounts/login db)
(return-to-keycard-login)
:else
(navigation/set-stack-root :onboarding [:get-your-keys]))))
(re-frame/reg-fx
::finish-migration

View File

@ -109,12 +109,15 @@
types/json->clj
:error
string/blank?
not)]
not)
onboarding? (not (or (:multiaccounts/login db) (:multiaccount db)))]
(if error?
(popover/show-popover cofx {:view :custom-seed-phrase})
{::validate-seed-against-key-uid {:seed-phrase (-> db :multiaccounts/key-storage :seed-phrase)
;; Unique key-uid of the account for which we are going to move keys
:key-uid (or (-> db :multiaccounts/login :key-uid) (-> db :multiaccount :key-uid))}})))
:key-uid (or (-> db :multiaccounts/login :key-uid)
(-> db :multiaccount :key-uid)
(and onboarding? (-> db :keycard :application-info :key-uid)))}})))
(fx/defn choose-storage-pressed
{:events [::choose-storage-pressed]}