fileoperations

package
v0.0.0-...-864a747 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	WalletPath    string `yaml:"wallet_path"`   // wallet path to the wallet gob file
	WalletPasswd  string `yaml:"wallet_passwd"` // password to the wallet gob file in hex format
	WalletPemPath string `yaml:"pem_path"`      // path to ed25519 pem file
	CAPath        string `yaml:"ca_cert"`       // path to ed25519 pem file
}

Config holds configuration of the file operator Helper.

type Helper

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

Helper holds all file operation methods.

func New

func New(cfg Config, s Sealer) Helper

New creates new Helper.

func (Helper) ReadFromPem

func (h Helper) ReadFromPem() (wallet.Wallet, error)

ReadFromPem creates Wallet from PEM format file. Uses both private and public key.

func (Helper) ReadWallet

func (h Helper) ReadWallet() (wallet.Wallet, error)

RereadWallet reads wallet from the file from GOB format. It uses decryption key to perform wallet decoding.

func (Helper) SaveToPem

func (h Helper) SaveToPem(w *wallet.Wallet) error

SaveToPem saves wallet private and public key to the PEM format file. Saved files are like in the example: - PRIVATE: "your/path/name" - PUBLIC: "your/path/name.pub" Pem saved wallet is not sealed cryptographically and keys can be seen by anyone having access to the machine.

func (Helper) SaveWallet

func (h Helper) SaveWallet(w *wallet.Wallet) error

SaveWallet saves wallet to the file in GOB format. GOB file is secured cryptographically by the key, so it is safer option to move your wallet between machines in that format. This wallet can only be red by the Go wallet implementation. For transferring wallet to other implementations use PEM format.

type Sealer

type Sealer interface {
	Encrypt(key, data []byte) ([]byte, error)
	Decrypt(key, data []byte) ([]byte, error)
}

Sealer offers behavior to seal the bytes returning the signature on the data.

Jump to

Keyboard shortcuts

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