gdat

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: GPL-3.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MaxRefBinaryLen = cadata.IDSize + DEKSize
	Base64Alphabet  = cadata.Base64Alphabet
)
View Source
const DEKSize = 32

Variables

This section is empty.

Functions

func Copy added in v0.0.3

func Copy(ctx context.Context, src, dst cadata.Store, ref *Ref) error

Copy copies the data at ref from src to dst.

func DeriveKey

func DeriveKey(out []byte, secret *[32]byte, additional []byte)

DeriveKey uses the blake2b XOF to fill out. The input to the XOF is additional and secret is used to key the XOF.

func DeriveStream

func DeriveStream(secret *[32]byte, additional []byte) io.Reader

DeriveStream returns a cryptographically secure psuedorandom stream derived from a high entropy secret, and arbitrary additional bytes.

func Equal

func Equal(a, b Ref) bool

func Hash

func Hash(x []byte) cadata.ID

func MarshalRef

func MarshalRef(x Ref) []byte

Types

type DEK

type DEK [DEKSize]byte

func Convergent

func Convergent(ptextHash cadata.ID) DEK

Convergent generates a DEK depending only on ptextHash

func (*DEK) String

func (*DEK) String() string

type KeyFunc

type KeyFunc func(ptextHash cadata.ID) DEK

KeyFunc produces a key for a given blob

func SaltedConvergent

func SaltedConvergent(salt *[32]byte) KeyFunc

SaltedConvergent uses salt to generate convergent keys for each blob.

type Operator

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

func NewOperator

func NewOperator(opts ...Option) Operator

func (*Operator) GetF

func (o *Operator) GetF(ctx context.Context, s Store, ref Ref, fn func(data []byte) error) error

func (*Operator) Post

func (o *Operator) Post(ctx context.Context, s Store, data []byte) (*Ref, error)

func (*Operator) Read

func (o *Operator) Read(ctx context.Context, s Store, ref Ref, buf []byte) (int, error)

type Option

type Option = func(*Operator)

func WithCacheSize

func WithCacheSize(n int) Option

func WithSalt

func WithSalt(salt *[32]byte) Option

type Ref

type Ref struct {
	CID cadata.ID
	DEK DEK
}

func ParseRef

func ParseRef(x []byte) (*Ref, error)

func (Ref) IsZero

func (r Ref) IsZero() bool

func (Ref) MarshalBinary

func (r Ref) MarshalBinary() ([]byte, error)

func (Ref) MarshalText

func (r Ref) MarshalText() ([]byte, error)

func (Ref) String

func (r Ref) String() string

func (*Ref) UnmarshalBinary

func (ref *Ref) UnmarshalBinary(x []byte) error

func (*Ref) UnmarshalText

func (r *Ref) UnmarshalText(data []byte) error

type Store

type Store = cadata.Store

Jump to

Keyboard shortcuts

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