        #(on-success response)))))
 
 (defn unblock-pin
-  [{:keys [puk on-success on-failure]}]
+  [{:keys [puk new-pin on-success on-failure]}]
   (if (= puk (get @state :puk))
     (do
       (swap! state update :application-info assoc
              :pin-retry-counter 3
              :puk-retry-counter 5)
+      (swap! state assoc :pin new-pin)
       (later #(on-success true)))
     (do
       (swap! state update-in


(def initial-state
  {:card-connected?  false
   :nfc-started? false
   :application-info {:initialized? false}})

(defonce state (atom initial-state))

    (callback)))

(defn reset-state []
  (swap! state assoc :application-info {:initialized? false}))

(defn- later [f]
  (when f
