     (get-application-info args))
   (keycard/factory-reset [this args]
     (log/debug "simulated card factory-reset")
-    (get-application-info args))
+    (factory-reset args))
   (keycard/install-applet [this args]
     (log/debug "simulated card install-applet")
     (install-applet args))

       #(on-success response)))))

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

    (callback)))

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

(defn- later [f]
  (when f
