crypto

package
v0.20.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPrivKeyLedgerSecp256k1

func NewPrivKeyLedgerSecp256k1(path DerivationPath) (tcrypto.PrivKey, error)

NewPrivKeyLedgerSecp256k1 will generate a new key and store the public key for later use.

func RegisterAmino

func RegisterAmino(cdc *amino.Codec)

RegisterAmino registers all go-crypto related types in the given (amino) codec.

Types

type DerivationPath

type DerivationPath = []uint32

Ledger derivation path

type PrivKeyLedgerSecp256k1

type PrivKeyLedgerSecp256k1 struct {
	// PubKey should be private, but we want to encode it via go-amino
	// so we can view the address later, even without having the ledger
	// attached
	CachedPubKey tcrypto.PubKey
	Path         DerivationPath
}

PrivKeyLedgerSecp256k1 implements PrivKey, calling the ledger nano we cache the PubKey from the first call to use it later

func (*PrivKeyLedgerSecp256k1) AssertIsPrivKeyInner

func (pk *PrivKeyLedgerSecp256k1) AssertIsPrivKeyInner()

AssertIsPrivKeyInner fulfils PrivKey Interface

func (PrivKeyLedgerSecp256k1) Bytes

func (pk PrivKeyLedgerSecp256k1) Bytes() []byte

Bytes fulfils PrivKey Interface - but it stores the cached pubkey so we can verify the same key when we reconnect to a ledger

func (PrivKeyLedgerSecp256k1) Equals

func (pk PrivKeyLedgerSecp256k1) Equals(other tcrypto.PrivKey) bool

Equals fulfils PrivKey Interface - makes sure both keys refer to the same

func (PrivKeyLedgerSecp256k1) PubKey

PubKey returns the stored PubKey

func (PrivKeyLedgerSecp256k1) Sign

Sign calls the ledger and stores the PubKey for future use

Communication is checked on NewPrivKeyLedger and PrivKeyFromBytes, returning an error, so this should only trigger if the privkey is held in memory for a while before use.

func (PrivKeyLedgerSecp256k1) ValidateKey

func (pk PrivKeyLedgerSecp256k1) ValidateKey() error

ValidateKey allows us to verify the sanity of a key after loading it from disk

Directories

Path Synopsis
hd
Package hd provides basic functionality Hierarchical Deterministic Wallets.
Package hd provides basic functionality Hierarchical Deterministic Wallets.

Jump to

Keyboard shortcuts

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