Documentation
¶
Overview ¶
Package audit emits HMAC-signed audit-chain entries for admin mutations. Per gocodealone-multisite SPEC.md T26.
The chain links each entry to the prior entry's signature, so any row mutation invalidates the chain from that point forward. The signing key (MULTISITE_AUDIT_SIGN_KEY) is rotated via the `wfctl multisite audit-rotate` runbook (docs/runbook/backup.md).
In-memory Sink ships here; production wires a postgres-backed Sink via workflow-plugin-audit-chain (separate module).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
ID int64
OccurredAt time.Time
Actor string // user_id (or "system" for bootstrap entries)
TenantID int64 // 0 for cross-tenant ops
Action string // "tenant.create", "page.update", etc.
Subject string // resource id ("page:42")
Meta map[string]any
PrevSig string // hex; "" for the first entry
Sig string // HMAC-SHA256(prev_sig || canonical(entry))
}
Entry is one audit record.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger produces signed entries + appends them to the configured Sink.
type MemorySink ¶
type MemorySink struct {
// contains filtered or unexported fields
}
MemorySink stores audit entries in-process. Used for tests + local dev.
func NewMemorySink ¶
func NewMemorySink() *MemorySink