chacha20

package
v0.0.0-...-3cb0c2f Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package chacha20 provides a blobstore encryption wrapper using chacha20poly1305.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackendStorage

type BackendStorage interface {
	GetBlobReader(ctx context.Context, offset uint64, id blid.Blid) (io.ReadCloser, bool, error)
	GetBlobWriter(context.Context, blid.Blid) (io.Writer, func(bool) error, error)
	DeleteBlobData(context.Context, blid.Blid) (bool, error)
	String() string
}

BackendStorage is the interface required for a supported storage.

type Chacha20

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

Chacha20 blobstore instance structure.

func New

func New(envSecret string, bs BackendStorage) (*Chacha20, error)

New returns a new Chacha20 instance, taking the password from ENV[envSecret].

func (*Chacha20) DeleteBlobData

func (cc *Chacha20) DeleteBlobData(ctx context.Context, id blid.Blid) (bool, error)

DeleteBlobData deletes a blob from the backend.

func (*Chacha20) GetBlobReader

func (cc *Chacha20) GetBlobReader(ctx context.Context, offset uint64, id blid.Blid) (io.ReadCloser, bool, error)

GetBlobReader returns a new blob reader.

func (*Chacha20) GetBlobWriter

func (cc *Chacha20) GetBlobWriter(ctx context.Context, id blid.Blid) (io.Writer, func(bool) error, error)

GetBlobWriter returns a new blob writer instance.

func (*Chacha20) String

func (cc *Chacha20) String() string

type Chacha20Reader

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

func (*Chacha20Reader) Close

func (cr *Chacha20Reader) Close() error

func (*Chacha20Reader) Read

func (cr *Chacha20Reader) Read(b []byte) (int, error)

type Chacha20Writer

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

func (*Chacha20Writer) Write

func (cw *Chacha20Writer) Write(b []byte) (int, error)

Write implements the io.Writer interface.

Jump to

Keyboard shortcuts

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