encryptiontest

package
v0.1.100 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package encryptiontest provides an in-memory key store and ready Boxes for tests of stores that seal secrets.

Index

Constants

View Source
const Key = "test-encryption-key"

Key is the GOMODEL_ENCRYPTION_KEY the helpers use.

Variables

View Source
var ErrListFailed = errors.New("encryption_keys is unavailable")

ErrListFailed is what List returns while FailLists is in effect.

Functions

func Rotate

func Rotate(t testing.TB, store *KeyStore) *encryption.Box

Rotate creates and activates a new data key in store and returns the Box that seals with it while still opening values of the older keys.

Types

type KeyStore

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

KeyStore is an in-memory encryption.KeyStore.

func NewBox

func NewBox(t testing.TB) (*encryption.Box, *KeyStore)

NewBox returns an enabled Box over a fresh in-memory key store, together with the store so a test can rotate the data key.

func NewKeyStore

func NewKeyStore() *KeyStore

NewKeyStore returns an empty in-memory key store.

func (*KeyStore) Activate

func (s *KeyStore) Activate(_ context.Context, id string) error

func (*KeyStore) FailLists

func (s *KeyStore) FailLists(n int)

FailLists makes the next n calls to List fail with ErrListFailed.

func (*KeyStore) Insert

func (s *KeyStore) Insert(_ context.Context, key encryption.Key) (bool, error)

func (*KeyStore) List

func (s *KeyStore) List(context.Context) ([]encryption.Key, error)

func (*KeyStore) UpdateWrapping

func (s *KeyStore) UpdateWrapping(_ context.Context, key encryption.Key) error

Jump to

Keyboard shortcuts

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