2018-02-09 17:59:26 +00:00
|
|
|
_seed, _state = None, None
|
2017-05-08 20:31:21 +00:00
|
|
|
|
|
|
|
|
2018-02-09 17:07:47 +00:00
|
|
|
def get_state():
|
2018-02-09 17:59:26 +00:00
|
|
|
global _state
|
|
|
|
return _state
|
|
|
|
|
|
|
|
|
|
|
|
def get_seed():
|
|
|
|
global _seed
|
|
|
|
return _seed
|
|
|
|
|
|
|
|
|
|
|
|
def set_seed(seed):
|
|
|
|
from trezor.crypto import bip32
|
|
|
|
from trezor.crypto.hashlib import blake2s
|
|
|
|
node = bip32.from_seed(seed, 'secp256k1')
|
|
|
|
state = blake2s(node.public_key()).digest()
|
|
|
|
global _seed, _state
|
|
|
|
_seed, _state = seed, state
|
2018-02-09 17:07:47 +00:00
|
|
|
|
|
|
|
|
2017-05-08 20:31:21 +00:00
|
|
|
def clear():
|
2018-02-09 17:59:26 +00:00
|
|
|
global _seed, _state
|
2018-02-10 16:45:25 +00:00
|
|
|
_seed, _state = None, None
|