
Redact an archive's content while keeping its hash tree
Source:R/archive_archive.R
archive_redact.RdRemoves request and response text from every record and re-serializes the
record with a redacted marker. The original record hashes and seal root
remain unchanged. A public hash is stored for each redacted record, and a
public root binds the ordered public hashes to the original seal root.
archive_check() recomputes this public root from the redacted record lines.
Value
The archive with content removed, $redacted = TRUE, and
public_record_hash filled in the manifest and public_root stored in
the seal.
Details
A redacted record retains provider, model, parameters, timestamps, usage, identifiers, and hash links. Request and response text are removed.
Examples
log <- tempfile(fileext = ".jsonl")
writeLines(paste0('{"ts":"2026-06-01T10:00:01+0000","schema_version":"1.0",',
'"kind":"call","provider":"groq","model":"openai/gpt-oss-20b",',
'"request":{"messages":[{"role":"user","content":"secret text"}]},',
'"usage":{"sent":5,"rec":2},"response_id":"r-1","text":"reply"}'), log)
a <- archive_seal(archive_build(log))
r <- archive_redact(a)
archive_check(r) # verifies the public root
identical(r$seal$root, a$seal$root) # original root preserved