testsecrets

package
v0.0.0-...-678bb0e Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package testsecrets provides a dumb in-memory secret store to use in unit tests. Use secrets.Set(c, &testsecrets.Store{...}) to inject it into the context.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Use

Use installs default testing store into the context.

Types

type Store

type Store struct {
	sync.Mutex

	Secrets        map[secrets.Key]secrets.Secret // current map of all secrets
	NoAutogenerate bool                           // if true, GetSecret will NOT generate secrets
	SecretLen      int                            // length of generated secret, 8 bytes default
	Rand           *rand.Rand                     // used to generate missing secrets
	// contains filtered or unexported fields
}

Store implements secrets.Store in the simplest way possible using memory as a backend and very dumb deterministic "randomness" source for secret key autogeneration. Useful in unit tests. Can be modified directly (use lock if doing it concurrently). NEVER use it outside of tests.

func (*Store) GetSecret

func (t *Store) GetSecret(k secrets.Key) (secrets.Secret, error)

GetSecret is a part of Store interface.

Jump to

Keyboard shortcuts

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