mirror of
https://github.com/status-im/status-react.git
synced 2025-03-02 11:30:47 +00:00
fix factory reset and unblock pin
Signed-off-by: Michele Balistreri <michele@bitgamma.com>
This commit is contained in:
parent
7d9a2f074e
commit
170ef0a429
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
(def initial-state
|
(def initial-state
|
||||||
{:card-connected? false
|
{:card-connected? false
|
||||||
:nfc-started? false
|
|
||||||
:application-info {:initialized? false}})
|
:application-info {:initialized? false}})
|
||||||
|
|
||||||
(defonce state (atom initial-state))
|
(defonce state (atom initial-state))
|
||||||
@ -68,7 +67,7 @@
|
|||||||
(callback)))
|
(callback)))
|
||||||
|
|
||||||
(defn reset-state []
|
(defn reset-state []
|
||||||
(reset! state initial-state))
|
(swap! state assoc :application-info {:initialized? false}))
|
||||||
|
|
||||||
(defn- later [f]
|
(defn- later [f]
|
||||||
(when f
|
(when f
|
||||||
@ -260,12 +259,13 @@
|
|||||||
#(on-success response)))))
|
#(on-success response)))))
|
||||||
|
|
||||||
(defn unblock-pin
|
(defn unblock-pin
|
||||||
[{:keys [puk on-success on-failure]}]
|
[{:keys [puk new-pin on-success on-failure]}]
|
||||||
(if (= puk (get @state :puk))
|
(if (= puk (get @state :puk))
|
||||||
(do
|
(do
|
||||||
(swap! state update :application-info assoc
|
(swap! state update :application-info assoc
|
||||||
:pin-retry-counter 3
|
:pin-retry-counter 3
|
||||||
:puk-retry-counter 5)
|
:puk-retry-counter 5)
|
||||||
|
(swap! state assoc :pin new-pin)
|
||||||
(later #(on-success true)))
|
(later #(on-success true)))
|
||||||
(do
|
(do
|
||||||
(swap! state update-in
|
(swap! state update-in
|
||||||
@ -469,7 +469,7 @@
|
|||||||
(get-application-info args))
|
(get-application-info args))
|
||||||
(keycard/factory-reset [this args]
|
(keycard/factory-reset [this args]
|
||||||
(log/debug "simulated card factory-reset")
|
(log/debug "simulated card factory-reset")
|
||||||
(get-application-info args))
|
(factory-reset args))
|
||||||
(keycard/install-applet [this args]
|
(keycard/install-applet [this args]
|
||||||
(log/debug "simulated card install-applet")
|
(log/debug "simulated card install-applet")
|
||||||
(install-applet args))
|
(install-applet args))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user