history

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package history defines bounded operational and append-only audit contracts.

Index

Constants

This section is empty.

Variables

View Source
var ErrAuditTampered = errors.New("history: audit chain verification failed")

ErrAuditTampered indicates that an entry's content or chain position does not match its stored digest.

Functions

func Verify

func Verify(anchor Hash, entries []Entry) error

Verify checks the content and ordering of entries after anchor. An empty retained page is valid because there is no content to contradict its anchor.

func VerifyFrom

func VerifyFrom(anchorSequence uint64, anchor Hash, entries []Entry) error

VerifyFrom checks hash and contiguous sequence integrity after an anchor.

Types

type Entry

type Entry struct {
	PreviousHash Hash
	Hash         Hash
	Event        Event
}

Entry links an event to the preceding retained or anchored audit digest.

func Seal

func Seal(previous Hash, event Event) Entry

Seal returns an immutable-value audit entry linked to previous.

type Event

type Event struct {
	Sequence       uint64
	HashVersion    uint16
	OccurredAt     time.Time
	CommandID      string
	IdempotencyKey string
	Actor          string
	Action         string
	Target         string
	Result         string
}

Event is the canonical content of one administrative audit record.

type Hash

type Hash [sha256.Size]byte

Hash is an audit-chain SHA-256 digest.

func HashBytes

func HashBytes(value []byte) Hash

HashBytes creates an anchor hash for a retained prefix or external root.

Jump to

Keyboard shortcuts

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