keychain

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package keychain is a generated protocol buffer package.

It is generated from these files:

libri/author/keychain/keychain.proto

It has these top-level messages:

StoredKeychain

Index

Constants

View Source
const (
	// StandardScryptN is the N parameter of Scrypt encryption algorithm, using 256MB
	// memory and taking approximately 1s CPU time on a modern processor.
	StandardScryptN = 1 << 18

	// StandardScryptP is the P parameter of Scrypt encryption algorithm, using 256MB
	// memory and taking approximately 1s CPU time on a modern processor.
	StandardScryptP = 1

	// LightScryptN is the N parameter of Scrypt encryption algorithm, using 4MB
	// memory and taking approximately 100ms CPU time on a modern processor.
	LightScryptN = 1 << 12

	// LightScryptP is the P parameter of Scrypt encryption algorithm, using 4MB
	// memory and taking approximately 100ms CPU time on a modern processor.
	LightScryptP = 6
)

Variables

View Source
var (
	// ErrEmptyKeychain indicates no keys in the keychain.
	ErrEmptyKeychain = errors.New("empty keychain")

	// ErrUnexpectedMissingKey indicates a unexpectedly missing key
	ErrUnexpectedMissingKey = errors.New("missing key")
)

Functions

func Save

func Save(filepath, auth string, kc GetterSampler, scryptN, scryptP int) error

Save saves and encrypts a keychain to a file.

Types

type Getter

type Getter interface {
	// Get returns the key with the given public key, if it exists. Otherwise, it returns nil.
	// The second return value indicates whether the key is present in the keychain or not.
	Get(publicKey []byte) (ecid.ID, bool)
}

Getter is a collection of ECDSA keys that can be looked up by their public key.

func NewUnion

func NewUnion(kcs ...Getter) Getter

NewUnion returns a Getter representing the union of multiple Getters.

type GetterSampler

type GetterSampler interface {
	Getter
	Sampler
}

GetterSampler and a collection of ECDSA keys that can be both looked up and sampled.

func FromECIDs

func FromECIDs(ecids []ecid.ID) GetterSampler

FromECIDs creates a Getter instance from a map of ECDSA private keys.

func Load

func Load(filepath, auth string) (GetterSampler, error)

Load loads and decrypts a keychain from a file.

func New

func New(n int) GetterSampler

New creates a new (plaintext) Getter with n individual keys.

type Sampler

type Sampler interface {
	// Sample randomly selects a key from the collection.
	Sample() (ecid.ID, error)
}

Sampler is a collection of ECDSA keys that can be sampled.

type StoredKeychain

type StoredKeychain struct {
	PrivateKeys [][]byte `protobuf:"bytes,1,rep,name=privateKeys,proto3" json:"privateKeys,omitempty"`
}

func (*StoredKeychain) Descriptor

func (*StoredKeychain) Descriptor() ([]byte, []int)

func (*StoredKeychain) GetPrivateKeys

func (m *StoredKeychain) GetPrivateKeys() [][]byte

func (*StoredKeychain) ProtoMessage

func (*StoredKeychain) ProtoMessage()

func (*StoredKeychain) Reset

func (m *StoredKeychain) Reset()

func (*StoredKeychain) String

func (m *StoredKeychain) String() string

Jump to

Keyboard shortcuts

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