1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-18 05:28:40 +00:00

core/eos: revert new pubkey format

(cherry picked from commit 07ce935725)
This commit is contained in:
Pavol Rusnak 2019-05-26 11:44:17 +02:00
parent 9586358e44
commit 21934c36fa
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
5 changed files with 11 additions and 11 deletions

View File

@ -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):

View File

@ -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:

View File

@ -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):

View File

@ -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):

View File

@ -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()