code wiki / _hdl_build / nx_connect_idage.nx

nx_connect_idage.nx

buildroot/runtime/_hdl_build/nx_connect_idage.nx

9447 B170 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic connect
docsdependenciesstructsconstsfunctions

about

nx_connect_idage.nx -- R3 of CONNECT: the SAFETY SPINE -- privacy-preserving age assurance + re-registration-resistant identity. This closes the gap that R1/R2's minor<->romance walls currently TRUST self-declared age. The honest exceed axes: PRIVACY-PRESERVING (vs Tinder/Bumble ID-hoarding) and RE-REG-RESISTANT (vs Tandem's defeated photo-verify, banned users re-register). PROTOCOL (what this rung proves, by construction): 1. A trusted issuer attests only an AGE BAND (adult/minor) -- never sends us DOB/name/ID. 2. We VERIFY the attestation, then derive a SERVICE-SCOPED pseudonym from the issuer's subject ref + our secret service salt, and STORE ONLY {age_band, scoped_pseudonym}. Raw PII never reaches us; the issuer's subject ref is never stored (only the one-way scoped pseudonym). 3. UNLINKABILITY: the same person at a DIFFERENT service gets a DIFFERENT, uncorrelatable pseudonym (service-scoping). STABILITY within our service enables re-reg resistance. 4. RE-REG RESISTANCE: bans are keyed by the scoped pseudonym (bound to verified identity), so a banned user cannot evade by changing email/device -- only by defrauding the issuer. HONESTY (no overclaim): the issuer attestation is checked here with a SYMMETRIC keyed-hash MAC as a STAND-IN for the production ASYMMETRIC issuer signature (ecosystem ed25519 verify w/ issuer public key), and pseudonyms use a modular multiplicative hash as a STAND-IN for a CRYPTOGRAPHIC hash (ecosystem SHA-256/BLAKE) for true preimage/collision resistance. Both are NAMED FOLLOW-ONS. This rung proves the PRIVACY ARCHITECTURE (minimization, service-scoped unlinkability, identity- bound banning) -- NOT cryptographic strength -> census cells flip to PRESENT, never PARITY/EXCEEDS. 8 checks incl. 3 negative controls. 100% sovereign. license_tier: ORIGINAL expect_exit: 0

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_connect_idage.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap band_from_year attest_mac hmix modp verify_attest attest_mac ↻ pseudo hmix ↻ sw sys_write sn sys_mmap ↻ sys_write ↻ tcheck sw ↻ naive_id is_member sys_exit

structs

none

consts

24const ADULT_MAGIC_1000000: i64 = 1000000
25const ADULT_MAGIC_1990: i64 = 1990
26const ADULT_MAGIC_2010: i64 = 2010
27const ADULT_MAGIC_31337: i64 = 31337
28const ADULT_MAGIC_55555: i64 = 55555
29const ADULT_MAGIC_99999: i64 = 99999
30const ADULT_MAGIC_700001: i64 = 700001
31const ADULT_MAGIC_700002: i64 = 700002
33const HP: i64 = 1000000007 // hash modulus (prime). production: 256-bit cryptographic hash.
34const HA: i64 = 2654435761
35const HB: i64 = 2246822519
36const HC: i64 = 540041351
37const HD: i64 = 700000001
38const ADULT_AGE: i64 = 18
39const NOW_YEAR: i64 = 2026
40const BAND_ADULT: i64 = 1
41const BAND_MINOR: i64 = 0

functions

43func sw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 2: tcheckmain calls 1: sys_write
44func sn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1} sys_write(1,bb,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
46func modp(h: i64) -> i64 { return h - (h/HP)*HP } // h positive throughout
called by 1: hmix
49func hmix(x: i64) -> i64
called by 2: pseudoattest_mac calls 1: modp
58func pseudo(subject: i64, salt: i64) -> i64
called by 1: main calls 1: hmix
64func naive_id(subject: i64, salt: i64) -> i64 { return subject }
called by 1: main
67func attest_mac(subject: i64, band: i64, secret: i64) -> i64 { return hmix(subject + band*ADULT_MAGIC_1000000 + secret) }
called by 2: verify_attestmain calls 1: hmix
68func verify_attest(subject: i64, band: i64, secret: i64, presented: i64) -> i64
called by 1: main calls 1: attest_mac
74func band_from_year(birth_year: i64, now_year: i64, adult_age: i64) -> i64
called by 1: main
79func is_member(p: i64, set: *i64, n: i64) -> i64
called by 1: main
85func tcheck(pass: i64, label: *u8, fails: *i64) -> i64
called by 1: main calls 1: sw
91func main() -> i64