Configure and start the hardware wallet service as follows:
// Use factory to statically bind the specific hardware wallet
TrezorV1HidHardwareWallet wallet = HardwareWallets.newUsbInstance(
TrezorV1HidHardwareWallet.class,
Optional.<Integer>absent(),
Optional.<Integer>absent(),
Optional.<String>absent()
);
// Wrap the hardware wallet in a suitable client to simplify message API
HardwareWalletClient client = new TrezorHardwareWalletClient(wallet);
// Wrap the client in a service for high level API suitable for downstream applications
hardwareWalletService = new HardwareWalletService(client);
// Register for the high level hardware wallet events
HardwareWalletEvents.subscribe(this);
// Start the service
hardwareWalletService.start();
Subscribe to Guava events coming from the Trezor client as follows:
@Subscribe
public void onHardwareWalletEvent(HardwareWalletEvent event) {
switch (event.getEventType()) {
case SHOW_DEVICE_DETACHED:
// Wait for device to be connected
break;
case SHOW_DEVICE_READY:
// Get some information about the device
Features features = hardwareWalletService.getContext().getFeatures().get();
log.info("Features: {}", features);
// Treat as end of example
System.exit(0);
break;
case SHOW_DEVICE_FAILED:
// Treat as end of example
System.exit(-1);
break;
}
}
%%{ init: { 'flowchart': { 'curve': 'bumpX' } } }%%
graph LR;
linkStyle default opacity:0.5
address_book_controller(["@trezor/address-book-controller"]);
announcement_controller(["@trezor/announcement-controller"]);
approval_controller(["@trezor/approval-controller"]);
assets_controllers(["@trezor/assets-controllers"]);
base_controller(["@trezor/base-controller"]);
composable_controller(["@trezor/composable-controller"]);
controller_utils(["@trezor/controller-utils"]);
ens_controller(["@trezor/ens-controller"]);
gas_fee_controller(["@trezor/gas-fee-controller"]);
keyring_controller(["@trezor/keyring-controller"]);
logging_controller(["@trezor/logging-controller"]);
message_manager(["@trezor/message-manager"]);
name_controller(["@trezor/name-controller"]);
network_controller(["@trezor/network-controller"]);
notification_controller(["@trezor/notification-controller"]);
permission_controller(["@trezor/permission-controller"]);
phishing_controller(["@trezor/phishing-controller"]);
preferences_controller(["@trezor/preferences-controller"]);
rate_limit_controller(["@trezor/rate-limit-controller"]);
signature_controller(["@trezor/signature-controller"]);
transaction_controller(["@trezor/transaction-controller"]);
address_book_controller --> base_controller;
address_book_controller --> controller_utils;
announcement_controller --> base_controller;
approval_controller --> base_controller;
assets_controllers --> approval_controller;
assets_controllers --> base_controller;
assets_controllers --> controller_utils;
assets_controllers --> network_controller;
assets_controllers --> preferences_controller;
composable_controller --> base_controller;
ens_controller --> base_controller;
ens_controller --> controller_utils;
ens_controller --> network_controller;
gas_fee_controller --> base_controller;
gas_fee_controller --> controller_utils;
gas_fee_controller --> network_controller;
keyring_controller --> base_controller;
keyring_controller --> message_manager;
keyring_controller --> preferences_controller;
logging_controller --> base_controller;
logging_controller --> controller_utils;
message_manager --> base_controller;
message_manager --> controller_utils;
name_controller --> base_controller;
network_controller --> base_controller;
network_controller --> controller_utils;
notification_controller --> base_controller;
permission_controller --> approval_controller;
permission_controller --> base_controller;
permission_controller --> controller_utils;
phishing_controller --> base_controller;
phishing_controller --> controller_utils;
preferences_controller --> base_controller;
preferences_controller --> controller_utils;
rate_limit_controller --> base_controller;
signature_controller --> approval_controller;
signature_controller --> base_controller;
signature_controller --> controller_utils;
signature_controller --> message_manager;
transaction_controller --> approval_controller;
transaction_controller --> base_controller;
transaction_controller --> controller_utils;
transaction_controller --> network_controller;
Set these environment variables on your gpg-agent
daemon, by overriding /usr/lib/systemd/user/gpg-agent.service
for example.
-
PINENTRY_TREZOR_LOG_PATH =
/path/to/log/file
. Enable logging and write logs to/path/to/log/file
-
PINENTRY_TREZOR_DONT_FLASH =
1
. Don't show which keypad button was pressed when using the keyboard. -
PINENTRY_TREZOR_KEYSET =
123456789
. Use this letter grid for keyboard entry. -
PINENTRY_TREZOR_DONT_EXPLAIN =
1
. Don't explain or show the grid when entering via TTY. -
PINENTRY_TREZOR_FORCE_MESSAGE =
My prompt message:
. Use this prompt message instead of the GPG provided prompt.
Contributions are welcome, but please follow these contributor guidelines outlined in CONTRIBUTING.md.
metamask is licensed under a BSD 2-Clause License and is copyright Intoli, LLC.
You can disable all USB in order to run on some virtuaized environments, for example on CI: