encryption

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotSupportedType = errors.New("not supported key type")
)

Functions

func MigrateAccountToValidatorKey

func MigrateAccountToValidatorKey(acckeypath string, valkeypath string, pubkey validatorpk.PubKey) error

Types

type EncryptedKeyJSON

type EncryptedKeyJSON struct {
	Type      uint8               `json:"type"`
	PublicKey string              `json:"pubkey"`
	Crypto    keystore.CryptoJSON `json:"crypto"`
}

type Keystore

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

func New

func New(scryptN int, scryptP int) *Keystore

func (Keystore) EncryptKey

func (ks Keystore) EncryptKey(pubkey validatorpk.PubKey, key []byte, auth string) ([]byte, error)

EncryptKey encrypts a key using the specified scrypt parameters into a json blob that can be decrypted later on.

func (Keystore) ReadKey

func (ks Keystore) ReadKey(wantPubkey validatorpk.PubKey, filename, auth string) (*PrivateKey, error)

func (Keystore) StoreKey

func (ks Keystore) StoreKey(filename string, pubkey validatorpk.PubKey, key []byte, auth string) error

type PrivateKey

type PrivateKey struct {
	Type    uint8
	Bytes   []byte
	Decoded interface{}
}

func DecryptKey

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

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

Jump to

Keyboard shortcuts

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