Documentation
¶
Index ¶
- func DefaultRotatePath(currentPath string) (string, error)
- func MarshalForSign(v any) ([]byte, error)
- func VerifyChain(logDir string, baseName string) error
- type Domain
- type DomainEntry
- type Entry
- type EventType
- type Foundation
- type Log
- func (l *Log) Append(e Entry, did string, s Signer) error
- func (l *Log) Entries() ([]Entry, error)
- func (l *Log) Fingerprint() (string, error)
- func (l *Log) IsGenesis() bool
- func (l *Log) IsTerminus() bool
- func (l *Log) Path() string
- func (l *Log) Rotate(reason RotationReason, did string, s Signer) (*Log, error)
- func (l *Log) Verify() error
- type RotationReason
- type Signer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultRotatePath ¶ added in v0.3.0
DefaultRotatePath returns the next rotated log path for the given current path. Rotated logs use zero-padded sequence numbers: audit-log.001.jsonl, audit-log.002.jsonl, etc.
func MarshalForSign ¶
func VerifyChain ¶ added in v0.3.0
VerifyChain validates the cross-log rotation integrity. All logs use the naming pattern: baseName.NNN.jsonl (e.g., audit-log.000.jsonl) Logs are ordered by generation number and verified in sequence.
Types ¶
type DomainEntry ¶
func (DomainEntry) Fields ¶
func (d DomainEntry) Fields() map[string]any
type Entry ¶
type Entry struct {
Foundation Foundation `json:"foundation"`
Domain Domain `json:"domain,omitempty"`
Event EventType `json:"event"`
}
func (Entry) MarshalJSON ¶
MarshalJSON implements custom JSON marshaling to ensure stable field ordering for the Domain field, which is critical for signature verification.
func (*Entry) UnmarshalJSON ¶
type Foundation ¶
type Foundation struct {
Seq uint64 `json:"seq"`
PrevHash string `json:"prev_hash"`
ActorDID string `json:"actor_did"`
Timestamp string `json:"timestamp"`
Signature string `json:"signature"`
// Rotation fields (only populated for genesis/terminus entries)
LogRole string `json:"log_role,omitempty"` // "genesis" or "terminus"
LogRef string `json:"log_ref,omitempty"` // for genesis: previous log path; for terminus: next log path
}
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
func (*Log) Fingerprint ¶ added in v0.3.0
Fingerprint returns the SHA-256 hash of the entire log file.
func (*Log) IsGenesis ¶ added in v0.3.0
IsGenesis returns true if the first entry is a genesis entry.
func (*Log) IsTerminus ¶ added in v0.3.0
IsTerminus returns true if the last entry is a terminus entry.
type RotationReason ¶ added in v0.3.0
type RotationReason string
const ( RotationSize RotationReason = "size_threshold" RotationTime RotationReason = "time_threshold" RotationManual RotationReason = "manual" )