Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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.
Click to show internal directories.
Click to hide internal directories.