Documentation
¶
Overview ¶
Package anchor writes the head of the audit chain somewhere the machine that keeps the log cannot rewrite. The chain shows every edit, deletion and insertion by itself; only a cut-off end needs an outside witness, and an anchor is that witness: a statement "the chain reached seq N with hash H at time T", kept in a file, posted to a webhook or timestamped in Bitcoin through OpenTimestamps. `agentgate verify --anchors` checks them all.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultCalendars = []string{"https://a.pool.opentimestamps.org", "https://b.pool.opentimestamps.org"}
DefaultCalendars are the public OpenTimestamps calendars. A proof from any one of them is enough; asking two keeps one outage from losing it.
Functions ¶
Types ¶
type Destination ¶
type Destination interface {
Publish(ctx context.Context, s Statement) (string, error)
String() string
}
Destination is where a statement goes. Parse reads one.
func Parse ¶
func Parse(s string, client *http.Client) (Destination, error)
Parse reads a destination:
https://example.com/hook POST the statement as JSON (an ntfy topic URL works) ots:./anchors stamp it with OpenTimestamps, keep the proof in the directory file:./anchors.jsonl append it to a file (also: a bare path)
type File ¶
type File struct{ Path string }
File appends statements to a file, one per line. Put it in a git repository, a synced folder or a mounted share and it is out of reach of whoever edits the log.
type OTS ¶
OTS stamps statements with OpenTimestamps: the statement's hash goes to public calendars, which commit it to the Bitcoin blockchain within hours. The proof is kept next to the statement as anchor-<seq>.json.ots; once the calendars have committed, `ots upgrade` completes it and `ots verify` shows the block that dates it, without trusting agentgate or this machine.
type Statement ¶
type Statement struct {
Seq int64 `json:"seq"`
Hash string `json:"hash"`
At time.Time `json:"at"`
Host string `json:"host,omitempty"`
Log string `json:"log,omitempty"`
}
Statement is one anchor.