keychain

package
v0.0.16-dev Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const PrivateKeyStoreKey = "key"
View Source
const PublicKeyStoreKey = "pub"

Variables

View Source
var (
	ErrKeyPairNotFound = errors.New("No key pair found in the local db.")
)

Functions

func New

func New(opts ...Option) *keychain

Types

type GenerateKeyFromMnemonicOpts added in v0.0.13

type GenerateKeyFromMnemonicOpts func(o *generateKeyFromMnemonicOpts)

func WithMnemonic added in v0.0.13

func WithMnemonic(mnemonic string) GenerateKeyFromMnemonicOpts

func WithOverride added in v0.0.13

func WithOverride() GenerateKeyFromMnemonicOpts

func WithPassword added in v0.0.13

func WithPassword(password string) GenerateKeyFromMnemonicOpts

type Keychain

type Keychain interface {
	GenerateKeyPair() (pub []byte, priv []byte, err error)
	GenerateKeyFromMnemonic(...GenerateKeyFromMnemonicOpts) (mnemonic string, err error)
	GetStoredKeyPairInLibP2PFormat() (crypto.PrivKey, crypto.PubKey, error)
	GetStoredPublicKey() (crypto.PubKey, error)
	GetStoredMnemonic() (string, error)
	GenerateKeyPairWithForce() (pub []byte, priv []byte, err error)
	Sign([]byte) ([]byte, error)
	ImportExistingKeyPair(priv crypto.PrivKey, mnemonic string) error
	DeleteKeypair() error
}

type Option added in v0.0.13

type Option func(o *keychainOptions)

func WithKeyring added in v0.0.13

func WithKeyring(ring ri.Keyring) Option

Used to inject a mock keyring in tests or in case you want to use a custom keyring implementation

func WithPath added in v0.0.13

func WithPath(path string) Option

Helper function for setting keychain file path for Windows/Linux

func WithStore added in v0.0.13

func WithStore(st store.Store) Option

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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