age

package
v0.0.0-...-56ccd80 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: Unlicense Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context interface {
	// FS returns the underlying filesystem to read/write from.
	FS() afero.Fs
}

Context are all the values defined in the background that age operations may require.

func NewContext

func NewContext() Context

NewContext returns a new age context.

type FileReader

type FileReader struct {
	afero.File
	// contains filtered or unexported fields
}

FileReader reads and decrypts data from an encrypted file.

func (FileReader) Read

func (f FileReader) Read(p []byte) (int, error)

Read decrypts and reads bytes.

func (FileReader) Write

func (f FileReader) Write(p []byte) (int, error)

Write throws an error when you write to a reader file.

type FileWriter

type FileWriter struct {
	afero.File
	// contains filtered or unexported fields
}

FileWriter encrypts and writes data to a file.

func (FileWriter) Close

func (f FileWriter) Close() error

Close writes the encrypetd data to the file and closes it.

func (FileWriter) Read

func (f FileWriter) Read(p []byte) (int, error)

Read errors since the file is opened for writing.

func (FileWriter) Write

func (f FileWriter) Write(p []byte) (int, error)

Write encrypts and writes bytes to the underlying file.

type Fs

type Fs struct {
	afero.Fs
	// contains filtered or unexported fields
}

Fs is a filesystem that reads and writes encrypted files. Note that files cannot be opened for both reading and writing at the same time.

func NewFs

func NewFs(ctx Context, id Identity) Fs

NewFs returns a new encrypted filesystem that encrypts using the provided ID.

func (Fs) Create

func (fs Fs) Create(path string) (afero.File, error)

Create creates or truncates an encrypted file.

func (Fs) Open

func (fs Fs) Open(path string) (afero.File, error)

Open opens aen encrypted file for reading.

type Identity

type Identity interface {
	age.Identity

	// Recipient returns the recipient to encrypt files for.
	Recipient() age.Recipient
}

Identity is an age identty that can encrypt and decrypt files.

func ParseIdentity

func ParseIdentity(ctx Context, sshKeyPath string) (Identity, error)

ParseIdentity returns an age identity from an ssh key path.

Jump to

Keyboard shortcuts

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