Documentation
¶
Overview ¶
Package audit provides audit logging with hash chain verification.
Index ¶
Constants ¶
View Source
const ( ErrorCodeAuditRecordMalformed = "E_AUDIT_RECORD_MALFORMED" ErrorCodeAuditChainBroken = "E_AUDIT_CHAIN_BROKEN" ErrorCodeAuditRecordHashMismatch = "E_AUDIT_RECORD_HASH_MISMATCH" ErrorCodeAuditRecordHashRecompute = "E_AUDIT_RECORD_HASH_RECOMPUTE_FAILED" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileAppender ¶
type FileAppender struct {
// contains filtered or unexported fields
}
FileAppender appends audit records to a JSONL file with hash chain.
func NewFileAppender ¶
func NewFileAppender(path string) *FileAppender
NewFileAppender creates a new FileAppender.
func (*FileAppender) Append ¶
func (a *FileAppender) Append(eventType model.AuditEventType, worktreeName string, snapshotID model.SnapshotID, details map[string]any) error
Append adds a new audit record to the log.
func (*FileAppender) EnsureAppendable ¶
func (a *FileAppender) EnsureAppendable() error
EnsureAppendable verifies that the audit log can be safely extended.
func (*FileAppender) GetLastRecordHash ¶
func (a *FileAppender) GetLastRecordHash() (model.HashValue, error)
GetLastRecordHash returns the hash of the last record in the log.
type IntegrityError ¶
IntegrityError is returned when an audit log cannot be safely extended.
func (*IntegrityError) Error ¶
func (e *IntegrityError) Error() string
Click to show internal directories.
Click to hide internal directories.