keystore

package
v4.14.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2019 License: Apache-2.0 Imports: 5 Imported by: 30

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSigningAborted = errors.New("signing aborted by user")

ErrSigningAborted is used when the user aborts a signing in process (e.g. abort on HW wallet).

Functions

This section is empty.

Types

type Keystore

type Keystore interface {
	// CosignerIndex returns the index at which the keystore signs in a multisig configuration.
	// The returned value is always zero for a singlesig configuration.
	CosignerIndex() int

	// SupportsAccount returns true if they keystore supports the given coin/account.
	// meta is a coin-specific metadata related to the account type.
	SupportsAccount(coin coin.Coin, multisig bool, meta interface{}) bool

	// CanVerifyAddress returns whether the keystore supports to output an address securely.
	// This is typically done through a screen on the device or through a paired mobile phone.
	// optional is true if the user can skip verification, and false if they should be incentivized
	// or forced to verify.
	// The passed configuration is the account-level configuration.
	CanVerifyAddress(*signing.Configuration, coin.Coin) (secureOutput bool, optional bool, err error)

	// VerifyAddress outputs the public key at the given configuration for the given coin.
	// Please note that this is only supported if the keystore has a secure output channel.
	VerifyAddress(*signing.Configuration, coin.Coin) error

	// CanVerifyExtendedPublicKey returns whether the keystore supports to output an xpub/zpub/tbup/ypub securely.
	CanVerifyExtendedPublicKey() bool

	// VerifyExtendedPublicKey displays the public key on the device for verification
	VerifyExtendedPublicKey(coin.Coin, signing.AbsoluteKeypath, *signing.Configuration) error

	// ExtendedPublicKey returns the extended public key at the given absolute keypath.
	ExtendedPublicKey(coin.Coin, signing.AbsoluteKeypath) (*hdkeychain.ExtendedKey, error)

	// SignTransaction signs the given transaction proposal. Returns ErrSigningAborted if the user
	// aborts.
	SignTransaction(interface{}) error
}

Keystore supports hardened key derivation according to BIP32 and signing of transactions.

type Keystores

type Keystores struct {
	// contains filtered or unexported fields
}

Keystores models a collection of keystores that can be passed to accounts to perform signing operations.

func NewKeystores

func NewKeystores(keystores ...Keystore) *Keystores

NewKeystores returns a collection of the given keystores.

func (*Keystores) Add

func (keystores *Keystores) Add(keystore Keystore) error

Add adds the given keystore to the collection of keystores.

func (*Keystores) CanVerifyAddresses

func (keystores *Keystores) CanVerifyAddresses(
	configuration *signing.Configuration, coin coin.Coin) (bool, bool, error)

CanVerifyAddresses returns whether any of the keystores can verify an address.

func (*Keystores) CanVerifyExtendedPublicKeys

func (keystores *Keystores) CanVerifyExtendedPublicKeys() []int

CanVerifyExtendedPublicKeys returns the indices of the keystores that support secure verification

func (*Keystores) Configuration

func (keystores *Keystores) Configuration(
	coin coinpkg.Coin,
	scriptType signing.ScriptType,
	absoluteKeypath signing.AbsoluteKeypath,
	signingThreshold int,
) (*signing.Configuration, error)

Configuration returns the configuration at the given path with the given signing threshold.

func (*Keystores) Count

func (keystores *Keystores) Count() int

Count returns the number of keystores in the collection.

func (*Keystores) Keystores

func (keystores *Keystores) Keystores() []Keystore

Keystores returns all keystores.

func (*Keystores) Remove

func (keystores *Keystores) Remove(keystore Keystore) error

Remove removes the given keystore from the collection of keystores.

func (*Keystores) SignTransaction

func (keystores *Keystores) SignTransaction(proposedTransaction interface{}) error

SignTransaction signs the given proposed transaction on all keystores. Returns ErrSigningAborted if the user aborts.

func (*Keystores) VerifyAddress

func (keystores *Keystores) VerifyAddress(
	configuration *signing.Configuration,
	coin coin.Coin,
) error

VerifyAddress outputs the address for the given coin with the given configuration on all keystores that have a secure output.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL