|
|
|
@ -5,7 +5,7 @@ from trezor.messages.EosPublicKey import EosPublicKey
|
|
|
|
|
|
|
|
|
|
from apps.common import paths
|
|
|
|
|
from apps.eos import CURVE
|
|
|
|
|
from apps.eos.helpers import base58_encode, validate_full_path
|
|
|
|
|
from apps.eos.helpers import public_key_to_wif, validate_full_path
|
|
|
|
|
from apps.eos.layout import require_get_public_key
|
|
|
|
|
|
|
|
|
|
if False:
|
|
|
|
@ -14,17 +14,6 @@ if False:
|
|
|
|
|
from apps.common import seed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def public_key_to_wif(pub_key: bytes) -> str:
|
|
|
|
|
if pub_key[0] == 0x04 and len(pub_key) == 65:
|
|
|
|
|
head = b"\x03" if pub_key[64] & 0x01 else b"\x02"
|
|
|
|
|
compressed_pub_key = head + pub_key[1:33]
|
|
|
|
|
elif pub_key[0] in [0x02, 0x03] and len(pub_key) == 33:
|
|
|
|
|
compressed_pub_key = pub_key
|
|
|
|
|
else:
|
|
|
|
|
raise wire.DataError("invalid public key")
|
|
|
|
|
return base58_encode("EOS", "", compressed_pub_key)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _get_public_key(node: bip32.HDNode) -> Tuple[str, bytes]:
|
|
|
|
|
seckey = node.private_key()
|
|
|
|
|
public_key = secp256k1.publickey(seckey, True)
|
|
|
|
|