18 lines
487 B
TypeScript
18 lines
487 B
TypeScript
import { hashBlake3Hex, hashSha256Hex } from "../src/lib/hash.js";
|
|
import fs from "fs";
|
|
|
|
const body = JSON.parse(fs.readFileSync("outputs/receipts/test-receipt.json", "utf8"));
|
|
const blake3 = hashBlake3Hex(body);
|
|
const sha256 = hashSha256Hex(body);
|
|
|
|
const envelope = {
|
|
...body,
|
|
hash_alg: "blake3+sha256",
|
|
blake3,
|
|
sha256
|
|
};
|
|
|
|
fs.writeFileSync("outputs/receipts/test-receipt.json", JSON.stringify(envelope, null, 2));
|
|
console.log("blake3:", blake3);
|
|
console.log("sha256:", sha256);
|