encrypt

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decrypt

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

Decrypt the decryption component

func NewDecrypt

func NewDecrypt(opt Option) (*Decrypt, error)

NewDecrypt create a decryption component

func (*Decrypt) Decrypt

func (dec *Decrypt) Decrypt() error

Decrypt uses the decryption option to decrypt the files

type Encrypt

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

Encrypt the encryption component

func NewEncrypt

func NewEncrypt(opt Option, parentPath string) (*Encrypt, error)

NewEncrypt create an encryption component

func (*Encrypt) CreateEncryptTemp

func (e *Encrypt) CreateEncryptTemp(path string) (tempPath string, removeTemp func() error, err error)

CreateEncryptTemp create an encryption temporary file if enable encrypt and the path is matched

func (*Encrypt) NeedEncrypt

func (e *Encrypt) NeedEncrypt(path string) bool

NeedEncrypt encryption is enabled and path is matched

func (*Encrypt) NewWriter

func (e *Encrypt) NewWriter(w io.Writer, source string, name string) (io.WriteCloser, error)

NewWriter create an encryption writer

type Option

type Option struct {
	Encrypt       bool
	EncryptPath   string
	EncryptSecret []byte

	Decrypt       bool
	DecryptPath   string
	DecryptSecret []byte
	DecryptOut    string

	Logger *logger.Logger
}

Option the encryption option

func EmptyOption

func EmptyOption() Option

EmptyOption returns an empty encryption option

func NewOption

func NewOption(config conf.Config, logger *logger.Logger) Option

NewOption create an encryption option

Jump to

Keyboard shortcuts

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