code wiki / _hdl_build / nx_pub_receipt_keys.nx
nx_pub_receipt_keys.nx
buildroot/runtime/_hdl_build/nx_pub_receipt_keys.nx
about
nx_pub_receipt_keys.nx -- the publisher's STABLE receipt-signing IDENTITY (makes the receipt non-repudiation REAL,
not a per-run demo). For an Ed25519-signed receipt to MEAN anything, the publisher must have ONE durable signing
keypair whose PUBLIC key is published + discoverable, so ANY submitter can verify a receipt across runs without
trusting the issuer. Generate-once (idempotent, #10): if the private seed exists, load it; else CSPRNG-generate it,
persist it 0600 (crown jewel, never logged/leaked), derive the public key, and PUBLISH the public key as hex.
priv = 32 raw bytes (the Ed25519 seed) at privpath, mode 0600 ; pub = 64 hex at pubpath, world-readable.
dependencies 3 imports · 2 importers
imports: nx_csprng.nxnx_ed25519_signature.nxnx_syscalls.nx
imported by: nx_pub_receipt_keys_gate.nxnx_pub_receipt_loop.nx
structs
| none |
consts
| none |
functions
| 11 | func prk_hexenc(inp: *u8, n: i64, out: *u8) -> i64 { let hx: *u8="0123456789abcdef" as *u8; var i: i64=0; while i<n { out[i*2]=hx[((inp[i] as i64)>>4)&15]; out[i*2+1]=hx[(inp[i] as i64)&15]; i=i+1 } out[n*2]=0 as u8; return n*2 } called by 1: prk_load_or_init |
| 12 | func prk_unhex1(c: i64) -> i64 { if c>=48 { if c<=57 {return c-48} } if c>=97 { if c<=102 {return c-87} } if c>=65 { if c<=70 {return c-55} } return 0 } called by 1: prk_unhex |
| 13 | func prk_unhex(inp: *u8, n: i64, out: *u8) -> i64 { var i: i64=0; while i<n { out[i]=((prk_unhex1(inp[i*2] as i64)<<4)|prk_unhex1(inp[i*2+1] as i64)) as u8; i=i+1 } return n } |
| 17 | func prk_load_or_init(privpath: *u8, pubpath: *u8, out_priv32: *u8, out_pub32: *u8) -> i64 |
| 36 | func prk_pub_load(pubpath: *u8, out_pub32: *u8) -> i64 |