Documentation ¶
Index ¶
- func NewPrivKeyLedgerSecp256k1(path DerivationPath) (tcrypto.PrivKey, error)
- func RegisterAmino(cdc *amino.Codec)
- type DerivationPath
- type PrivKeyLedgerSecp256k1
- func (pk *PrivKeyLedgerSecp256k1) AssertIsPrivKeyInner()
- func (pk PrivKeyLedgerSecp256k1) Bytes() []byte
- func (pk PrivKeyLedgerSecp256k1) Equals(other tcrypto.PrivKey) bool
- func (pk PrivKeyLedgerSecp256k1) PubKey() tcrypto.PubKey
- func (pk PrivKeyLedgerSecp256k1) Sign(msg []byte) (tcrypto.Signature, error)
- func (pk PrivKeyLedgerSecp256k1) ValidateKey() error
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 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 ¶
func (pk PrivKeyLedgerSecp256k1) PubKey() tcrypto.PubKey
PubKey returns the stored PubKey
func (PrivKeyLedgerSecp256k1) Sign ¶
func (pk PrivKeyLedgerSecp256k1) Sign(msg []byte) (tcrypto.Signature, error)
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