nx_cap_keygen_gate.nx
buildroot/runtime/nx_cap_keygen_gate.nx
about
nx_cap_keygen_gate.nx -- proves nx_cap_keygen provisions a REAL CSPRNG signing secret that (a) is 256-bit hex,
(b) lands on disk 0600 byte-exact with no trailing newline, (c) has real entropy (two draws differ), (d) is
fail-safe (refuses a silent overwrite), and -- the composition that matters -- (e) actually WORKS as an HMAC
signing key: a capability minted with it VERIFIES, and (f) is independent: a token signed by one key is DENIED
under another (unforgeable across keys). Closes GAP 2 of the MCP grant and ties it to GAP 1 (mint) + verify.
license_tier: ORIGINAL expect_exit: 0
dependencies 3 imports · 0 importers
imports: nx_cap_keygen.nxnx_cap_token.nxnx_gate.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 11 | const KG_PATH: *u8 = "/tmp/nx_capkeygen_gate.key" as *u8 |
functions
| 13 | func kg_is_hex(c: i64) -> i64 { if c >= 48 { if c <= 57 { return 1 } } if c >= 97 { if c <= 102 { return 1 } } return 0 } called by 1: kg_all_hex |
| 14 | func kg_all_hex(s: *u8, n: i64) -> i64 { var i: i64 = 0; while i < n { if kg_is_hex(s[i] as i64) == 0 { return 0 } i = i + 1 } return 1 } |
| 15 | func kg_eqn(a: *u8, b: *u8, n: i64) -> i64 { var i: i64 = 0; while i < n { if a[i] != b[i] { return 0 } i = i + 1 } return 1 } called by 1: main |
| 17 | func kg_expect(actual: i64, expected: i64, pass: *i64, tot: *i64, label: *u8) -> i64 |
| 24 | func main() -> i64 |