storesign

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package storesign is the operator-held Ed25519 key that authenticates a synced store (audit H1). Age provides confidentiality, not authentication; without this signature a backend that knows the (public) recipients can fabricate a policy-stripped store that every machine will pull silently.

The key is store-scoped and operator-anchored, distinct from the per-session audit signers in sign.go. The pin is this machine's memory of which public key it expects: it never travels with the store, and a mismatch is a hard refusal (not overrideable by --force).

Index

Constants

View Source
const SeedSize = ed25519.SeedSize

SeedSize is the Ed25519 seed length written to store-signing.key.

Variables

View Source
var ErrCorrupt = errors.New("store-signing key or pin is corrupt")

ErrCorrupt is returned when a key or pin file exists but is not a valid 32-byte seed / 32-byte public key. Callers must refuse, never auto-heal: regenerating a corrupt seed would invalidate every prior signature and train the operator to discount a real tamper alarm (audit L3).

Functions

func Decode

func Decode(s string) ([]byte, error)

Decode is the inverse of Encode (also accepting padded standard base64).

func DecodePub

func DecodePub(s string) (ed25519.PublicKey, error)

DecodePub parses EncodePub output (also accepting padded standard base64).

func Encode

func Encode(b []byte) string

Encode is unpadded standard base64 of raw bytes — the wire spelling for both the public key and the signature in S3 user-metadata.

func EncodePub

func EncodePub(pub ed25519.PublicKey) string

EncodePub is the canonical on-disk / CLI spelling of a public key.

func LoadPin

func LoadPin(path string) (ed25519.PublicKey, error)

LoadPin reads the pinned signer public key. A missing pin is os.ErrNotExist (legacy unsigned fleet). A present-but-unparseable pin is ErrCorrupt.

func Save

func Save(path string, k *Key) error

Save writes the 32-byte seed to path at 0600 via atomicfile.

func SavePin

func SavePin(path string, pub ed25519.PublicKey) error

SavePin writes the public key to path at 0600 via atomicfile.

func Sign

func Sign(priv ed25519.PrivateKey, payload []byte) []byte

Sign returns the Ed25519 signature of payload under priv.

func Verify

func Verify(pub ed25519.PublicKey, payload, sig []byte) bool

Verify reports whether sig is a valid Ed25519 signature of payload by pub.

Types

type Key

type Key struct {
	Seed []byte
	Priv ed25519.PrivateKey
	Pub  ed25519.PublicKey
}

Key is an operator store-signing keypair, derived from a 32-byte seed.

func Generate

func Generate() (*Key, error)

Generate mints a fresh key from crypto/rand.

func Load

func Load(path string) (*Key, error)

Load reads a 32-byte seed from path. A missing file is os.ErrNotExist so the caller can decide whether to generate. A present-but-wrong file is ErrCorrupt — never silently replaced.

Jump to

Keyboard shortcuts

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