Documentation ¶
Index ¶
- Constants
- Variables
- func NewSeedFromMnemonic(mnemonic string, passOpt ...string) ([]byte, error)
- type EnvWallet
- func (w *EnvWallet) DeleteWallet() error
- func (w *EnvWallet) GetPrivateKey() (lib.HexString, error)
- func (w *EnvWallet) PrivateKeyUpdated() <-chan struct{}
- func (w *EnvWallet) SetMnemonic(mnemonic string, derivationPath string) error
- func (w *EnvWallet) SetPrivateKey(privateKeyOxHex lib.HexString) error
- type KeychainWallet
- func (w *KeychainWallet) DeleteWallet() error
- func (w *KeychainWallet) GetPrivateKey() (lib.HexString, error)
- func (w *KeychainWallet) PrivateKeyUpdated() <-chan struct{}
- func (w *KeychainWallet) SetMnemonic(mnemonic string, derivationPath string) error
- func (w *KeychainWallet) SetPrivateKey(privateKey lib.HexString) error
- type Wallet
Constants ¶
View Source
const ( PRIVATE_KEY_KEY = "private-key" MNEMONIC_KEY = "mnemonic" DERIVATION_PATH_KEY = "mnemonic-derivation-path" )
Variables ¶
View Source
var ( ErrWalletNotSet = errors.New("wallet not set") ErrWallet = errors.New("cannot retrieve mnemonic or private key") )
View Source
var ErrEnvWalletSet = errors.New("cannot set private key for env wallet, switch to keychain wallet by removing WALLET_PRIVATE_KEY env var")
Functions ¶
Types ¶
type EnvWallet ¶
type EnvWallet struct {
// contains filtered or unexported fields
}
func NewEnvWallet ¶
func (*EnvWallet) DeleteWallet ¶
func (*EnvWallet) PrivateKeyUpdated ¶
func (w *EnvWallet) PrivateKeyUpdated() <-chan struct{}
func (*EnvWallet) SetMnemonic ¶
type KeychainWallet ¶
type KeychainWallet struct {
// contains filtered or unexported fields
}
func NewKeychainWallet ¶
func NewKeychainWallet(keychain i.KeyValueStorage) *KeychainWallet
func (*KeychainWallet) DeleteWallet ¶
func (w *KeychainWallet) DeleteWallet() error
func (*KeychainWallet) GetPrivateKey ¶
func (w *KeychainWallet) GetPrivateKey() (lib.HexString, error)
GetPrivateKey use this function to get the private key regardless of whether it was stored as a mnemonic or private key
errors with ErrPkeyAndMnemonic if both mnemonic and private key are stored
func (*KeychainWallet) PrivateKeyUpdated ¶
func (w *KeychainWallet) PrivateKeyUpdated() <-chan struct{}
func (*KeychainWallet) SetMnemonic ¶
func (w *KeychainWallet) SetMnemonic(mnemonic string, derivationPath string) error
SetMnemonic stores the mnemonic of the wallet
func (*KeychainWallet) SetPrivateKey ¶
func (w *KeychainWallet) SetPrivateKey(privateKey lib.HexString) error
SetPrivateKey stores the private key of the wallet
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
func NewFromMnemonic ¶
NewFromMnemonic returns a new wallet from a BIP-39 mnemonic.
func (*Wallet) DerivePrivateKey ¶
func (w *Wallet) DerivePrivateKey(path accounts.DerivationPath) (*ecdsa.PrivateKey, error)
DerivePrivateKey derives the private key of the derivation path.
Click to show internal directories.
Click to hide internal directories.