payload

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2015 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package payload is a generated protocol buffer package.

It is generated from these files:

payload/payload.proto
payload/attached.proto
payload/detached.proto

It has these top-level messages:

Envelope

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthAttached = fmt.Errorf("proto: negative length found during unmarshaling")
)
View Source
var (
	ErrInvalidLengthDetached = fmt.Errorf("proto: negative length found during unmarshaling")
)
View Source
var (
	ErrInvalidLengthPayload = fmt.Errorf("proto: negative length found during unmarshaling")
)

Functions

func Marshal

func Marshal(p Payload) ([]byte, error)

Marshal returns the proto3 encoding of p.

Types

type Attached

type Attached struct {
	Nonce []byte `protobuf:"bytes,1,opt,name=nonce,proto3" json:"nonce,omitempty"`
	Data  []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
}

func NewAttached

func NewAttached() (*Attached, error)

NewAttached constructs an Attached.

func (*Attached) Digest

func (p *Attached) Digest() ([]byte, error)

Digest is a unique series of bytes that identify the payload.

func (*Attached) Lock

func (p *Attached) Lock(r io.Reader, db material.DB) ([]byte, error)

Lock encrypts the data from r using the secretbox encryption scheme from NaCl and returns the secret key.

func (*Attached) Marshal

func (m *Attached) Marshal() (data []byte, err error)

func (*Attached) MarshalTo

func (m *Attached) MarshalTo(data []byte) (int, error)

func (*Attached) ProtoMessage

func (*Attached) ProtoMessage()

func (*Attached) Reset

func (m *Attached) Reset()

func (*Attached) Size

func (m *Attached) Size() (n int)

func (*Attached) String

func (m *Attached) String() string

func (*Attached) Unlock

func (p *Attached) Unlock(w io.Writer, ks []byte, db material.DB) error

Unlock decrypts ciphertext the from the attached data with the secret key and writes the cleartext to w.

func (*Attached) Unmarshal

func (m *Attached) Unmarshal(data []byte) error

type Detached

type Detached struct {
	Nonce []byte `protobuf:"bytes,1,opt,name=nonce,proto3" json:"nonce,omitempty"`
	// contains filtered or unexported fields
}

func NewDetached

func NewDetached() (*Detached, error)

NewDetached constructs an Detached.

func (*Detached) Digest

func (p *Detached) Digest() ([]byte, error)

Digest is a unique series of bytes that identify the payload.

func (*Detached) Lock

func (p *Detached) Lock(r io.Reader, db material.DB) ([]byte, error)

Lock encrypts the data from r using the secretbox encryption scheme from NaCl. The nonce & ciphertext are stored in the DB and the secret key is returned.

func (*Detached) Marshal

func (m *Detached) Marshal() (data []byte, err error)

func (*Detached) MarshalTo

func (m *Detached) MarshalTo(data []byte) (int, error)

func (*Detached) ProtoMessage

func (*Detached) ProtoMessage()

func (*Detached) Reset

func (m *Detached) Reset()

func (*Detached) Size

func (m *Detached) Size() (n int)

func (*Detached) String

func (m *Detached) String() string

func (*Detached) Unlock

func (p *Detached) Unlock(w io.Writer, ks []byte, db material.DB) error

Unlock decrypts the ciphertext retrieved from the DB using the secret key and writes the cleartext to w.

func (*Detached) Unmarshal

func (m *Detached) Unmarshal(data []byte) error

type Envelope

type Envelope struct {
	Attached *Attached `protobuf:"bytes,1,opt,name=attached" json:"attached,omitempty"`
	Detached *Detached `protobuf:"bytes,2,opt,name=detached" json:"detached,omitempty"`
}

func Wrap

func Wrap(p Payload) (*Envelope, error)

Wrap returns an intermediate form of the Payload for marshalling.

func (*Envelope) GetAttached

func (m *Envelope) GetAttached() *Attached

func (*Envelope) GetDetached

func (m *Envelope) GetDetached() *Detached

func (*Envelope) GetValue

func (this *Envelope) GetValue() interface{}

func (*Envelope) Marshal

func (m *Envelope) Marshal() (data []byte, err error)

func (*Envelope) MarshalTo

func (m *Envelope) MarshalTo(data []byte) (int, error)

func (*Envelope) Payload

func (e *Envelope) Payload() (Payload, error)

Payload returns the concrete type from the intermediate form.

func (*Envelope) ProtoMessage

func (*Envelope) ProtoMessage()

func (*Envelope) Reset

func (m *Envelope) Reset()

func (*Envelope) SetValue

func (this *Envelope) SetValue(value interface{}) bool

func (*Envelope) Size

func (m *Envelope) Size() (n int)

func (*Envelope) String

func (m *Envelope) String() string

func (*Envelope) Unmarshal

func (m *Envelope) Unmarshal(data []byte) error

type Payload

type Payload interface {
	// Digest is a unique series of bytes that identify the Payload.
	Digest() ([]byte, error)

	// Lock encrypts the data from the Reader and returns ciphertext.
	Lock(io.Reader, material.DB) ([]byte, error)

	// Unlock decrypts the ciphertext and writes the data to the Writer.
	Unlock(io.Writer, []byte, material.DB) error

	// Marshal returns the binary representation of the Payload.
	Marshal() ([]byte, error)

	// Unmarshal parses the Payload encoded in data.
	Unmarshal([]byte) error
}

Payload encrypts and stores the data for a vault.

func Unmarshal

func Unmarshal(data []byte) (Payload, error)

Unmarshal parses the proto3 encoded payload.

Jump to

Keyboard shortcuts

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