コード例 #1
0
        protected override async Task <TrezorManager> ConnectAsync()
        {
            var _UsbContext = new UsbContext();

            var trezorUsbDevice = _UsbContext.List().FirstOrDefault
                                  (
                d =>
                //Trezor One - 1.6.x
                (d.ProductId == 0x1 && d.VendorId == 0x534C) ||
                //Trezor One - 1.7.x
                (d.ProductId == 0x53C1 && d.VendorId == 0x1209) ||
                //Trezor Model T ?
                (d.ProductId == 0x53C0 && d.VendorId == 0x1209)
                                  );

            var _LibUsbDevice = new LibUsbDevice(trezorUsbDevice, 60000);
            await _LibUsbDevice.InitializeAsync();

            Console.WriteLine("Connected");

            var trezorManager = new TrezorManager(GetPin, GetPassphrase, _LibUsbDevice);
            await trezorManager.InitializeAsync();

            return(trezorManager);
        }
コード例 #2
0
        protected override async Task <IDevice> Connect()
        {
            _UsbContext = new UsbContext();

            var trezorUsbDevice = _UsbContext.List().FirstOrDefault
                                  (
                d =>
                //Trezor One - 1.6.x
                (d.ProductId == 0x1 && d.VendorId == 0x534C) ||
                //Trezor One - 1.7.x
                (d.ProductId == 0x53C1 && d.VendorId == 0x1209) ||
                //Trezor Model T ?
                (d.ProductId == 0x53C0 && d.VendorId == 0x1209)
                                  );

            _LibUsbDevice = new LibUsbDevice(trezorUsbDevice, 60000);
            await _LibUsbDevice.InitializeAsync();

            Console.WriteLine("Connected");

            return(_LibUsbDevice);
        }