fix: display the value to sign as a bytes32 hex string if the data is 66 chars long
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
parent
b891b1b98b
commit
277f65b94d
|
@ -138,3 +138,13 @@
|
|||
nil)]
|
||||
(when normalized-key
|
||||
(subs (sha3 normalized-key) 26))))
|
||||
|
||||
(def ^:const bytes32-length 66) ; length of '0x' + 64 hex values. (a 32bytes value has 64 nibbles)
|
||||
|
||||
(defn hex->text
|
||||
"Converts a hexstring to UTF8 text. If the data received is 32 bytes long,
|
||||
return the value unconverted"
|
||||
[data]
|
||||
(if (= bytes32-length (count (normalized-hex data)))
|
||||
data ; Assume it's a bytes32
|
||||
(hex-to-utf8 data)))
|
||||
|
|
|
@ -195,7 +195,7 @@
|
|||
:signing/sign {:type (cond pinless? :pinless
|
||||
keycard-multiaccount? :keycard
|
||||
:else :password)
|
||||
:formatted-data (if typed? (types/json->clj data) (ethereum/hex-to-utf8 data))
|
||||
:formatted-data (if typed? (types/json->clj data) (ethereum/hex->text data))
|
||||
:keycard-step (when pinless? :connect)})}
|
||||
(when pinless?
|
||||
(signing.keycard/hash-message {:data data
|
||||
|
|
Loading…
Reference in New Issue