logger

package
v1.38.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifyChain

func VerifyChain(path string, key []byte) (int, error)

VerifyChain reads a log file and verifies the HMAC chain integrity. Returns the line number of the first broken link, or 0 if chain is valid.

Types

type IntegrityWriter

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

IntegrityWriter appends HMAC hash chain signatures to log lines. Each line is written as: <content>|hmac=<SHA256(prevHMAC + content)> This creates a chain where tampering with any line breaks all subsequent HMACs.

func NewIntegrityWriter

func NewIntegrityWriter(path string, key []byte) (*IntegrityWriter, error)

NewIntegrityWriter creates a new integrity writer for the given log file. The key is used for HMAC computation. If the file already exists, the writer reads the last line's HMAC to continue the chain.

func (*IntegrityWriter) Close

func (w *IntegrityWriter) Close() error

Close closes the underlying file.

func (*IntegrityWriter) WriteLine

func (w *IntegrityWriter) WriteLine(content string) error

WriteLine writes a line with HMAC chain signature appended.

Jump to

Keyboard shortcuts

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