Esempio n. 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);
        }
Esempio n. 2
0
        public async Task GetAndInitializeAsync()
        {
            if (TrezorManager != null)
            {
                return;
            }

            TrezorManager = await ConnectAsync();
        }
Esempio n. 3
0
        private async Task GetAndInitialize()
        {
            if (TrezorManager != null)
            {
                return;
            }

            var trezorHidDevice = await Connect();

            TrezorManager = new TrezorManager(GetPin, trezorHidDevice, new DefaultCoinUtility());
            await TrezorManager.InitializeAsync();
        }
 public void Teardown()
 {
     TrezorManager?.Dispose();
     TrezorManager = null;
     _UsbContext?.Dispose();
 }