code wiki / _hdl_build / nx_pub_receipt_keys.nx

nx_pub_receipt_keys.nx

buildroot/runtime/_hdl_build/nx_pub_receipt_keys.nx

2835 B43 linesdepth 9pulls 14 transitivereach 2 importersview sourcekind librarytopic pub
docsdependenciesstructsconstsfunctions

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

nx_csprng.nx nx_ed25519_signature.nx nx_syscalls.nx nx_pub_receipt_keys.nx nx_pub_receipt_keys_gate.nx nx_pub_receipt_loop.nx

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

11func 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
12func 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
13func 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 }
called by 1: prk_pub_load calls 1: prk_unhex1
17func prk_load_or_init(privpath: *u8, pubpath: *u8, out_priv32: *u8, out_pub32: *u8) -> i64
36func prk_pub_load(pubpath: *u8, out_pub32: *u8) -> i64