keystore

package
v0.0.0-...-9bbbbb1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2019 License: LGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScryptN = 1 << 18
	ScryptP = 1
)

Scrypt common parameter

View Source
const (
	// Version keystore version
	Version = 1
)

Variables

This section is empty.

Functions

func EncryptKey

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

EncryptKey encrypts a key using the specified scrypt parameters into a json passphrase -> script function -> decryption key decryption key + private key -> aes-128-ctr algorithm -> encrypted private key

func StoreKey

func StoreKey(fileName, password string, key *Key) error

StoreKey store private key in a file. Note it is not encrypted. Need to support it later.

Types

type Key

type Key struct {
	Address common.Address
	// we only store privkey as pubkey/address can be derived from it
	// privkey in this struct is always in plaintext
	PrivateKey *ecdsa.PrivateKey
}

Key private key info for wallet

func DecryptKey

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

DecryptKey decrypts a key from a json blob, returning the private key itself.

func GetKey

func GetKey(fileName, password string) (*Key, error)

GetKey get private key from a file

Jump to

Keyboard shortcuts

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