secrets

package
v0.14.5 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package secrets seals the server's stored secrets (PBS API tokens, backup encryption keys) with a master key held outside the database, so a database dump alone does not expose them. AES-256-GCM, one random nonce per value; the sealed form is "v1:" + base64(nonce || ciphertext), which lets reads tell sealed values from legacy plaintext while those are migrated.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSealed

func IsSealed(v string) bool

IsSealed reports whether v carries the sealed-value prefix

func LoadOrCreateKeyFile

func LoadOrCreateKeyFile(path string) (key []byte, created bool, err error)

LoadOrCreateKeyFile reads the master key from path, creating a random one (mode 0600) when the file does not exist. created reports whether it was generated.

func ParseKey

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

ParseKey decodes a master key given as 64 hex characters (the key file content or the FALLBCK_MASTER_KEY variable)

Types

type Sealer

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

Sealer seals and opens values with one master key

func New

func New(key []byte) (*Sealer, error)

New returns a Sealer for a 32-byte key

func (*Sealer) Open

func (s *Sealer) Open(sealed string) ([]byte, error)

Open decrypts a value produced by Seal

func (*Sealer) OpenString

func (s *Sealer) OpenString(sealed string) (string, error)

OpenString is Open for strings

func (*Sealer) Seal

func (s *Sealer) Seal(plain []byte) string

Seal encrypts plain; an empty value stays empty (nothing stored, nothing to protect)

func (*Sealer) SealString

func (s *Sealer) SealString(plain string) string

SealString is Seal for strings

Jump to

Keyboard shortcuts

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