seal

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package seal encrypts and authenticates small values, such as cookie contents, with AES-256-GCM. The key is derived from a secret, so any string of at least 32 bytes works.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalid = errors.New("seal: invalid value")

ErrInvalid is returned for values that were not sealed by this box or were changed.

Functions

This section is empty.

Types

type Box

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

Box seals and opens values for one purpose.

func New

func New(secret, purpose string) (*Box, error)

New derives a key for purpose from secret. Values sealed for one purpose can't be opened for another.

func (*Box) Open

func (b *Box) Open(sealed string) ([]byte, error)

Open decrypts a value from Seal.

func (*Box) Seal

func (b *Box) Seal(plain []byte) string

Seal encrypts plain into URL-safe text.

Jump to

Keyboard shortcuts

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