1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 04:18:10 +00:00

stellar: get public key simplified

This commit is contained in:
Tomas Susanka 2018-08-21 11:16:44 +02:00
parent a5a7b9a1af
commit cb105c015f

View File

@ -1,14 +1,8 @@
from ubinascii import hexlify
from trezor import ui
from trezor.messages import ButtonRequestType
from trezor.messages.StellarGetPublicKey import StellarGetPublicKey
from trezor.messages.StellarPublicKey import StellarPublicKey
from trezor.ui.text import Text
from apps.common import seed
from apps.common.confirm import confirm
from apps.common.show import split_address
from apps.common.show import show_pubkey
from apps.stellar import helpers
@ -17,18 +11,6 @@ async def get_public_key(ctx, msg: StellarGetPublicKey):
pubkey = seed.remove_ed25519_prefix(node.public_key())
if msg.show_display:
while True:
if await _show(ctx, pubkey):
break
await show_pubkey(ctx, pubkey)
return StellarPublicKey(public_key=pubkey)
async def _show(ctx, pubkey: bytes):
lines = split_address(hexlify(pubkey))
text = Text("Export Stellar ID", ui.ICON_RECEIVE, icon_color=ui.GREEN)
text.mono(*lines)
return await confirm(
ctx, text, code=ButtonRequestType.Address, cancel_style=ui.BTN_KEY
)