Documentation ¶
Index ¶
- Variables
- type AccountEvent
- type Backend
- func (backend *Backend) Accounts() []accounts.Interface
- func (backend *Backend) AccountsStatus() string
- func (backend *Backend) BitBoxBaseDeregister(bitboxBaseID string)
- func (backend *Backend) BitBoxBasesDetected() map[string]string
- func (backend *Backend) BitBoxBasesRegistered() map[string]bitboxbase.Interface
- func (backend *Backend) CheckElectrumServer(server string, pemCert string) error
- func (backend *Backend) Coin(code string) (coin.Coin, error)
- func (backend *Backend) Config() *config.Config
- func (backend *Backend) CreateAndAddAccount(coin coin.Coin, code string, name string, ...) error
- func (backend *Backend) DefaultAppConfig() config.AppConfig
- func (backend *Backend) Deregister(deviceID string)
- func (backend *Backend) DeregisterKeystore()
- func (backend *Backend) DevicesRegistered() map[string]device.Interface
- func (backend *Backend) DownloadCert(server string) (string, error)
- func (backend *Backend) EmitBitBoxBaseDetected()
- func (backend *Backend) Events() <-chan interface{}
- func (backend *Backend) Keystores() *keystore.Keystores
- func (backend *Backend) NotifyUser(text string)
- func (backend *Backend) OnAccountInit(f func(accounts.Interface))
- func (backend *Backend) OnAccountUninit(f func(accounts.Interface))
- func (backend *Backend) OnBitBoxBaseInit(f func(bitboxbase.Interface))
- func (backend *Backend) OnBitBoxBaseUninit(f func(string))
- func (backend *Backend) OnDeviceInit(f func(device.Interface))
- func (backend *Backend) OnDeviceUninit(f func(string))
- func (backend *Backend) Rates() map[string]map[string]float64
- func (backend *Backend) Register(theDevice device.Interface) error
- func (backend *Backend) RegisterKeystore(keystore keystore.Keystore)
- func (backend *Backend) RegisterTestKeystore(pin string)
- func (backend *Backend) Start() <-chan interface{}
- func (backend *Backend) SystemOpen(url string) error
- func (backend *Backend) Testing() bool
- func (backend *Backend) TryMakeNewBase(ip string) (bool, error)
- func (backend *Backend) UserLanguage() language.Tag
- type Environment
- type Notifier
- type RatesUpdater
- type UpdateFile
Constants ¶
This section is empty.
Variables ¶
var ErrAccountAlreadyExists = errors.New("already exists")
ErrAccountAlreadyExists is returned if an account is being added which already exists.
var ( // Version of the backend as displayed to the user. Version = semver.NewSemVer(4, 11, 1) )
Functions ¶
This section is empty.
Types ¶
type AccountEvent ¶
type AccountEvent struct { Type string `json:"type"` Code string `json:"code"` Data string `json:"data"` }
AccountEvent models an event triggered by an account.
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend ties everything together and is the main starting point to use the BitBox wallet library.
func NewBackend ¶
func NewBackend(arguments *arguments.Arguments, environment Environment) (*Backend, error)
NewBackend creates a new backend with the given arguments.
func (*Backend) AccountsStatus ¶
AccountsStatus returns whether the accounts have been initialized.
func (*Backend) BitBoxBaseDeregister ¶
BitBoxBaseDeregister deregisters the device with the given ID from this backend.
func (*Backend) BitBoxBasesDetected ¶
BitBoxBasesDetected returns a map of IPs and Hostnames of detected Bases.
func (*Backend) BitBoxBasesRegistered ¶
func (backend *Backend) BitBoxBasesRegistered() map[string]bitboxbase.Interface
BitBoxBasesRegistered returns a map of bitboxBaseIDs and registered bitbox bases.
func (*Backend) CheckElectrumServer ¶
CheckElectrumServer checks if a tls connection can be established with the electrum server, and whether the server is an electrum server.
func (*Backend) Coin ¶
Coin returns the coin with the given code or an error if no such coin exists.
func (*Backend) CreateAndAddAccount ¶
func (backend *Backend) CreateAndAddAccount( coin coin.Coin, code string, name string, getSigningConfiguration func() (*signing.Configuration, error), persist bool, ) error
CreateAndAddAccount creates an account with the given parameters and adds it to the backend. If persist is true, the configuration is fetched and saved in the accounts configuration.
func (*Backend) DefaultAppConfig ¶
DefaultAppConfig returns the default app config.y
func (*Backend) Deregister ¶
Deregister deregisters the device with the given ID from this backend.
func (*Backend) DeregisterKeystore ¶
func (backend *Backend) DeregisterKeystore()
DeregisterKeystore removes the registered keystore.
func (*Backend) DevicesRegistered ¶
DevicesRegistered returns a map of device IDs to device of registered devices.
func (*Backend) DownloadCert ¶
DownloadCert downloads the first element of the remote certificate chain.
func (*Backend) EmitBitBoxBaseDetected ¶
func (backend *Backend) EmitBitBoxBaseDetected()
EmitBitBoxBaseDetected saves the IP and Hostname of detected BitBox Bases at this backend
func (*Backend) Events ¶
func (backend *Backend) Events() <-chan interface{}
Events returns the push notifications channel.
func (*Backend) NotifyUser ¶
NotifyUser creates a desktop notification.
func (*Backend) OnAccountInit ¶
OnAccountInit installs a callback to be called when an account is initialized.
func (*Backend) OnAccountUninit ¶
OnAccountUninit installs a callback to be called when an account is stopped.
func (*Backend) OnBitBoxBaseInit ¶
func (backend *Backend) OnBitBoxBaseInit(f func(bitboxbase.Interface))
OnBitBoxBaseInit installs a callback to be called when a bitboxbase is initialized.
func (*Backend) OnBitBoxBaseUninit ¶
OnBitBoxBaseUninit installs a callback to be called when a bitboxbase is uninitialized.
func (*Backend) OnDeviceInit ¶
OnDeviceInit installs a callback to be called when a device is initialized.
func (*Backend) OnDeviceUninit ¶
OnDeviceUninit installs a callback to be called when a device is uninitialized.
func (*Backend) RegisterKeystore ¶
RegisterKeystore registers the given keystore at this backend.
func (*Backend) RegisterTestKeystore ¶
RegisterTestKeystore adds a keystore derived deterministically from a PIN, for convenience in devmode.
func (*Backend) Start ¶
func (backend *Backend) Start() <-chan interface{}
Start starts the background services. It returns a channel of events to handle by the library client.
func (*Backend) SystemOpen ¶
SystemOpen opens a web url in the default browser, or a file url in the default application. It whitelists url patterns and blocks all invalid ones. Returns an error if the url was blocked or the url could not be opened.
func (*Backend) TryMakeNewBase ¶
TryMakeNewBase calls TryMakeNewBase() in the manager with the given ip
func (*Backend) UserLanguage ¶
UserLanguage returns the language the UI should be presented in to the user.
type Environment ¶
type Environment interface { // NotifyUser notifies the user, via desktop notifcation, mobile notification area, ... NotifyUser(string) // DeviceInfos returns a list of available recognized devices (BitBox01, BitBox02, ...). DeviceInfos() []usb.DeviceInfo // SystemOpen opens a web url in the default browser, or a file url in the default application. SystemOpen(string) error }
Environment represents functionality where the implementation depends on the environment the app runs in, e.g. Qt5/Mobile/webdev.
type Notifier ¶
type Notifier struct {
// contains filtered or unexported fields
}
Notifier implements accounts.Notifier, storing the data of all accounts in a bbolt db.
func NewNotifier ¶
NewNotifier returns a new Notifier.
type RatesUpdater ¶
type RatesUpdater struct { observable.Implementation // contains filtered or unexported fields }
RatesUpdater implements coin.RatesUpdater.
func GetRatesUpdaterInstance ¶
func GetRatesUpdaterInstance() *RatesUpdater
GetRatesUpdaterInstance gets a singleton instance of RatesUpdater.
func NewRatesUpdater ¶
func NewRatesUpdater() *RatesUpdater
NewRatesUpdater returns a new rates updater.
type UpdateFile ¶
type UpdateFile struct { // CurrentVersion stores the current version and is not loaded from the server. CurrentVersion *semver.SemVer `json:"current"` // NewVersion stores the new version and may not be nil. NewVersion *semver.SemVer `json:"version"` // Description gives additional information on the release. Description string `json:"description"` }
UpdateFile is retrieved from the server.
func CheckForUpdate ¶
func CheckForUpdate() (*UpdateFile, error)
CheckForUpdate checks whether a newer version of this application has been released. It returns the retrieved update file if a newer version has been released and nil otherwise.
func CheckForUpdateIgnoringErrors ¶
func CheckForUpdateIgnoringErrors() *UpdateFile
CheckForUpdateIgnoringErrors suppresses any errors that are triggered, for example, when offline.
Directories ¶
Path | Synopsis |
---|---|
mdns
Package mdns manages and/or registers new bitbox bases.
|
Package mdns manages and/or registers new bitbox bases. |
rpcclient
Package rpcclient contains the API to the physical device.
|
Package rpcclient contains the API to the physical device. |
Package bridgecommon provides common util functions to bridge the backend to a native environment.
|
Package bridgecommon provides common util functions to bridge the backend to a native environment. |
coins
|
|
btc/electrum/client
Package client implements an Electrum JSON RPC client.
|
Package client implements an Electrum JSON RPC client. |
btc/maketx
Package maketx provides transaction creation code for wallets.
|
Package maketx provides transaction creation code for wallets. |
devices
|
|
bitbox
Package bitbox contains the API to the physical device.
|
Package bitbox contains the API to the physical device. |
bitbox02
Package bitbox02 contains the API to the physical device.
|
Package bitbox02 contains the API to the physical device. |
bitbox02/messages
Package messages is a generated protocol buffer package.
|
Package messages is a generated protocol buffer package. |
bitbox02bootloader
Package bitbox02bootloader contains the API to the physical device.
|
Package bitbox02bootloader contains the API to the physical device. |