public class KeepKeyHardwareWalletClient extends AbstractKeepKeyHardwareWalletClient
Client to provide the following to applications:
This is intended as a high level API to the KeepKey device. Developers who need more control over the
responses and events are advised to study the Examples project and use the KeepKeyHardwareWallet
implementations.
Constructor and Description |
---|
KeepKeyHardwareWalletClient(AbstractKeepKeyHardwareWallet keepKey) |
Modifier and Type | Method and Description |
---|---|
boolean |
attach()
Handle device attachment.
|
boolean |
connect()
Attempt a connection to the underlying hardware to establish communication only (no higher level messages)
|
void |
disconnect()
Break the connection to the device
|
void |
hardDetach()
Handle device detachment and imminent shutdown.
|
String |
name()
Assist downstream API consumers with identifying the source of events
|
protected com.google.common.base.Optional<MessageEvent> |
sendMessage(com.google.protobuf.Message message)
Send a message to the device that should have a near-immediate (under 5 second) response.
|
protected com.google.common.base.Optional<MessageEvent> |
sendMessage(com.google.protobuf.Message message,
int duration,
TimeUnit timeUnit)
Send a message to the device with an arbitrary response duration.
|
void |
softDetach()
Handle device detachment.
|
boolean |
verifyFeatures(Features features)
Verify the contents of the Features message in accordance with client-specific rules (e.g.
|
applySettings, buttonAck, cancel, changePIN, cipherKeyValue, clearSession, decryptMessage, encryptMessage, entropyAck, estimateTxSize, firmwareErase, firmwareUpload, getAddress, getDeterministicHierarchy, getEntropy, getPublicKey, initialise, loadDevice, passphraseAck, ping, pinMatrixAck, recoverDevice, resetDevice, signMessage, signTx, simpleSignTx, txAck, verifyMessage, wipeDevice, wordAck
public KeepKeyHardwareWalletClient(AbstractKeepKeyHardwareWallet keepKey)
keepKey
- The KeepKey hardware walletpublic String name()
HardwareWalletClient
Assist downstream API consumers with identifying the source of events
public boolean attach()
Connectable
Handle device attachment. The transport to the device is new formed (device attached, socket server started etc)
Implementations should verify the supporting environment before attempting a connection. Typically this would involve initialising native libraries and verifying their communications
public void softDetach()
Connectable
Handle device detachment. The transport to the device is gone (device removed, socket server shut down etc)
Implementations may assume that recovery is possible (the hardware drivers still remain operational)
public void hardDetach()
Connectable
Handle device detachment and imminent shutdown.
Recovery is not possible (the controlling thread is about to close, hardware drivers are closing)
public boolean connect()
Connectable
Attempt a connection to the underlying hardware to establish communication only (no higher level messages)
Implementers must ensure the following behaviour:
public void disconnect()
Connectable
Break the connection to the device
Implementers must ensure the following behaviour:
protected com.google.common.base.Optional<MessageEvent> sendMessage(com.google.protobuf.Message message)
AbstractKeepKeyHardwareWalletClient
Send a message to the device that should have a near-immediate (under 5 second) response.
If the response times out a FAILURE message should be generated.
sendMessage
in class AbstractKeepKeyHardwareWalletClient
message
- The message to send to the hardware walletprotected com.google.common.base.Optional<MessageEvent> sendMessage(com.google.protobuf.Message message, int duration, TimeUnit timeUnit)
AbstractKeepKeyHardwareWalletClient
Send a message to the device with an arbitrary response duration.
If the response times out a FAILURE message should be generated.
sendMessage
in class AbstractKeepKeyHardwareWalletClient
message
- The message to send to the hardware walletduration
- The duration to wait before returningtimeUnit
- The time unitpublic boolean verifyFeatures(Features features)
HardwareWalletClient
Verify the contents of the Features message in accordance with client-specific rules (e.g. firmware)
features
- The Features from the deviceCopyright © 2013–2018 Bitcoin Solutions Ltd. All rights reserved.