fix(@desktop/keycard): resolving v param for data signed on a keycard fixed
This commit is contained in:
parent
37e35d143e
commit
52d760d1b3
|
@ -89,9 +89,13 @@ proc toCardMetadata(jsonObj: JsonNode): CardMetadata =
|
||||||
proc toTransactionSignature(jsonObj: JsonNode): TransactionSignature =
|
proc toTransactionSignature(jsonObj: JsonNode): TransactionSignature =
|
||||||
discard jsonObj.getProp(ResponseParamTxSignatureR, result.r)
|
discard jsonObj.getProp(ResponseParamTxSignatureR, result.r)
|
||||||
discard jsonObj.getProp(ResponseParamTxSignatureS, result.s)
|
discard jsonObj.getProp(ResponseParamTxSignatureS, result.s)
|
||||||
discard jsonObj.getProp(ResponseParamTxSignatureV, result.v)
|
var v: int
|
||||||
if result.v.len == 0:
|
discard jsonObj.getProp(ResponseParamTxSignatureV, v)
|
||||||
result.v = "0"
|
## The signature must conform to the secp256k1 curve R, S and V values, where the V value must be 27 or 28 for legacy reasons.
|
||||||
|
## Transform V from 0/1 to 27/28 (1b/1c) according to the yellow paper https://ethereum.github.io/yellowpaper/paper.pdf
|
||||||
|
result.v = "1b"
|
||||||
|
if v == 1:
|
||||||
|
result.v = "1c"
|
||||||
|
|
||||||
proc toKeycardEvent(jsonObj: JsonNode): KeycardEvent =
|
proc toKeycardEvent(jsonObj: JsonNode): KeycardEvent =
|
||||||
discard jsonObj.getProp(ResponseParamErrorKey, result.error)
|
discard jsonObj.getProp(ResponseParamErrorKey, result.error)
|
||||||
|
|
Loading…
Reference in New Issue