feat: add evidence hashing (internal/evidence)

SHA-256 over raw asset bytes and over the canonical JSON form of
metadata (encoding/json already sorts map keys and preserves struct
field order deterministically, so no separate canonicalization library
is needed for our own fixed types). A Timestamper interface stands in
for the RFC-3161 timestamp step — no concrete implementation yet, since
which TSA to use is an open decision (CLAUDE.md "Offene Punkte") that
directly affects the archive's evidentiary weight, not a purely
technical choice to make silently.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
noroot
2026-08-27 13:54:29 +02:00
parent 15bf277bee
commit d54636f57a
3 changed files with 117 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
package evidence
import "context"
// Timestamper fragt einen RFC-3161-Zeitstempel für einen Hash (i. d. R.
// aus HashBytes/HashMetadata) bei einer Time-Stamp Authority (TSA) an
// und liefert den rohen Zeitstempel-Token zurück, wie er unverändert in
// evidence_package.timestamp_token gespeichert wird.
//
// Es gibt hier bewusst noch keine konkrete Implementierung: welche TSA
// verwendet wird, ist in CLAUDE.md als offener Punkt vermerkt (freie
// TSA vs. eIDAS-qualifizierter Zeitstempeldienst — das betrifft direkt
// die Beweiskraft des Archivs und ist keine rein technische
// Entscheidung). Sobald das geklärt ist, implementiert ein konkreter
// Typ dieses Interface.
type Timestamper interface {
Timestamp(ctx context.Context, hash []byte) (token []byte, err error)
}