2016-11-06 16:04:25 +00:00
|
|
|
import sys
|
2018-02-26 23:29:00 +00:00
|
|
|
|
2020-01-30 14:57:19 +00:00
|
|
|
sys.path.append("../src")
|
2016-11-06 16:04:25 +00:00
|
|
|
|
2018-02-27 02:05:15 +00:00
|
|
|
from ubinascii import hexlify, unhexlify # noqa: F401
|
2017-08-14 09:09:47 +00:00
|
|
|
|
2018-02-27 02:05:15 +00:00
|
|
|
import unittest # noqa: F401
|
2019-08-26 16:47:49 +00:00
|
|
|
|
|
|
|
from trezor import utils # noqa: F401
|
2021-03-23 12:29:25 +00:00
|
|
|
from apps.common.paths import HARDENED
|
2020-08-03 15:28:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
def H_(x: int) -> int:
|
|
|
|
return x | HARDENED
|
2020-01-30 14:57:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
def await_result(task: Awaitable) -> Any:
|
|
|
|
value = None
|
|
|
|
while True:
|
|
|
|
try:
|
|
|
|
result = task.send(value)
|
|
|
|
except StopIteration as e:
|
|
|
|
return e.value
|
|
|
|
|
|
|
|
if result:
|
|
|
|
value = await_result(result)
|
|
|
|
else:
|
|
|
|
value = None
|