code wiki / _hdl_build / nx_live_verify.nx
nx_live_verify.nx source
↩ module page · 78 lines · 4913 B
1// nx_live_verify.nx -- the NISHI TEAM's "what is ACTUALLY live" capability, built so the false-ship
2// mistake CANNOT recur (operator 2026-06-23: build the team so this can't happen again -- don't memory
3// it). I false-shipped because I "verified" a deploy by grepping a string BOTH clients share. This organ
4// fetches the LIVE url over the SOVEREIGN TLS stack (no curl) and checks for SPECIFIC markers (no grep),
5// so the team can prove what bytes the world is actually served -- and which client serves /video/.
6// Reuses nx_https_fetch_follow + the Mozilla trust store (the proven nx_connect_research_fetch path).
7// 100% sovereign (own TLS, nx_cc->nxasm). main() = the gate. license_tier: ORIGINAL
8import "nx_syscalls.nx"
9import "nx_x509_trust_store.nx"
10import "nx_trust_store_load_from_certdata.nx"
11import "nx_https_fetch_follow.nx"
12const K_MAGIC_4194304: i64 = 4194304
13
14func lv(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
15func lvn(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 }
16func slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
17// count occurrences of needle in hay[0..n)
18func count_in(hay: *u8, n: i64, needle: *u8) -> i64 {
19 let m: i64 = slen(needle)
20 if m == 0 { return 0 }
21 var c: i64=0; var i: i64=0
22 while i + m <= n {
23 var j: i64=0; var ok: i64=1
24 while j < m { if hay[i+j] != needle[j] { ok=0; j=m } else { j=j+1 } }
25 if ok==1 { c=c+1 }
26 i=i+1
27 }
28 return c
29}
30func report(label: *u8, hay: *u8, n: i64, needle: *u8) -> i64 {
31 lv(" "); lv(label); lv(" = "); lvn(count_in(hay, n, needle)); lv("\n")
32 return 0
33}
34
35func main() -> i64 {
36 let r: i64 = nx_trust_store_load_from_certdata("data/mozilla_certdata.txt" as *u8, 512, K_MAGIC_4194304)
37 if r <= 0 { lv("LIVEVERIFY: certdata load failed\n" as *u8); return 1 }
38 let store: *TrustStore = r as *TrustStore
39 let cap: i64 = K_MAGIC_4194304
40 let out: *u8 = sys_mmap(cap)
41 let status: *i64 = sys_mmap(8) as *i64
42
43 lv("=== nx_live_verify -- what is ACTUALLY served at nishifamily.com/video (sovereign TLS, no curl/grep) ===\n")
44
45 // 1. the page
46 let np: i64 = nx_https_fetch_follow("https://nishifamily.com/video/" as *u8, store, out, cap, 6, status)
47 lv(" /video/ status="); lvn(status[0]); lv(" bytes="); lvn(np); lv("\n")
48 report("loads app.js (<script src=app.js>)" as *u8, out, np, "app.js" as *u8)
49 report("is vroom_client (post? relay route)" as *u8, out, np, "post?" as *u8)
50 report("FPS=15 config (the client I edited)" as *u8, out, np, "FPS=15" as *u8)
51 // the camera-mirror CSS lives in the PAGE (index.html), NOT app.js -- check it while `out` still holds the page
52 let css_mir: i64 = count_in(out, np, "scaleX(-1" as *u8)
53 let css_self: i64 = count_in(out, np, ".tile.self" as *u8)
54 lv(" [index.html] mirror CSS scaleX(-1)="); lvn(css_mir); lv(" .tile.self rule="); lvn(css_self); lv("\n")
55
56 // 2. the real client logic: app.js -- the self tile must carry the 'tile self' class so the CSS targets it
57 let na: i64 = nx_https_fetch_follow("https://nishifamily.com/video/app.js" as *u8, store, out, cap, 6, status)
58 lv(" /video/app.js status="); lvn(status[0]); lv(" bytes="); lvn(na); lv("\n")
59 let tile_self: i64 = count_in(out, na, "tile self" as *u8)
60 let flip: i64 = count_in(out, na, "flipSend" as *u8)
61 report("getUserMedia (capture)" as *u8, out, na, "getUserMedia" as *u8)
62 report("facingMode user (front cam)" as *u8, out, na, "facingMode" as *u8)
63 lv(" [app.js] self-tile class 'tile self'="); lvn(tile_self); lv(" flipSend(TX-toggle, RUNG 1)="); lvn(flip); lv("\n")
64
65 lv(" ---- VERDICT (sovereign, byte-true) ----\n")
66 // the self-view mirror needs BOTH halves live: the CSS rule in index.html AND the 'tile self' class in app.js
67 var cam_fix_live: i64 = 0
68 if css_mir > 0 { if tile_self > 0 { cam_fix_live = 1 } }
69 if cam_fix_live == 1 { lv(" CAMERA-FLIP FIX IS LIVE in /video/app.js (markers served). \n" as *u8) }
70 else { lv(" CAMERA-FLIP FIX IS NOT LIVE -- the served app.js has NO mirror handling. Any 'fix' not showing here is NOT deployed.\n" as *u8) }
71 lv(" TEAM RULE (now an organ, not a memory note): a deploy is DONE only when nx_live_verify finds THIS edit's unique marker in the served bytes.\n")
72
73 // GREEN = the verify capability ran and produced a byte-true answer (NOT 'the fix is live').
74 if na > 0 { lv("LIVEVERIFY: GREEN (capability works; live state measured byte-true). cam_fix_live="); lvn(cam_fix_live); lv("\n"); sys_exit(0) }
75 lv("LIVEVERIFY: RED (could not fetch the live app.js)\n")
76 sys_exit(1)
77 return 0
78}