eris

package module
v0.0.0-...-7431f77 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2020 License: BSD-3-Clause Imports: 10 Imported by: 0

README

Eris

A work-in-progress implementation of Eris.

Experimental. Should not be used for anything whatsoever.

The testdata is copied from the canonical Eris repository, please see their associated licenses.

Documentation

Index

Constants

View Source
const (
	RefSize = 32
	KeySize = 32
)

Variables

This section is empty.

Functions

func Decode

func Decode(s Storage, w io.Writer, root Ref) error

Decode streams decrypted content to the writer, using the Storage to fetch successive content-addressed encrypted blocks descendent of the root reference.

Types

type BlockSize

type BlockSize int
const (
	Size1KiB  BlockSize = 1 * kb
	Size32KiB BlockSize = 32 * kb
)

type Ref

type Ref struct {
	BlockSize BlockSize
	Level     int
	Ref       [RefSize]byte
	Key       [KeySize]byte
}

func Encode1KiB

func Encode1KiB(w WriteFunc, r io.Reader, secret []byte) (ref Ref, err error)

Encode1KiB encodes bytes from the given Reader into 1 kibibyte blocks, emitting the blocks to the WriteFunc as data is streamed in from the Reader. This allows encoding arbitrarily large data in-memory.

Returns the root reference block.

func Encode32KiB

func Encode32KiB(w WriteFunc, r io.Reader, secret []byte) (ref Ref, err error)

Encode32KiB encodes bytes from the given Reader into 32 kibibyte blocks, emitting the blocks to the WriteFunc as data is streamed in from the Reader. This allows encoding arbitrarily large data in-memory.

Returns the root reference block.

func (Ref) URN

func (r Ref) URN() (string, error)

type Storage

type Storage interface {
	Get(ref [RefSize]byte) ([]byte, error)
}

Storage fetches a block's encrypted bytes given a particular reference, or returns an error if it is unable to do so.

The error is passed back up through the call to Decode.

type WriteFunc

type WriteFunc func(eblock []byte, ref [RefSize]byte, readkey [KeySize]byte) error

Jump to

Keyboard shortcuts

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