keystore

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2022 License: GPL-3.0 Imports: 36 Imported by: 4

Documentation

Index

Constants

View Source
const (
	StandardScryptN = 1 << 18

	StandardScryptP = 1

	LightScryptN = 1 << 12

	LightScryptP = 6
)

Variables

View Source
var (
	ErrLocked  = accounts.NewAuthNeededError("password or unlock")
	ErrNoMatch = errors.New("no key for given address or file")
	ErrDecrypt = errors.New("could not decrypt key with given passphrase")
)
View Source
var KeyStoreScheme = "keystore"
View Source
var KeyStoreType = reflect.TypeOf(&KeyStore{})

Functions

func EncryptKey

func EncryptKey(key *Key, auth string, scryptN, scryptP int) ([]byte, error)

func KeyFileName

func KeyFileName(keyAddr common.Address) string

func StoreKey

func StoreKey(dir, auth string, scryptN, scryptP int) (common.Address, error)

func WriteKeyStore

func WriteKeyStore(filepath string, keyjson []byte) error

Types

type AmbiguousAddrError

type AmbiguousAddrError struct {
	Addr    common.Address
	Matches []accounts.Account
}

func (*AmbiguousAddrError) Error

func (err *AmbiguousAddrError) Error() string

type Key

type Key struct {
	Id uuid.UUID

	Address common.Address

	PrivateKey *ecdsa.PrivateKey
}

func DecryptKey

func DecryptKey(keyjson []byte, auth string) (*Key, error)

func NewKeyForDirectICAP

func NewKeyForDirectICAP(rand io.Reader) *Key

func (*Key) MarshalJSON

func (k *Key) MarshalJSON() (j []byte, err error)

func (*Key) UnmarshalJSON

func (k *Key) UnmarshalJSON(j []byte) (err error)

type KeyStore

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

func NewKeyStore

func NewKeyStore(keydir string, scryptN, scryptP int) *KeyStore

func NewPlaintextKeyStore

func NewPlaintextKeyStore(keydir string) *KeyStore

func (*KeyStore) Accounts

func (ks *KeyStore) Accounts() []accounts.Account

func (*KeyStore) Delete

func (ks *KeyStore) Delete(a accounts.Account, passphrase string) error

func (*KeyStore) Export

func (ks *KeyStore) Export(a accounts.Account, passphrase, newPassphrase string) (keyJSON []byte, err error)

func (*KeyStore) Find

func (ks *KeyStore) Find(a accounts.Account) (accounts.Account, error)

func (*KeyStore) HasAddress

func (ks *KeyStore) HasAddress(addr common.Address) bool

func (*KeyStore) Import

func (ks *KeyStore) Import(keyJSON []byte, passphrase, newPassphrase string) (accounts.Account, error)

func (*KeyStore) ImportECDSA

func (ks *KeyStore) ImportECDSA(priv *ecdsa.PrivateKey, passphrase string) (accounts.Account, error)

func (*KeyStore) ImportPreSaleKey

func (ks *KeyStore) ImportPreSaleKey(keyJSON []byte, passphrase string) (accounts.Account, error)

func (*KeyStore) Lock

func (ks *KeyStore) Lock(addr common.Address) error

func (*KeyStore) NewAccount

func (ks *KeyStore) NewAccount(passphrase string) (accounts.Account, error)

func (*KeyStore) SignHash

func (ks *KeyStore) SignHash(a accounts.Account, hash []byte) ([]byte, error)

func (*KeyStore) SignHashWithPassphrase

func (ks *KeyStore) SignHashWithPassphrase(a accounts.Account, passphrase string, hash []byte) (signature []byte, err error)

func (*KeyStore) SignTx

func (ks *KeyStore) SignTx(a accounts.Account, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)

func (*KeyStore) SignTxWithAddress

func (ks *KeyStore) SignTxWithAddress(a accounts.Account, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)

func (*KeyStore) SignTxWithPassphrase

func (ks *KeyStore) SignTxWithPassphrase(a accounts.Account, passphrase string, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)

func (*KeyStore) Subscribe

func (ks *KeyStore) Subscribe(sink chan<- accounts.WalletEvent) event.Subscription

func (*KeyStore) TimedUnlock

func (ks *KeyStore) TimedUnlock(a accounts.Account, passphrase string, timeout time.Duration) error

func (*KeyStore) Unlock

func (ks *KeyStore) Unlock(a accounts.Account, passphrase string) error

func (*KeyStore) Update

func (ks *KeyStore) Update(a accounts.Account, passphrase, newPassphrase string) error

func (*KeyStore) Wallets

func (ks *KeyStore) Wallets() []accounts.Wallet

Jump to

Keyboard shortcuts

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