
Verify Cryptographic Integrity and Signature of a Capsule Manifest
Source:R/manifest.R
verify_manifest_integrity.RdRecomputes the canonical SHA-256 content_digest over the manifest body to
detect any tampering with project metadata, environment specifications, RNG
seeds, artifact hashes, or tolerances. If the manifest is signed or a key
is supplied, also verifies the HMAC-SHA256 signature using constant-time
comparison.
Value
An S3 object of class rcapsule_integrity with fields:
valid: logical (TRUEonly if both content digest and signature checks pass)content_valid: logicalsigned: logical (whether the manifest carries a signature)signature_valid: logical orNA(when unsigned and nokeygiven)recorded_digest,computed_digest: SHA-256 hex stringsissues: character vector describing any integrity failures
Examples
tmp <- tempfile("rcapsule_int_")
dir.create(tmp)
writeLines("x <- 1", file.path(tmp, "run.R"))
m <- create_capsule_manifest(tmp, key = "secret")
verify_manifest_integrity(m, key = "secret")
#>
#> ── rcapsule Manifest Integrity: VALID ──────────────────────────────────────────
#> • Content digest: OK (bb9d5242f725)
#> • Signed: TRUE | Signature check: TRUE
unlink(tmp, recursive = TRUE)