envelope

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package envelope seals a backup generation to operator-held age recipients and names the keys it needs (ADR-0204 Decisions 1-3, 5): the box writes what it cannot read.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fingerprint

func Fingerprint(b []byte) string

Fingerprint is the first 16 lowercase hex of SHA-256(label ‖ 0x00 ‖ b) (Decision 3).

func LoadMaster

func LoadMaster(cfg config.Config, log *slog.Logger) ([]byte, error)

LoadMaster migrates a working-directory master and loads the node master secret from its place, gateway on or off (Decision 7). The daemon and funcd upgrade (ADR-0207) load it alike.

func Opener

func Opener(ids []age.Identity) backup.Opener

Opener binds the operator's identities (Decision 5). For a manifest naming recipients, the Unseal decrypts with the identities among them, and no match is fault.Invalid naming both fingerprint sets. A manifest naming none reads the bytes as is. Either way a store file whose seal disagrees with its manifest is fault.Invalid.

func ParseIdentities

func ParseIdentities(name string, r io.Reader) ([]age.Identity, error)

ParseIdentities parses the identities of r, named name in errors, with ReadIdentities' rules: a Restore reads its owner's identity from a Secret key (ADR-0222 Decision 6).

func ReadIdentities

func ReadIdentities(paths []string) ([]age.Identity, error)

ReadIdentities reads the operator's age identity files (Decision 5): X25519 or hybrid identities only; another type, or a file that does not parse (one encrypted with age -p), is fault.Invalid naming the file.

func ReadSecretsKey

func ReadSecretsKey(cfg config.Config) ([]byte, error)

ReadSecretsKey reads secrets.encryptionKeyFile; "" ⇒ nil.

Types

type Config

type Config struct {
	Recipients         []string
	None, NoSecrets    bool
	SecretsKey, Master []byte
	KeyPrefix          string
	Logger             *slog.Logger
}

Config is backup.encryption (Decision 2). Recipients are the paths of age recipients files; SecretsKey is secrets.encryptionKeyFile's bytes (nil ⇒ none); Master is the node master secret. NoSecrets (ADR-0209), for a store holding no Secret, skips only the secrets-key rule and the secrets-key warning. KeyPrefix names the config keys in errors ("" ⇒ "backup.", as backup.Config); Logger takes the warnings and the start line (nil ⇒ slog.Default()).

type Sealer

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

Sealer seals the store files of a run to the configured recipients and carries the manifest's key records.

func FromConfig

func FromConfig(cfg config.Config, master []byte, log *slog.Logger) (*Sealer, error)

FromConfig applies Decision 2's start rules when backup.target is set: a violation is refused, and the keys' fingerprints are logged. nil without a target.

func New

func New(cfg Config) (*Sealer, error)

New checks cfg against Decision 2; a violation is fault.Invalid naming the key and file. It logs the keys' fingerprints, never their bytes, and the warnings of an unsealed or secrets-key-less configuration.

func Parse

func Parse(recipients []string) (*Sealer, error)

Parse is the Sealer of inline recipients (ADR-0222 Decision 6): Decision 2's recipient rules on age1… and age1pq1… strings, with NoSecrets, and no none. It logs nothing; a violation is fault.Invalid naming the recipient.

func (*Sealer) Keys

func (s *Sealer) Keys() backup.Keys

Keys are the manifest's key records (Decision 3): Recipients sorted and distinct, nil when none.

func (*Sealer) Seal

func (s *Sealer) Seal() backup.Seal

Seal is one age stream per store file to every recipient; nil when none.

Jump to

Keyboard shortcuts

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