mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-23 13:51:00 +00:00
load_device moved to debuglink
This commit is contained in:
parent
235aaf7768
commit
43c2d9b042
@ -235,11 +235,16 @@ class BitkeyClient(object):
|
||||
'''
|
||||
|
||||
def reset_device(self):
|
||||
# Begin with device reset workflow
|
||||
resp = self.call(proto.ResetDevice(random=self._get_local_entropy()))
|
||||
self.init_device()
|
||||
return isinstance(resp, proto.Success)
|
||||
|
||||
def load_device(self, seed, otp, pin, spv):
|
||||
resp = self.call(proto.LoadDevice(seed=seed, otp=otp, pin=pin, spv=spv))
|
||||
if not self.debuglink:
|
||||
raise Exception("DebugLink not available")
|
||||
|
||||
if not self.debuglink.load_device(seed, otp, pin, spv):
|
||||
return False
|
||||
self.init_device()
|
||||
return isinstance(resp, proto.Success)
|
||||
return True
|
@ -21,7 +21,12 @@ class DebugLink(object):
|
||||
def get_state(self, otp=False, pin=False):
|
||||
self.transport.write(proto.DebugLinkGetState(otp=otp, pin=pin))
|
||||
return self.transport.read_blocking()
|
||||
|
||||
|
||||
def load_device(self, seed, otp, pin, spv):
|
||||
self.transport.write(proto.LoadDevice(seed=seed, otp=otp, pin=pin, spv=spv))
|
||||
resp = self.transport.read_blocking()
|
||||
return isinstance(resp, proto.Success)
|
||||
|
||||
def read_otp(self):
|
||||
obj = self.get_state(otp=True).otp
|
||||
print "Read OTP:", obj.otp
|
||||
|
Loading…
Reference in New Issue
Block a user