secret

package
v0.0.0-...-83cf971 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: LGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithDeterministicGenerate

func WithDeterministicGenerate(t testing.TB, v Value)

WithDeterministicGenerate overwrites Generate function to returned fixed result until the end of the test.

This function is replacing secure random generator with deterministic output.

This function is not safe for concurrent use.

Types

type Safe

type Safe interface {
	Encrypt(data []byte) ([]byte, error)
	Decrypt(data []byte) (Value, error)
}

func AESSafe

func AESSafe(secret string) Safe

type Value

type Value []byte

Value represents a secret value that must not be exposed.

func Generate

func Generate(size int) Value

Generate returns a random secret value of requested size in bytes.

func (Value) GoString

func (Value) GoString() string

func (Value) Is

func (v Value) Is(other Value) bool

Is returns true if two secrets are equal.

func (Value) MarshalJSON

func (Value) MarshalJSON() ([]byte, error)

func (Value) Scan

func (Value) Scan(interface{}) error

func (Value) String

func (Value) String() string

Forbid certain interface to avoid stupid mistakes.

func (Value) Value

func (Value) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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