コード例 #1
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();

            if (_IsDisplayed)
            {
                return;
            }
            _IsDisplayed = true;

            //TODO: Put a passphrase page in place
            KeepKeyManagerBroker = new KeepKeyManagerBroker(KeepKeyPinPad.GetPin, () => { return(Task.FromResult("a")); }, 2000);
            var keepKeyManager = await KeepKeyManagerBroker.WaitForFirstTrezorAsync();

            var coinTable = await keepKeyManager.GetCoinTable();

            keepKeyManager.CoinUtility = new KeepKeyCoinUtility(coinTable);

            Xamarin.Forms.Device.BeginInvokeOnMainThread(async() =>
            {
                var address   = await keepKeyManager.GetAddressAsync(new BIP44AddressPath(false, 0, 0, false, 0), false, true);
                TheLabel.Text = $"First Bitcoin Address: {address}";
                TheActivityIndicator.IsRunning = false;
            });
        }
コード例 #2
0
        private static async Task <KeepKeyManager> ConnectAsync()
        {
            //This only needs to be done once.
            //Register the factory for creating Usb devices. Trezor One Firmware 1.7.x / Trezor Model T
            WindowsUsbDeviceFactory.Register();

            //Register the factory for creating Hid devices. Trezor One Firmware 1.6.x
            WindowsHidDeviceFactory.Register();

            var keepKeyManagerBroker = new KeepKeyManagerBroker(GetPin, GetPassphrase, 2000);
            var keepKeyManager       = await keepKeyManagerBroker.WaitForFirstTrezorAsync();

            var coinTable = await keepKeyManager.GetCoinTable();

            keepKeyManager.CoinUtility = new KeepKeyCoinUtility(coinTable);
            return(keepKeyManager);
        }