guanghu-ice-heart/routing/persona-control-authorization-signers.test.js

27 lines
1.4 KiB
JavaScript

import assert from "node:assert/strict";
import fs from "node:fs";
import path from "node:path";
import test from "node:test";
import { fileURLToPath } from "node:url";
const directory = path.dirname(fileURLToPath(import.meta.url));
const registry = JSON.parse(fs.readFileSync(path.join(directory, "persona-control-authorization-signers.json"), "utf8"));
const anchor = JSON.parse(fs.readFileSync(path.join(directory, "public-navigation-anchor.json"), "utf8"));
test("the persona-control authorization registry is authoritative but trusts nobody before key governance exists", () => {
assert.deepEqual(Object.keys(registry), ["schema", "registryId", "state", "signers"]);
assert.equal(registry.schema, "gh-aios.persona-control-authorization-signers/v1");
assert.equal(registry.registryId, "GH-AIOS-PERSONA-CONTROL-AUTHORIZATION-SIGNERS-001");
assert.equal(registry.state, "CURRENT");
assert.deepEqual(registry.signers, []);
assert.doesNotMatch(JSON.stringify(registry), /PRIVATE KEY|password|token|secret/i);
});
test("the public anchor declares the exact persona-control signer registry path", () => {
assert.deepEqual(anchor.maps.persona_control_authorization_signers, {
path: "routing/persona-control-authorization-signers.json",
id: "GH-AIOS-PERSONA-CONTROL-AUTHORIZATION-SIGNERS-001",
schema: "gh-aios.persona-control-authorization-signers/v1",
state: "CURRENT_EMPTY_NO_TRUSTED_SIGNER"
});
});