secrets

package
v0.0.0-...-e1c9297 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSecretNotFound = errors.New("Secret not found")

ErrSecretNotFound occurs if a secret could not be found

View Source
var ErrSecretsLocked = errors.New("Secrets are locked")

ErrSecretsLocked occurs if the secret store is locked

Functions

func EntrySortNameAsc

func EntrySortNameAsc(entries []*api.SecretEntry)

Types

type Autolocker

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

Autolocker is a helper to automatically lock the secrets store after a given timeout. The timeout can be set to hard-mode so that the the store will be locked no matter what.

func NewAutolocker

func NewAutolocker(secrets Secrets, timeout time.Duration, hardTimeout bool) *Autolocker

NewAutolocker creates a new Autolocker

func (*Autolocker) Cancel

func (a *Autolocker) Cancel()

Cancel the autolock timeout (usually because the store has been manually locked)

func (*Autolocker) GetAutolockAt

func (a *Autolocker) GetAutolockAt() time.Time

GetAutolockAt gets the current autolock timestamp

func (*Autolocker) Reset

func (a *Autolocker) Reset()

Reset the timeout (will be ignored if timeout is hard-mode)

func (*Autolocker) Start

func (a *Autolocker) Start()

Start the autolock timeout (usually after an unlock)

type IDSet

type IDSet map[string]bool

IDSet is a helper to handie a set of generic ids

func (IDSet) Add

func (c IDSet) Add(id string)

Add a given id to the set

func (IDSet) AddAll

func (c IDSet) AddAll(ids []string)

AddAll adds a slice of ids to the set

func (IDSet) Contains

func (c IDSet) Contains(id string) bool

Contains checks if a given id is part of the set

func (IDSet) Equals

func (c IDSet) Equals(other IDSet) bool

Equals compares this id set to another for equality

func (IDSet) MarshalJSON

func (c IDSet) MarshalJSON() ([]byte, error)

MarshalJSON creates a json array of the set

func (IDSet) Remove

func (c IDSet) Remove(id string)

Remove a given id from the set

func (IDSet) String

func (c IDSet) String() string

func (*IDSet) UnmarshalJSON

func (c *IDSet) UnmarshalJSON(data []byte) error

UnmarshalJSON reads the set from a json array

type SecretBlock

type SecretBlock struct {
	ID      string            `json:"id"`
	Type    api.SecretType    `json:"type"`
	Version api.SecretVersion `json:"version"`
}

SecretBlock represents a block containing the version of a secret. This is what actually has to be encrypted and stored to the underlying store implementation.

type Secrets

type Secrets interface {
	// Status gets the current status of the store.
	Status(ctx context.Context) (*api.Status, error)
	// Lock the store
	Lock(ctx context.Context) error
	// Unlock the store for a given identity
	Unlock(ctx context.Context, name, email, passphrase string) error

	// List all identities that have access to the store
	Identities(ctx context.Context) ([]api.Identity, error)

	// List all secrets of the store (only references)
	List(ctx context.Context, filter api.SecretListFilter) (*api.SecretList, error)
	// Add a secret to the store
	Add(ctx context.Context, id string, secretType api.SecretType, version api.SecretVersion) error
	// Get a secret from the store
	Get(ctx context.Context, secretID string) (*api.Secret, error)

	// EstimateStrength of a passwrd
	EstimateStrength(ctx context.Context, estimate api.PasswordEstimate) (*api.PasswordStrength, error)

	// GeneratePassword generates a password
	GeneratePassword(ctx context.Context, parameter api.GenerateParameter) (string, error)
}

Secrets is the interface to any secret store implementation

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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