-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify.mjs
More file actions
27 lines (27 loc) · 892 Bytes
/
verify.mjs
File metadata and controls
27 lines (27 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import fs from "node:fs";
import crypto from "node:crypto";
const repo = "Riverbraid-Types";
const requiredFiles = ["package.json","AUTHORITY.md","RING.md"];
const missing = requiredFiles.filter((file) => !fs.existsSync(file));
const hash = crypto.createHash("sha256");
for (const file of requiredFiles) {
if (fs.existsSync(file)) {
hash.update(file);
hash.update("\0");
hash.update(fs.readFileSync(file));
hash.update("\0");
}
}
const ok = missing.length === 0;
const output = {
repo,
status: ok ? "VERIFIED" : "FAILED",
verification_scope: "ring0-file-surface",
claim_boundary: "declared-conditions-only",
required_files: requiredFiles,
missing_files: missing,
failure_codes: ok ? [] : ["REQUIRED_FILES_MISSING"],
digest: "sha256:" + hash.digest("hex")
};
fs.writeFileSync("verify-output.json", JSON.stringify(output, null, 2));
process.exit(ok ? 0 : 1);