signing

package
v0.1.2 Latest Latest
Warning

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

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

Documentation

Overview

Package signing implements HMAC-SHA256 config signing and verification for BubbleFish Nexus compiled config files. The sign-config CLI writes *.sig files alongside each compiled *.json; the daemon verifies them at startup and on hot reload when [daemon.signing] enabled = true.

Reference: Tech Spec Section 6.5.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SignAll

func SignAll(compiledDir string, key []byte, logger *slog.Logger) error

SignAll signs every *.json file in compiledDir. Returns an error on the first failure. The key is never logged.

func SignFile

func SignFile(jsonPath string, key []byte) error

SignFile computes HMAC-SHA256 over the contents of jsonPath using key and writes the hex-encoded signature to jsonPath + ".sig" atomically (temp file + fsync + rename in the same directory).

Permissions: sig file is 0600.

func VerifyAll

func VerifyAll(compiledDir string, key []byte, onEvent SecurityEventFunc, logger *slog.Logger) error

VerifyAll verifies the HMAC-SHA256 signature of every *.json file in compiledDir. Returns an error on the first failure. If onEvent is non-nil, it is called for each verification failure.

func VerifyFile

func VerifyFile(jsonPath string, key []byte, onEvent SecurityEventFunc) error

VerifyFile checks that jsonPath has a valid *.sig sidecar containing the correct HMAC-SHA256 for the file contents. Returns nil on success.

If onEvent is non-nil, it is called with event type "config_signature_invalid" on any verification failure.

Types

type SecurityEventFunc

type SecurityEventFunc func(eventType string, attrs ...slog.Attr)

SecurityEventFunc is a callback invoked when a signature verification failure occurs. The eventType is always "config_signature_invalid".

Jump to

Keyboard shortcuts

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