keystore

package
v0.0.0-...-fa14253 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FastN = 2
	FastP = 1
)
View Source
const EthereumMessageHashPrefix = "\x19Ethereum Signed Message:\n32"

EthereumMessageHashPrefix is a Geth-originating message prefix that seeks to prevent arbitrary message data to be representable as a valid Ethereum transaction For more information, see: https://github.com/ethereum/go-ethereum/issues/3731

Variables

DefaultScryptParams is for use in production. It used geth's standard level of encryption and is relatively expensive to decode. Avoid using this in tests.

View Source
var ErrKeyStoreLocked = errors.New("keystore is locked (HINT: did you forget to call keystore.Unlock?)")
View Source
var FastScryptParams = ScryptParams{N: FastN, P: FastP}

FastScryptParams is for use in tests, where you don't want to wear out your CPU with expensive key derivations, do not use it in production, or your encrypted keys will be easy to brute-force!

Functions

This section is empty.

Types

type KeyStore

type KeyStore interface {
	Unlock(password string) error
	Accounts() []accounts.Account
	Wallets() []accounts.Wallet
	HasAccounts() bool
	HasAccountWithAddress(common.Address) bool
	NewAccount() (accounts.Account, error)
	Import(keyJSON []byte, oldPassword string) (accounts.Account, error)
	Export(address common.Address, newPassword string) ([]byte, error)
	Delete(address common.Address) error
	GetAccounts() []accounts.Account
	GetAccountByAddress(common.Address) (accounts.Account, error)

	SignTx(account accounts.Account, tx *ethTypes.Transaction, chainID *big.Int) (*ethTypes.Transaction, error)
}

func NewInsecureKeyStore

func NewInsecureKeyStore(keyDir string) KeyStore

NewInsecureKeyStore creates an *INSECURE* keystore for the given directory. NOTE: Should only be used for testing!

func NewKeyStore

func NewKeyStore(keyDir string, scryptParams ScryptParams) KeyStore

NewKeyStore creates a keystore for the given directory.

type ScryptConfigReader

type ScryptConfigReader interface {
	InsecureFastScrypt() bool
}

type ScryptParams

type ScryptParams struct{ N, P int }

func GetScryptParams

func GetScryptParams(config ScryptConfigReader) ScryptParams

Jump to

Keyboard shortcuts

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