secretbox

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PrefixV1 = "enc:v1:"
	PrefixV2 = "enc:v2:"
)

Variables

View Source
var (
	ErrNotSealed  = errors.New("secretbox: value is not sealed")
	ErrUnknownKey = errors.New("secretbox: unknown key id")
	ErrNoKey      = errors.New("secretbox: no key configured")
)

Functions

func ParseKey

func ParseKey(b64 string) ([]byte, error)

Types

type Keyring

type Keyring struct {

	// AllowPlaintext lets Open return unsealed values unchanged. It exists only for migrating old rows; turn it off once every row is sealed.
	AllowPlaintext bool
	// contains filtered or unexported fields
}

func New

func New(currentID string, keys map[string][]byte) (*Keyring, error)

func (*Keyring) CurrentID

func (k *Keyring) CurrentID() string

func (*Keyring) NeedsReseal

func (k *Keyring) NeedsReseal(stored string) bool

func (*Keyring) Open

func (k *Keyring) Open(label, stored string) (string, error)

func (*Keyring) Reseal

func (k *Keyring) Reseal(label, stored string) (string, bool, error)

func (*Keyring) Seal

func (k *Keyring) Seal(label, plaintext string) (string, error)

func (*Keyring) SetLegacyV1Key

func (k *Keyring) SetLegacyV1Key(key []byte) error

Jump to

Keyboard shortcuts

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