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, wordAckprotected final ExecutorService serverMonitorService
public KeepKeyRelayClient(String relayServerLocation, int relayServerPort)
relayServerLocation - The location of the RelayServerrelayServerPort - The port number of the serverpublic String name()
HardwareWalletClientAssist downstream API consumers with identifying the source of events
public boolean attach()
ConnectableHandle 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()
ConnectableHandle 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()
ConnectableHandle device detachment and imminent shutdown.
Recovery is not possible (the controlling thread is about to close, hardware drivers are closing)
public boolean connect()
ConnectableAttempt a connection to the underlying hardware to establish communication only (no higher level messages)
Implementers must ensure the following behaviour:
public void disconnect()
ConnectableBreak 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 AbstractKeepKeyHardwareWalletClientmessage - 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)
AbstractKeepKeyHardwareWalletClientSend a message to the device with an arbitrary response duration.
If the response times out a FAILURE message should be generated.
sendMessage in class AbstractKeepKeyHardwareWalletClientmessage - The message to send to the hardware walletduration - The duration to wait before returningtimeUnit - The time unitpublic boolean verifyFeatures(Features features)
HardwareWalletClientVerify the contents of the Features message in accordance with client-specific rules (e.g. firmware)
features - The Features from the deviceCopyright © 2013–2016 Bitcoin Solutions Ltd. All rights reserved.