keystore

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2020 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// StandardScryptN is the N parameter of Scrypt encryption algorithm, using 256MB
	// memory and taking approximately 1s CPU time on a modern processor.
	StandardScryptN = 1 << 18

	// StandardScryptP is the P parameter of Scrypt encryption algorithm, using 256MB
	// memory and taking approximately 1s CPU time on a modern processor.
	StandardScryptP = 1

	// LightScryptN is the N parameter of Scrypt encryption algorithm, using 4MB
	// memory and taking approximately 100ms CPU time on a modern processor.
	LightScryptN = 1 << 12

	// LightScryptP is the P parameter of Scrypt encryption algorithm, using 4MB
	// memory and taking approximately 100ms CPU time on a modern processor.
	LightScryptP = 6
)

Variables

View Source
var (
	ErrDecrypt = fmt.Errorf("could not decrypt key with given password")
)

Functions

This section is empty.

Types

type AddressFormat

type AddressFormat int

type Key

type Key struct {
	Id         uuid.UUID
	Address    common.Address
	PrivateKey *crypto.PrivateKey
}

func NewKey

func NewKey(privKey *crypto.PrivateKey) *Key

func (*Key) Sign

func (key *Key) Sign(data common.Bytes) (*crypto.Signature, error)

type KeyStoreTest

type KeyStoreTest struct {
	Json     encryptedKeyJSON
	Password string
	Priv     string
}

Test and utils for the key store tests in the Ethereum JSON tests; testdataKeyStoreTests/basic_tests.json

type Keystore

type Keystore interface {

	// List the addresses of all the stored keys
	ListKeyAddresses() ([]common.Address, error)

	// Loads and decrypts the key from disk.
	GetKey(address common.Address, auth string) (*Key, error)

	// Writes and encrypts the key.
	StoreKey(k *Key, auth string) error

	// Deletes the key from the disk.
	DeleteKey(address common.Address, auth string) error
}

type KeystoreEncrypted

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

func NewKeystoreEncrypted

func NewKeystoreEncrypted(keysDirRoot string, scryptN, scryptP int) (KeystoreEncrypted, error)

func (KeystoreEncrypted) DeleteKey

func (ks KeystoreEncrypted) DeleteKey(address common.Address, auth string) error

func (KeystoreEncrypted) GetKey

func (ks KeystoreEncrypted) GetKey(address common.Address, auth string) (*Key, error)

func (KeystoreEncrypted) ListKeyAddresses

func (ks KeystoreEncrypted) ListKeyAddresses() ([]common.Address, error)

func (KeystoreEncrypted) StoreKey

func (ks KeystoreEncrypted) StoreKey(key *Key, auth string) error

type KeystorePlain

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

func NewKeystorePlain

func NewKeystorePlain(keysDirRoot string) (KeystorePlain, error)

func (KeystorePlain) DeleteKey

func (ks KeystorePlain) DeleteKey(address common.Address, auth string) error

func (KeystorePlain) GetKey

func (ks KeystorePlain) GetKey(address common.Address, auth string) (*Key, error)

func (KeystorePlain) ListKeyAddresses

func (ks KeystorePlain) ListKeyAddresses() ([]common.Address, error)

func (KeystorePlain) StoreKey

func (ks KeystorePlain) StoreKey(key *Key, auth string) error

Jump to

Keyboard shortcuts

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