secret

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: 7 Imported by: 0

Documentation

Overview

Package secret is a generated protocol buffer package.

It is generated from these files:

secret/secret.proto
secret/password.proto
secret/openpgpkey.proto

It has these top-level messages:

Envelope

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthOpenpgpkey = fmt.Errorf("proto: negative length found during unmarshaling")
)
View Source
var (
	ErrInvalidLengthPassword = fmt.Errorf("proto: negative length found during unmarshaling")
)
View Source
var (
	ErrInvalidLengthSecret = fmt.Errorf("proto: negative length found during unmarshaling")
)

Functions

func Marshal

func Marshal(sec Secret) ([]byte, error)

Marshal returns the proto3 encoding of sec.

Types

type Envelope

type Envelope struct {
	Password   *Password   `protobuf:"bytes,1,opt,name=password" json:"password,omitempty"`
	OpenPGPKey *OpenPGPKey `protobuf:"bytes,2,opt,name=openpgpkey" json:"openpgpkey,omitempty"`
}

func Wrap

func Wrap(sec Secret) (*Envelope, error)

Wrap returns an intermediate form of the secret for marshalling.

func (*Envelope) GetOpenPGPKey

func (m *Envelope) GetOpenPGPKey() *OpenPGPKey

func (*Envelope) GetPassword

func (m *Envelope) GetPassword() *Password

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) ProtoMessage

func (*Envelope) ProtoMessage()

func (*Envelope) Reset

func (m *Envelope) Reset()

func (*Envelope) Secret

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

Secret returns the concrete type from the intermediate form.

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 OpenPGPKey

type OpenPGPKey struct {
	KeyIDs []uint64 `protobuf:"varint,2,rep,name=key_ids" json:"key_ids,omitempty"`
	// contains filtered or unexported fields
}

func NewOpenPGPKey

func NewOpenPGPKey(keyIDs []uint64, comment string) *OpenPGPKey

NewOpenPGPKey constructs a OpenPGPKey secret for one or more encryption key ids.

func (*OpenPGPKey) Comment

func (s *OpenPGPKey) Comment() string

Comment string

func (*OpenPGPKey) Load

func (s *OpenPGPKey) Load(r io.Reader) ([][]byte, error)

Load reads the input data and returns one or more serialized OpenPGP encryption keys for the key ids.

func (*OpenPGPKey) Marshal

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

func (*OpenPGPKey) MarshalTo

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

func (*OpenPGPKey) Phase

func (s *OpenPGPKey) Phase() Phase

Phase is Unlock

func (*OpenPGPKey) ProtoMessage

func (*OpenPGPKey) ProtoMessage()

func (*OpenPGPKey) Reset

func (m *OpenPGPKey) Reset()

func (*OpenPGPKey) Size

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

func (*OpenPGPKey) String

func (m *OpenPGPKey) String() string

func (*OpenPGPKey) Unmarshal

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

type Password

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

func NewPassword

func NewPassword(comment string) *Password

NewPassword constructs a Password secret.

func (*Password) Comment

func (s *Password) Comment() string

Comment string

func (*Password) Load

func (*Password) Load(r io.Reader) ([][]byte, error)

Load reads the input data and returns the password bytes.

func (*Password) Marshal

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

func (*Password) MarshalTo

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

func (*Password) Phase

func (s *Password) Phase() Phase

Phase is Dual

func (*Password) ProtoMessage

func (*Password) ProtoMessage()

func (*Password) Reset

func (m *Password) Reset()

func (*Password) Size

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

func (*Password) String

func (m *Password) String() string

func (*Password) Unmarshal

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

type Phase

type Phase int

Phase marks the time at which a Secret input is expected.

const (
	// Unlock denotes a secret input for unlocking a vault.
	Unlock Phase = iota

	// Dual denotes a secret input for both locking & unlocking a vault.
	Dual
)

type Secret

type Secret interface {
	// Optional description of the secret usage.
	Comment() string

	// Marker for the point at which the secret input is required.
	Phase() Phase

	// Load the secret data from the Reader and return the internal form.
	Load(r io.Reader) ([][]byte, error)

	// Marshal returns the binary representation of the Secret.
	Marshal() (data []byte, err error)

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

Secret represents an input secret of a certain medium e.g. an RSA private key or a password.

func Unmarshal

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

Unmarshal parses the proto3 encoded secret.

Jump to

Keyboard shortcuts

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