encryption

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsEncrypted

func IsEncrypted(path string) bool

IsEncrypted() tests if target file is encrypted

Types

type Encrypter

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

Encrypter is used to encrypt/decrypt backups

func New

func New(log *slog.Logger, config *EncrypterConfig) (*Encrypter, error)

New creates a new Encrypter with the given key. The key should be 32 bytes (AES-256)

func (*Encrypter) Decrypt

func (e *Encrypter) Decrypt(inputPath string) (string, error)

Decrypt input file with key and store decrypted result with suffix removed if input does not end with suffix, it is assumed that the file was not encrypted.

func (*Encrypter) Encrypt

func (e *Encrypter) Encrypt(inputPath string) (string, error)

Encrypt input file with key and store encrypted result with suffix

type EncrypterConfig

type EncrypterConfig struct {
	FS  afero.Fs
	Key string
}

Jump to

Keyboard shortcuts

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