public class KeepKeyRelayClient extends AbstractKeepKeyHardwareWalletClient
Client to provide the following to applications:
Modifier and Type | Field and Description |
---|---|
protected ExecutorService |
serverMonitorService |
Constructor and Description |
---|
KeepKeyRelayClient(String relayServerLocation,
int relayServerPort) |
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
|
com.google.common.base.Optional<MessageEvent> |
sendMessage(com.google.protobuf.Message message)
Send a message to an output stream
|
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
protected final ExecutorService serverMonitorService
public KeepKeyRelayClient(String relayServerLocation, int relayServerPort)
relayServerLocation
- The location of the RelayServerrelayServerPort
- The port number of the serverpublic 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:
public com.google.common.base.Optional<MessageEvent> sendMessage(com.google.protobuf.Message message)
sendMessage
in class AbstractKeepKeyHardwareWalletClient
message
- the message to serialise and send to the OutputStreampublic 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–2017 Bitcoin Solutions Ltd. All rights reserved.