keystorev4

package
v1.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encryptor

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

Encryptor is an encryptor that follows the Ethereum keystore V4 specification.

func New

func New(opts ...Option) *Encryptor

New creates a new keystore V4 encryptor. This takes the following options: - cipher: the cipher to use when encrypting the secret, can be either "scrypt" (default) or "pbkdf2"

func (*Encryptor) Decrypt

func (e *Encryptor) Decrypt(data map[string]interface{}, passphrase string) ([]byte, error)

Decrypt decrypts the data provided, returning the secret.

func (*Encryptor) Encrypt

func (e *Encryptor) Encrypt(secret []byte, passphrase string) (map[string]interface{}, error)

Encrypt encrypts data.

func (*Encryptor) Name

func (e *Encryptor) Name() string

Name returns the name of this encryptor

func (*Encryptor) Version

func (e *Encryptor) Version() uint

Version returns the version of this encryptor

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option gives options to New

func WithCipher

func WithCipher(cipher string) Option

WithCipher sets the cipher for the encryptor.

Jump to

Keyboard shortcuts

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