backup

package
v0.0.0-...-b8ca463 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

package backup handles reading and writing encrypted .tar files from the secretsDirectory to a backupPath using the key backupKey.

Index

Constants

This section is empty.

Variables

View Source
var NonCanonicalPathError = errors.New("non-canonical file path in archive")

Functions

func Unwrap

func Unwrap(wrapped []byte, privateKey []byte) ([]byte, error)

Unwrap takes the wrapped key from `wrap`, along with the private key. It returns a key suitable to be passed to Restore()

Types

type Backup

type Backup interface {
	Backup() error
	Restore(key []byte) error
}

type FileBackup

type FileBackup struct {
	SecretsDirectory string
	BackupPath       string
	BackupKeyPath    string
	Pubkey           *[32]byte
	Chown            bool
	EnforceFS        output.Filesystem
}

func (*FileBackup) Backup

func (b *FileBackup) Backup() error

Backup loads all files in b.SecretsDirectory, tars, compresses, then encrypts with b.BackupKey The content is written to b.BackupPath

func (*FileBackup) Restore

func (b *FileBackup) Restore(key []byte) error

Restore opens b.BackupPath, decrypts with an unwrapped key and writes contents to b.SecretsDirectory

type WrappedKey

type WrappedKey struct {
	Nonce        []byte
	CipherText   []byte
	SenderPubkey []byte
}

WrappedKey is the JSON-encoded "wrapped key" that a backup is encrypted with.

Jump to

Keyboard shortcuts

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