def main(): args = parse_args(Commands) if args.cmd == 'list': from bitkeylib.transport_hid import HidTransport devices = HidTransport.enumerate() if args.json: print json.dumps(devices) else: for dev in devices: print dev return transport = get_transport(args.transport, args.path) if args.debug: debuglink_transport = get_transport(args.debuglink_transport, args.debuglink_path) debuglink = DebugLink(debuglink_transport) else: debuglink = None client = BitkeyClient(transport, debuglink=debuglink) client.setup_debuglink(button=True, otp_correct=True, pin_correct=True) cmds = Commands(client) res = args.func(cmds, args) if args.json: print json.dumps(res) else: print res
class BitkeyTest(unittest.TestCase): def setUp(self): self.debug_transport = config.DEBUG_TRANSPORT(*config.DEBUG_TRANSPORT_ARGS) self.transport = config.TRANSPORT(*config.TRANSPORT_ARGS) self.bitkey = BitkeyClient(self.transport, DebugLink(self.debug_transport), algo=proto.ELECTRUM, debug=True) self.bitkey.setup_debuglink(button=True, pin_correct=True, otp_correct=True) self.bitkey.load_device(seed='beyond neighbor scratch swirl embarrass doll cause also stick softly physical nice', otp=True, pin='1234', spv=True) print "Setup finished" print "--------------" def tearDown(self): self.bitkey.init_device() self.debug_transport.close() self.transport.close()