[#10443] Remove sensitive information from keycard logs

This commit is contained in:
Roman Volosovskyi 2020-04-28 17:53:16 +03:00
parent 96ed1fdeb9
commit 309987cc89
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
1 changed files with 53 additions and 86 deletions

View File

@ -21,7 +21,7 @@
card
{:on-success
(fn [response]
(log/info "[keycard response] check-nfc-support" response)
(log/info "[keycard response] check-nfc-support")
(re-frame/dispatch
[:hardwallet.callback/check-nfc-support-success response]))}))
@ -31,7 +31,7 @@
card
{:on-success
(fn [response]
(log/info "[keycard response] check-nfc-enabled" response)
(log/info "[keycard response] check-nfc-enabled")
(re-frame/dispatch
[:hardwallet.callback/check-nfc-enabled-success response]))}))
@ -83,15 +83,13 @@
args
{:on-success
(fn [response]
(log/info "[keycard response succ] get-application-info"
(js->clj response :keywordize-keys true))
(log/info "[keycard response succ] get-application-info")
(re-frame/dispatch
[:hardwallet.callback/on-get-application-info-success
response on-success]))
:on-failure
(fn [response]
(log/info "[keycard response fail] get-application-info"
(error-object->map response))
(log/info "[keycard response fail] get-application-info")
(re-frame/dispatch
[:hardwallet.callback/on-get-application-info-error
(error-object->map response)]))})))
@ -102,14 +100,12 @@
card
{:on-success
(fn [response]
(log/info "[keycard response succ] install-applet"
(js->clj response :keywordize-keys true))
(log/info "[keycard response succ] install-applet")
(re-frame/dispatch
[:hardwallet.callback/on-install-applet-success response]))
:on-failure
(fn [response]
(log/info "[keycard response fail] install-applet"
(error-object->map response))
(log/info "[keycard response fail] install-applet")
(re-frame/dispatch
[:hardwallet.callback/on-install-applet-error
(error-object->map response)]))}))
@ -121,14 +117,12 @@
{:pin pin
:on-success
(fn [response]
(log/info "[keycard response succ] init-card"
(js->clj response :keywordize-keys true))
(log/info "[keycard response succ] init-card")
(re-frame/dispatch
[:hardwallet.callback/on-init-card-success response]))
:on-failure
(fn [response]
(log/info "[keycard response fail] init-card"
(error-object->map response))
(log/info "[keycard response fail] init-card")
(re-frame/dispatch
[:hardwallet.callback/on-init-card-error
(error-object->map response)]))}))
@ -140,131 +134,119 @@
{:pin pin
:on-success
(fn [response]
(log/info "[keycard response succ] install-applet-and-init-card"
(js->clj response :keywordize-keys true))
(log/info "[keycard response succ] install-applet-and-init-card")
#(re-frame/dispatch
[:hardwallet.callback/on-install-applet-and-init-card-success
response]))
:on-failure
(fn [response]
(log/info "[keycard response fail] install-applet-and-init-card"
(error-object->map response))
(log/info "[keycard response fail] install-applet-and-init-card")
(re-frame/dispatch
[:hardwallet.callback/on-install-applet-and-init-card-error
(error-object->map response)]))}))
(defn pair [args]
(log/info "[keycard] pair" args)
(log/info "[keycard] pair")
(keycard/pair
card
(merge
args
{:on-success
(fn [response]
(log/info "[keycard response succ] pair"
(js->clj response :keywordize-keys true))
(log/info "[keycard response succ] pair")
(re-frame/dispatch
[:hardwallet.callback/on-pair-success response]))
:on-failure
(fn [response]
(log/info "[keycard response fail] pair" (error-object->map response))
(log/info "[keycard response fail] pair")
(re-frame/dispatch
[:hardwallet.callback/on-pair-error (error-object->map response)]))})))
(defn generate-and-load-key [args]
(log/info "[keycard] generate-and-load-key" args)
(log/info "[keycard] generate-and-load-key")
(keycard/generate-and-load-key
card
(merge
args
{:on-success
(fn [response]
(log/info "[keycard response succ] generate-and-load-key"
(js->clj response :keywordize-keys true))
(log/info "[keycard response succ] generate-and-load-key")
(re-frame/dispatch
[:hardwallet.callback/on-generate-and-load-key-success response]))
:on-failure
(fn [response]
(log/info "[keycard response fail] generate-and-load-key"
(error-object->map response))
(log/info "[keycard response fail] generate-and-load-key")
(re-frame/dispatch
[:hardwallet.callback/on-generate-and-load-key-error
(error-object->map response)]))})))
(defn unblock-pin [args]
(log/info "[keycard] unblock-pin" args)
(log/info "[keycard] unblock-pin")
(keycard/unblock-pin
card
(merge
args
{:on-success
(fn [response]
(log/info "[keycard response succ] unblock-pin"
(js->clj response :keywordize-keys true))
(log/info "[keycard response succ] unblock-pin")
(re-frame/dispatch
[:hardwallet.callback/on-unblock-pin-success response]))
:on-failure
(fn [response]
(log/info "[keycard response fail] unblock-pin"
(error-object->map response))
(log/info "[keycard response fail] unblock-pin")
(re-frame/dispatch [:hardwallet.callback/on-unblock-pin-error
(error-object->map response)]))})))
(defn verify-pin [args]
(log/info "[keycard] verify-pin" args)
(log/info "[keycard] verify-pin")
(keycard/verify-pin
card
(merge
args
{:on-success
(fn [response]
(log/info "[keycard response succ] verify-pin"
(js->clj response :keywordize-keys true))
(log/info "[keycard response succ] verify-pin")
(re-frame/dispatch [:hardwallet.callback/on-verify-pin-success
response]))
:on-failure
(fn [response]
(log/info "[keycard response fail] verify-pin"
(error-object->map response))
(log/info "[keycard response fail] verify-pin")
(re-frame/dispatch
[:hardwallet.callback/on-verify-pin-error
(error-object->map response)]))})))
(defn change-pin [args]
(log/info "[keycard] change-pin" args)
(log/info "[keycard] change-pin")
(keycard/change-pin
card
(merge
args
{:on-success
(fn [response]
(log/info "[keycard response succ] change-pin"
(js->clj response :keywordize-keys true))
(log/info "[keycard response succ] change-pin")
(re-frame/dispatch
[:hardwallet.callback/on-change-pin-success response]))
:on-failure
(fn [response]
(log/info "[keycard response fail] change-pin"
(error-object->map response))
(log/info "[keycard response fail] change-pin")
(re-frame/dispatch
[:hardwallet.callback/on-change-pin-error
(error-object->map response)]))})))
(defn unpair [args]
(log/info "[keycard] unpair" args)
(log/info "[keycard] unpair")
(keycard/unpair
card
(merge
args
{:on-success
(fn [response]
(log/info "[keycard response succ] unpair"
(js->clj response :keywordize-keys true))
(log/info "[keycard response succ] unpair")
(re-frame/dispatch
[:hardwallet.callback/on-unpair-success response]))
:on-failure
(fn [response]
(log/info "[keycard response fail] unpair" (error-object->map response))
(log/info "[keycard response fail] unpair")
(re-frame/dispatch
[:hardwallet.callback/on-unpair-error
(error-object->map response)]))})))
@ -275,129 +257,117 @@
card
{:on-success
(fn [response]
(log/info "[keycard response succ] delete"
(js->clj response :keywordize-keys true))
(log/info "[keycard response succ] delete")
(re-frame/dispatch
[:hardwallet.callback/on-delete-success response]))
:on-failure
(fn [response]
(log/debug "[keycard response fail] delete"
(error-object->map response))
(log/debug "[keycard response fail] delete")
(re-frame/dispatch
[:hardwallet.callback/on-delete-error
(error-object->map response)]))}))
(defn remove-key [args]
(log/info "[keycard] remove-key" args)
(log/info "[keycard] remove-key")
(keycard/remove-key
card
(merge
args
{:on-success
(fn [response]
(log/info "[keycard response succ] remove-key"
(js->clj response :keywordize-keys true))
(log/info "[keycard response succ] remove-key")
(re-frame/dispatch [:hardwallet.callback/on-remove-key-success
response]))
:on-failure
(fn [response]
(log/info "[keycard response fail] remove-key" response)
(log/info "[keycard response fail] remove-key")
(re-frame/dispatch [:hardwallet.callback/on-remove-key-error
(error-object->map response)]))})))
(defn remove-key-with-unpair [args]
(log/info "[keycard] remove-key-with-unpair" args)
(log/info "[keycard] remove-key-with-unpair")
(keycard/remove-key-with-unpair
card
(merge
args
{:on-success
(fn [response]
(log/info "[keycard response succ] remove-key-with-unpair"
(js->clj response :keywordize-keys true))
(log/info "[keycard response succ] remove-key-with-unpair")
(re-frame/dispatch [:hardwallet.callback/on-remove-key-success
response]))
:on-failure
(fn [response]
(log/info "[keycard response fail] remove-key-with-unpair"
(error-object->map response))
(log/info "[keycard response fail] remove-key-with-unpair")
(re-frame/dispatch [:hardwallet.callback/on-remove-key-error
(error-object->map response)]))})))
(defn export-key [args]
(log/info "[keycard] export-key" args)
(log/info "[keycard] export-key")
(keycard/export-key
card
(merge
args
{:on-success
(fn [response]
(log/info "[keycard response succ] export-key"
(js->clj response :keywordize-keys true))
(log/info "[keycard response succ] export-key")
(re-frame/dispatch [:hardwallet.callback/on-export-key-success
response]))
:on-failure
(fn [response]
(log/info "[keycard response fail] export-key"
(error-object->map response))
(log/info "[keycard response fail] export-key")
(re-frame/dispatch [:hardwallet.callback/on-export-key-error
(error-object->map response)]))})))
(defn unpair-and-delete [args]
(log/info "[keycard] unpair-and-delete" args)
(log/info "[keycard] unpair-and-delete")
(keycard/unpair-and-delete
card
(merge
args
{:on-success
(fn [response]
(log/info "[keycard response succ] unpair-and-delete"
(js->clj response :keywordize-keys true))
(log/info "[keycard response succ] unpair-and-delete")
(re-frame/dispatch [:hardwallet.callback/on-delete-success
response]))
:on-failure
(fn [response]
(log/info "[keycard response fail] unpair-and-delete"
(error-object->map response))
(log/info "[keycard response fail] unpair-and-delete")
(re-frame/dispatch [:hardwallet.callback/on-delete-error
(error-object->map response)]))})))
(defn get-keys [{:keys [on-success] :as args}]
(log/info "[keycard] get-keys" args)
(log/info "[keycard] get-keys")
(keycard/get-keys
card
(merge
args
{:on-success
(fn [response]
(log/info "[keycard response succ] get-keys"
(js->clj response :keywordize-keys true))
(log/info "[keycard response succ] get-keys")
(re-frame/dispatch
[(or on-success :hardwallet.callback/on-get-keys-success)
response]))
:on-failure
(fn [response]
(log/info "[keycard response fail] get-keys"
(error-object->map response))
(log/info "[keycard response fail] get-keys")
(re-frame/dispatch [:hardwallet.callback/on-get-keys-error
(error-object->map response)]))})))
(defn sign [{:keys [on-success on-failure] :as args}]
(log/info "[keycard] sign" args)
(log/info "[keycard] sign")
(keycard/sign
card
(merge
args
{:on-success
(fn [response]
(log/info "[keycard response succ] sign" (js->clj response :keywordize-keys true))
(log/info "[keycard response succ] sign")
(if on-success
(on-success response)
(re-frame/dispatch [:hardwallet.callback/on-sign-success response])))
:on-failure
(fn [response]
(log/info "[keycard response fail] sign"
(error-object->map response))
(log/info "[keycard response fail] sign")
(if on-failure
(on-failure response)
(re-frame/dispatch
@ -410,33 +380,30 @@
card
{:on-success
(fn [response]
(log/info "[keycard response succ] install-cash-applet"
(js->clj response :keywordize-keys true))
(log/info "[keycard response succ] install-cash-applet")
(re-frame/dispatch
[:hardwallet.callback/on-install-applet-success response]))
:on-failure
(fn [response]
(log/info "[keycard response fail] install-cash-applet"
(error-object->map response))
(log/info "[keycard response fail] install-cash-applet")
(re-frame/dispatch
[:hardwallet.callback/on-install-applet-error
(error-object->map response)]))}))
(defn sign-typed-data
[{:keys [hash] :as args}]
(log/info "[keycard] sign-typed-data" args)
(log/info "[keycard] sign-typed-data")
(keycard/sign-typed-data
card
{:hash hash
:on-success
(fn [response]
(log/info "[keycard response succ] sign-typed-data" (js->clj response :keywordize-keys true))
(log/info "[keycard response succ] sign-typed-data")
(re-frame/dispatch [:hardwallet.callback/on-sign-success
response]))
:on-failure
(fn [response]
(log/info "[keycard response fail] sign-typed-data"
(error-object->map response))
(log/info "[keycard response fail] sign-typed-data")
(re-frame/dispatch
[:hardwallet.callback/on-sign-error
(error-object->map response)]))}))