mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 07:28:10 +00:00
core/eos: revert new pubkey format
This commit is contained in:
parent
5a2c67ccae
commit
07ce935725
@ -17,7 +17,7 @@ def _public_key_to_wif(pub_key: bytes) -> str:
|
||||
compressed_pub_key = pub_key
|
||||
else:
|
||||
raise wire.DataError("invalid public key")
|
||||
return base58_encode("PUB", "K1", compressed_pub_key)
|
||||
return base58_encode("EOS", "", compressed_pub_key)
|
||||
|
||||
|
||||
def _get_public_key(node):
|
||||
|
@ -7,9 +7,9 @@ from apps.common import HARDENED
|
||||
def base58_encode(prefix: str, sig_prefix: str, data: bytes) -> str:
|
||||
b58 = base58.encode(data + base58.ripemd160_32(data + sig_prefix.encode()))
|
||||
if sig_prefix:
|
||||
return prefix + "_" + sig_prefix + "_" + b58
|
||||
return prefix + sig_prefix + "_" + b58
|
||||
else:
|
||||
return prefix + "_" + b58
|
||||
return prefix + b58
|
||||
|
||||
|
||||
def eos_name_to_string(value) -> str:
|
||||
|
@ -36,7 +36,7 @@ async def sign_tx(ctx, msg: EosSignTx, keychain):
|
||||
node.private_key(), digest, True, secp256k1.CANONICAL_SIG_EOS
|
||||
)
|
||||
|
||||
return EosSignedTx(signature=base58_encode("SIG", "K1", signature))
|
||||
return EosSignedTx(signature=base58_encode("SIG_", "K1", signature))
|
||||
|
||||
|
||||
async def _init(ctx, sha, msg):
|
||||
|
@ -27,10 +27,10 @@ class TestEosGetPublicKey(unittest.TestCase):
|
||||
]
|
||||
|
||||
wif_keys = [
|
||||
'PUB_K1_6zpSNY1YoLxNt2VsvJjoDfBueU6xC1M1ERJw1UoekL1NK2aD4t',
|
||||
'PUB_K1_62cPUiWnLqbUjiBMxbEU4pm4Hp5X3RGk4KMTadvZNygjZg9L9x',
|
||||
'PUB_K1_5dp8aCFoFwrKo6KuUfos1hwMfZGkiZUbaF2CyuD4chyBEdV3mU',
|
||||
'PUB_K1_7n7TXwR4Y3DtPt2ji6akhQi5uw4SruuPArvoNJso84vhxKpEz3',
|
||||
'EOS6zpSNY1YoLxNt2VsvJjoDfBueU6xC1M1ERJw1UoekL1NHn8KNA',
|
||||
'EOS62cPUiWnLqbUjiBMxbEU4pm4Hp5X3RGk4KMTadvZNygjX72yHW',
|
||||
'EOS5dp8aCFoFwrKo6KuUfos1hwMfZGkiZUbaF2CyuD4chyBEN2wQK',
|
||||
'EOS7n7TXwR4Y3DtPt2ji6akhQi5uw4SruuPArvoNJso84vhwPQt1G',
|
||||
]
|
||||
|
||||
for index, path in enumerate(derivation_paths):
|
||||
|
@ -14,7 +14,7 @@ class TestMsgEosGetpublickey(TrezorTest):
|
||||
public_key = get_public_key(self.client, parse_path("m/44'/194'/0'/0/0"))
|
||||
assert (
|
||||
public_key.wif_public_key
|
||||
== "PUB_K1_4u6Sfnzj4Sh2pEQnkXyZQJqH3PkKjGByDCbsqqmyq6PtxkQ9TE"
|
||||
== "EOS4u6Sfnzj4Sh2pEQnkXyZQJqH3PkKjGByDCbsqqmyq6PttM9KyB"
|
||||
)
|
||||
assert (
|
||||
public_key.raw_public_key.hex()
|
||||
@ -23,7 +23,7 @@ class TestMsgEosGetpublickey(TrezorTest):
|
||||
public_key = get_public_key(self.client, parse_path("m/44'/194'/0'/0/1"))
|
||||
assert (
|
||||
public_key.wif_public_key
|
||||
== "PUB_K1_5d1VP15RKxT4dSakWu2TFuEgnmaGC2ckfSvQwND7pZC1uLnJzD"
|
||||
== "EOS5d1VP15RKxT4dSakWu2TFuEgnmaGC2ckfSvQwND7pZC1tXkfLP"
|
||||
)
|
||||
assert (
|
||||
public_key.raw_public_key.hex()
|
||||
@ -32,7 +32,7 @@ class TestMsgEosGetpublickey(TrezorTest):
|
||||
public_key = get_public_key(self.client, parse_path("m/44'/194'/1'/0/0"))
|
||||
assert (
|
||||
public_key.wif_public_key
|
||||
== "PUB_K1_7UuNeTf13nfcG85rDB7AHGugZi4C4wJ4ft12QRotqNfxeNPmwo"
|
||||
== "EOS7UuNeTf13nfcG85rDB7AHGugZi4C4wJ4ft12QRotqNfxdV2NvP"
|
||||
)
|
||||
assert (
|
||||
public_key.raw_public_key.hex()
|
||||
|
Loading…
Reference in New Issue
Block a user