Sealing every file of a folder under one signature, checking it, proving some files without the rest, bundling capsules and comparing two of them.
Each section is one help page: what its functions are for, and the
example of the page as it runs. ?name gives the arguments
and the value in full.
nqseal(), nqcheck(): A capsule is a signed
record of the exact files in a folder. nqseal() writes
noqtis.json (the manifest: every regular file with its
size, SHA-256 and SHA3-256) and noqtis.sig (the signature
over the manifest) into the folder. nqcheck() checks a
folder against its seal and reports every check.
d <- tempfile("capsule")
dir.create(d)
writeLines("hello", file.path(d, "a.txt"))
dir.create(file.path(d, "data"))
writeLines("1,2", file.path(d, "data", "b.csv"))
k <- nqkeygen("ML-DSA-44")
nqseal(d, k$sk, k$pk, "ML-DSA-44", meta = '{"project":"demo"}')
r <- nqcheck(d, k$pk)
r
#> check ok detail
#> 1 seal.read TRUE noqtis.sig
#> 2 seal.parse TRUE a JSON object
#> 3 seal.canonical TRUE canonical JSON
#> 4 seal.fields TRUE the fields of noqtis-seal-1
#> 5 seal.format TRUE "noqtis-seal-1"
#> 6 seal.alg TRUE ML-DSA-44
#> 7 seal.context TRUE "noqtis-capsule-1"
#> 8 seal.key TRUE a public key of the right size
#> 9 seal.signature TRUE a signature of the right size
#> 10 manifest.read TRUE noqtis.json
#> 11 manifest.digest TRUE SHA-256 of noqtis.json matches the seal
#> 12 key TRUE the seal's key is the trusted key
#> 13 signature TRUE ML-DSA-44 signature over noqtis.json is valid
#> 14 folder TRUE listed
#> 15 file TRUE a.txt
#> 16 file TRUE data/b.csv
#> 17 manifest.parse TRUE a JSON object
#> 18 manifest.canonical TRUE canonical JSON
#> 19 manifest.fields TRUE the fields of noqtis-capsule-1
#> 20 manifest.format TRUE "noqtis-capsule-1"
#> 21 manifest.created TRUE 2026-11-21T23:23:48Z
#> 22 manifest.order TRUE files sorted by path, no repeats
attr(r, "ok")
#> [1] TRUE
# a changed file fails its row, and the whole check
writeLines("hellO", file.path(d, "a.txt"))
r <- nqcheck(d, k$pk)
r[!r$ok, ]
#> check ok detail
#> 15 file FALSE a.txt: sha256 differs
attr(r, "ok")
#> [1] FALSE
# a partial check reads only the files named, and says so
r <- nqcheck(d, k$pk, only = "data/b.csv")
c(attr(r, "ok"), attr(r, "partial"))
#> [1] TRUE TRUE
# another key is refused
other <- nqkeygen("ML-DSA-44")
attr(nqcheck(d, other$pk), "ok")
#> [1] FALSE
unlink(d, recursive = TRUE)nqinspect(), nqsealwhy():
nqinspect() reads what the capsule in dir
says, with nothing checked (no digest, signature, timestamp or file):
its format, algorithm, key fingerprint, creation time, number of files
and bytes, whether it has a timestamp, and its meta.
nqsealwhy() says why nqseal() refused a
folder: the first thing in it a capsule cannot hold.
d <- file.path(tempdir(), "insp")
dir.create(d)
writeLines("hello", file.path(d, "a.txt"))
nqsealwhy(d)
#> NULL
k <- nqkeygen("ML-DSA-44")
nqseal(d, k$sk, k$pk, "ML-DSA-44")
nqinspect(d)
#> check ok
#> 1 seal.read TRUE
#> 2 seal.parse TRUE
#> 3 seal.canonical TRUE
#> 4 seal.fields TRUE
#> 5 seal.format TRUE
#> 6 seal.alg TRUE
#> 7 seal.context TRUE
#> 8 seal.key TRUE
#> 9 seal.signature TRUE
#> 10 manifest.read TRUE
#> 11 manifest.parse TRUE
#> 12 manifest.canonical TRUE
#> 13 manifest.fields TRUE
#> 14 manifest.format TRUE
#> 15 manifest.created TRUE
#> 16 manifest.order TRUE
#> 17 info.format TRUE
#> 18 info.alg TRUE
#> 19 info.key TRUE
#> 20 info.created TRUE
#> 21 info.files TRUE
#> 22 info.bytes TRUE
#> 23 info.timestamp TRUE
#> detail
#> 1 noqtis.sig
#> 2 a JSON object
#> 3 canonical JSON
#> 4 the fields of noqtis-seal-1
#> 5 "noqtis-seal-1"
#> 6 ML-DSA-44
#> 7 "noqtis-capsule-1"
#> 8 a public key of the right size
#> 9 a signature of the right size
#> 10 noqtis.json
#> 11 a JSON object
#> 12 canonical JSON
#> 13 the fields of noqtis-capsule-1
#> 14 "noqtis-capsule-1"
#> 15 2026-11-21T23:23:48Z
#> 16 files sorted by path, no repeats
#> 17 noqtis-capsule-1
#> 18 ML-DSA-44
#> 19 2e6475fe5c530c1cd96a3b68ac3e404a4a0f455d0b026f74243c1f2910a9769c
#> 20 2026-11-21T23:23:48Z
#> 21 1
#> 22 6
#> 23 none
unlink(d, recursive = TRUE)nqcapid(), nqfiles(),
nqprove(): nqcapid() gives a capsule’s id: the
SHA-256 of the bytes its seal signs, which nqseal() records
for its inputs. nqfiles() lists the files a
capsule’s manifest holds. Neither checks anything: use
nqcheck() for that.
d <- tempfile("proved")
dir.create(d)
writeLines("one", file.path(d, "a.txt"))
writeLines("two", file.path(d, "b.txt"))
k <- nqkeygen("ML-DSA-44")
nqseal(d, k$sk, k$pk, "ML-DSA-44", format = 2)
nqfiles(d)
#> path size sha256
#> 1 a.txt 4 2c8b08da5ce60398e1f19af0e5dccc744df274b826abe585eaba68c525434806
#> 2 b.txt 4 27dd8ed44a83ff94d557f9fd0412ed5a8cbca69ea04922d88c01184a07300a5a
p <- nqprove(d, "a.txt")
grepl("b.txt", rawToChar(p), fixed = TRUE)
#> [1] FALSE
attr(nqcheck(NULL, k$pk, proof = p), "ok")
#> [1] TRUE
nqcapid(d)
#> [1] 97 21 c1 9c 4e ac eb c0 c2 6f 13 d6 64 1a da 09 2c 85 67 de e9 34 e9 5c 72 d4 33 6e
#> [29] 4f 5f 74 6a
unlink(d, recursive = TRUE)nqpack(), nqunpack(),
nqcheckpack(), nqchain():
nqpack() writes the capsule in dir as one file
(noqtis-bundle-1, the format of noqtis pack): its seal,
manifest, evidence record and every listed file, or with
files = FALSE only its data record; the same folder gives
the same bytes. nqunpack() reads a bundle into a new
folder, refusing it whole when any path or size is not one a capsule
holds. nqcheckpack() checks the capsule in a bundle in
place: it is unpacked to a temporary folder, checked with
nqcheck() and removed. nqchain() checks an
append-only chain of capsules, oldest first: each sealed in format 2
with the one before as its only input, all by the first one’s key.
d <- file.path(tempdir(), "pk")
dir.create(d)
writeLines("hello", file.path(d, "a.txt"))
k <- nqkeygen("ML-DSA-44")
nqseal(d, k$sk, k$pk, "ML-DSA-44")
b <- tempfile(fileext = ".nqb")
nqpack(d, b)
attr(nqcheckpack(b, k$pk), "ok")
#> [1] TRUE
u <- file.path(tempdir(), "pku")
nqunpack(b, u)
list.files(u)
#> [1] "a.txt" "noqtis.json" "noqtis.sig"
unlink(c(d, u), recursive = TRUE)
unlink(b)nqdiff(): The files added, removed or changed between
the two capsules’ manifests (when both are sealed), and what differs in
their data records: sources, schemas, summaries (counts, medians, PSI
between them), environment, steps, checks, commitments and citation.
Nothing is checked: run nqcheck() and
nqdcheck() first.
a <- file.path(tempdir(), "da")
b <- file.path(tempdir(), "db")
dir.create(a)
dir.create(b)
writeLines("x", file.path(a, "f.txt"))
writeLines("y", file.path(b, "f.txt"))
nqdadd(a, "f.txt")
nqdadd(b, "f.txt")
nqdiff(a, b)
#> what differs
#> 1 manifest FALSE
#> 2 source TRUE
#> detail
#> 1 neither is sealed: files not compared
#> 2 f.txt: sha256 "73cb3858a687a8494ca3323053016282f3dad39d42cf62ca4e79dda2aac... -> "3bb2abb69ebb27fbfe63c7639624c6ec5e331b841a5bc8c3ebc10b9285e...
unlink(c(a, b), recursive = TRUE)