githolon 0.97.2 → 0.97.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev-server.mjs +37 -15
- package/package.json +3 -3
package/dist/dev-server.mjs
CHANGED
|
@@ -1674,6 +1674,7 @@ async function bootstrapPlatform(dev, opts) {
|
|
|
1674
1674
|
);
|
|
1675
1675
|
} else {
|
|
1676
1676
|
let devIdP;
|
|
1677
|
+
let pendingIdP;
|
|
1677
1678
|
{
|
|
1678
1679
|
const { generateKeyPairSync, sign: nodeSign } = await import("node:crypto");
|
|
1679
1680
|
const { privateKey, publicKey } = generateKeyPairSync("ec", { namedCurve: "P-256" });
|
|
@@ -1688,22 +1689,25 @@ async function bootstrapPlatform(dev, opts) {
|
|
|
1688
1689
|
const si = `${header}.${payload}`;
|
|
1689
1690
|
return `${si}.${b64url(nodeSign("sha256", Buffer.from(si), { key: privateKey, dsaEncoding: "ieee-p1363" }))}`;
|
|
1690
1691
|
};
|
|
1691
|
-
const
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
homeDomain
|
|
1696
|
-
"setAuthProvider"
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1692
|
+
const apPayload = { issuer: ISS, keys: JWKS, audience: AUD, principalClaim: "sub", deviceBindingClaim: "nonce" };
|
|
1693
|
+
try {
|
|
1694
|
+
const deployBody = opts.deploy ? JSON.parse(readFileSync(opts.deploy, "utf8")) : null;
|
|
1695
|
+
const iface = deployBody?.interface ?? {};
|
|
1696
|
+
const domIface = iface.domains?.[homeDomain] ?? iface[homeDomain];
|
|
1697
|
+
const fields = domIface?.directives?.["setAuthProvider"]?.fields ?? {};
|
|
1698
|
+
for (const [name, spec] of Object.entries(fields)) {
|
|
1699
|
+
if (spec?.optional === true || apPayload[name] !== void 0) continue;
|
|
1700
|
+
if (spec?.kind === "int" && /At$/.test(name)) apPayload[name] = Date.now();
|
|
1701
|
+
else if (spec?.kind === "string" && /At$/.test(name)) apPayload[name] = (/* @__PURE__ */ new Date()).toISOString();
|
|
1702
|
+
else if (spec?.kind === "string" && /By$/.test(name)) apPayload[name] = OPERATOR;
|
|
1703
|
+
else if (spec?.kind === "string" && /url$/i.test(name)) apPayload[name] = `${ISS}/jwks.json`;
|
|
1704
|
+
else if (spec?.kind === "string") apPayload[name] = "dev";
|
|
1705
|
+
else log2(`dev test IdP: required setAuthProvider field '${name}' (kind ${spec?.kind}) is not synthesizable \u2014 the author below may refuse typed`);
|
|
1706
|
+
}
|
|
1707
|
+
} catch (e) {
|
|
1708
|
+
log2(`dev test IdP: BYO-shape fill failed (${errMsg(e).slice(0, 200)}) \u2014 the canonical payload stands`);
|
|
1706
1709
|
}
|
|
1710
|
+
pendingIdP = { ISS, AUD, JWKS, mint, apPayload };
|
|
1707
1711
|
}
|
|
1708
1712
|
const sOp = authorKeygen(eng);
|
|
1709
1713
|
const opKeyHash = createHash("sha256").update(Buffer.from(sOp.public, "base64")).digest("hex");
|
|
@@ -1736,6 +1740,24 @@ async function bootstrapPlatform(dev, opts) {
|
|
|
1736
1740
|
});
|
|
1737
1741
|
if (!warrant.ok) throw new Error(`platform WARRANT (seedGenesis) REFUSED: ${String(warrant.error).slice(0, 400)}`);
|
|
1738
1742
|
dev.operatorDevice = sOp;
|
|
1743
|
+
if (pendingIdP) {
|
|
1744
|
+
const ap = await serialize(async () => authorOn(
|
|
1745
|
+
eng,
|
|
1746
|
+
platform,
|
|
1747
|
+
ledgerFor(platform),
|
|
1748
|
+
homeDomain,
|
|
1749
|
+
"setAuthProvider",
|
|
1750
|
+
pendingIdP.apPayload,
|
|
1751
|
+
lawHash,
|
|
1752
|
+
{ actor: OPERATOR, principalVerified: true, authorSecret: sOp.secret }
|
|
1753
|
+
));
|
|
1754
|
+
if (ap.ok) {
|
|
1755
|
+
devIdP = { issuer: pendingIdP.ISS, audience: pendingIdP.AUD, jwks: pendingIdP.JWKS, mint: pendingIdP.mint };
|
|
1756
|
+
log2(`dev test IdP registered (setAuthProvider ${pendingIdP.ISS}, aud ${pendingIdP.AUD}) \u2014 mint tokens via POST /dev/mint-token`);
|
|
1757
|
+
} else {
|
|
1758
|
+
log2(`dev test IdP NOT registered \u2014 setAuthProvider refused (payload keys: ${Object.keys(pendingIdP.apPayload).join(",")}): ${String(ap.error).slice(0, 600)}`);
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1739
1761
|
dev.testIdP = devIdP;
|
|
1740
1762
|
log2(`root-attested platform: enrolled founding device ${opKeyHash.slice(0, 12)}\u2026, seeded BirthAttestation (platform_cert signed by K_root, P_P=${sP.public.slice(0, 12)}\u2026), WARRANTED (self-id ${platform})`);
|
|
1741
1763
|
log2(" a birthHome under this platform now assembles [home_cert, u_delegation(S_P), platform_cert(K_root)] \u2014 no unwarranted-cert.");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "githolon",
|
|
3
|
-
"version": "0.97.
|
|
3
|
+
"version": "0.97.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "githolon — the Nomos developer CLI: Rails-style generators for @githolon/dsl domains + the package compiler. Kernel-independent.",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@bjorn3/browser_wasi_shim": "0.4.2",
|
|
32
|
-
"@githolon/client": "^0.97.
|
|
33
|
-
"@githolon/dsl": "^0.97.
|
|
32
|
+
"@githolon/client": "^0.97.4",
|
|
33
|
+
"@githolon/dsl": "^0.97.4",
|
|
34
34
|
"isomorphic-git": "^1.38.4"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|