Documentation ¶
Index ¶
- func DeleteAllMessages(server Server) error
- func PullOldestMessage(server Server, channel *Channel) ([]byte, error)
- func PushMessage(server Server, channel *Channel, data interface{}) error
- type Channel
- func (channel *Channel) RemoveConfigFile(configDir string) error
- func (channel *Channel) SendClear() error
- func (channel *Channel) SendHashPubKey(verifyPass interface{}) error
- func (channel *Channel) SendPairingTest(tfaTestString string) error
- func (channel *Channel) SendPing() error
- func (channel *Channel) SendPubKey(verifyPass interface{}) error
- func (channel *Channel) SendRandomNumberEcho(randomNumberEcho string) error
- func (channel *Channel) SendSigningEcho(signingEcho string, coin string, scriptType string, transaction string) error
- func (channel *Channel) SendXpubEcho(xpubEcho string, typ string) error
- func (channel *Channel) StoreToConfigFile(configDir string) error
- func (channel *Channel) WaitForCommand(duration time.Duration) (string, error)
- func (channel *Channel) WaitForMobilePublicKey(duration time.Duration) (string, error)
- func (channel *Channel) WaitForMobilePublicKeyHash(duration time.Duration) (string, error)
- func (channel *Channel) WaitForPong(duration time.Duration) error
- func (channel *Channel) WaitForRandomNumberClear(duration time.Duration) error
- func (channel *Channel) WaitForScanningSuccess(duration time.Duration) error
- func (channel *Channel) WaitForSigningPin(duration time.Duration) (string, error)
- type Command
- type Party
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteAllMessages ¶
DeleteAllMessages deletes all messages in all channels which expired on the given server.
func PullOldestMessage ¶
PullOldestMessage pulls the oldest message on the given channel from the given server. If no message is available for ten seconds, then this function returns nil.
func PushMessage ¶
PushMessage pushes the encryption of the given data as JSON to the given server.
Types ¶
type Channel ¶
type Channel struct { // ChannelID is the identifier which uniquely identifies the channel between the parties. ChannelID string `json:"id"` // EncryptionKey is used to encrypt the communication between the desktop and the mobile. EncryptionKey []byte `json:"key"` // AuthenticationKey is used to authenticate messages between the desktop and the mobile. AuthenticationKey []byte `json:"mac"` // contains filtered or unexported fields }
Channel implements an encrypted communication channel between the desktop and the paired mobile.
func NewChannel ¶
NewChannel returns a new channel with the given channel ID, encryption and authentication key.
func NewChannelFromConfigFile ¶
NewChannelFromConfigFile returns a new channel with the channel identifier and encryption key from the config file or nil if the config file does not exist.
func NewChannelWithRandomKey ¶
func NewChannelWithRandomKey() *Channel
NewChannelWithRandomKey returns a new channel with a random encryption key and identifier.
func (*Channel) RemoveConfigFile ¶
RemoveConfigFile removes the config file. Callers can use config.AppDir to obtain standard user location config dir.
func (*Channel) SendHashPubKey ¶
SendHashPubKey sends the hash of the public key from the BitBox to the mobile to finish pairing.
func (*Channel) SendPairingTest ¶
SendPairingTest sends the encrypted test string from the BitBox to the paired mobile.
func (*Channel) SendPing ¶
SendPing sends a 'ping' to the paired mobile to which it automatically responds with 'pong'.
func (*Channel) SendPubKey ¶
SendPubKey sends the ECDH public key from the BitBox to the paired mobile to finish pairing.
func (*Channel) SendRandomNumberEcho ¶
SendRandomNumberEcho sends the encrypted random number echo from the BitBox to the paired mobile.
func (*Channel) SendSigningEcho ¶
func (channel *Channel) SendSigningEcho( signingEcho string, coin string, scriptType string, transaction string, ) error
SendSigningEcho sends the encrypted signing echo from the BitBox to the paired mobile.
func (*Channel) SendXpubEcho ¶
SendXpubEcho sends the encrypted xpub echo from the BitBox to the paired mobile.
func (*Channel) StoreToConfigFile ¶
StoreToConfigFile stores the channel to the config file located in the provided configDir. Callers can use config.AppDir to obtain standard user location config dir.
func (*Channel) WaitForCommand ¶
WaitForCommand waits for the given duration for an ECDH command from mobile. Returns the command or an error if no command has been received in the given duration.
func (*Channel) WaitForMobilePublicKey ¶
WaitForMobilePublicKey waits for the given duration for the ECDH public key from the mobile. Returns an error if no ECDH public key has been received from the server in the given duration.
func (*Channel) WaitForMobilePublicKeyHash ¶
WaitForMobilePublicKeyHash waits for the given duration for the public key hash from the mobile. Returns an error if no public key hash has been received from the server in the given duration.
func (*Channel) WaitForPong ¶
WaitForPong waits for the given duration for the 'pong' from the mobile after sending 'ping'. Returns nil if the pong was retrieved from the relay server and an error otherwise.
func (*Channel) WaitForRandomNumberClear ¶
WaitForRandomNumberClear waits for the given duration for a random number clear from the mobile. Returns nil if a random number clear was retrieved from the relay server and an error otherwise.
func (*Channel) WaitForScanningSuccess ¶
WaitForScanningSuccess waits for the given duration for the scanning success from the mobile. Returns nil if the scanning success was retrieved from the relay server and an error otherwise.
func (*Channel) WaitForSigningPin ¶
WaitForSigningPin waits for the given duration for the 2FA signing PIN from the mobile. Returns an error if no 2FA signing PIN was available on the relay server in the given duration. Otherwise, the returned value is either the PIN (on confirmation) or "abort" (on cancel).
type Command ¶
type Command string
Command enumerates the commands that can be sent to the relay server.
const ( // PushMessageCommand pushes a message for the other communication party on the given channel. PushMessageCommand Command = "data" // PullOldestMessageCommand pulls the oldest message on the specified channel for the specified // communication party. If there are several messages, only the oldest message is returned. // The relay server waits up to 10 seconds before returning no message at all. PullOldestMessageCommand Command = "gd" // DeleteAllMessagesCommand deletes all messages in all channels which expired. // In the default script, messages expire 40 seconds after their creation. DeleteAllMessagesCommand Command = "dd" )