nx_packmirror.nx
buildroot/runtime/nx_packmirror.nx
about
nx_packmirror.nx -- THE PACK ARCHIVE ORGAN (debt 1787064637). Walks a pCloud-publink manifest and
mirrors EVERY file entry into <destdir> over the sovereign TLS stack, verifying each written file
against the manifest's declared byte size. COMPOSES the proven lanes: nx_packmirror_lib (parse +
verify core, gate-proven), nx_https_fetch_follow (the research_fetch TLS lane), the Mozilla trust
store. RESUMABLE: a dest already at its declared size is SKIPPED, so a re-run drains stragglers --
that is the retry story (one attempt per file per run, no in-run backoff duplication).
FAIL-CLOSED: a size mismatch keeps the evidence as <name>.partial and counts REFUSED; a body that
fills the reserve to the brim is REFUSED-TRUNCATED unread (the RF_BODY_CAP witness, same law).
THE RECEIPTS PARTITION MUST SUM: seen = fetched + skipped + refused (+ unparsed alongside), printed
with the reconciliation -- a partition that does not sum exits RED on itself.
usage: nx_packmirror <manifest.json> <publink-code> <destdir> (mirror, pCloud dialect)
nx_packmirror verify <pcloud|thread|bepis> <manifest.json> <destdir> (population byte-verify, no fetch)
exit: 0 all clean | 1 refused/unparsed/partition-leak | 2 usage | 3 manifest unreadable | 4 trust store
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 7 imports · 0 importers
imports: nx_syscalls.nxnx_packmirror_lib.nxnx_tool_run.nxnx_base64.nxnx_x509_trust_store.nxnx_trust_store_load_from_certdata.nxnx_https_fetch_follow.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
| 23 | const PMC_MANIFEST_CAP: i64 = 1048576 // a publink manifest measures ~50KB; filling this REFUSES loudly below |
| 24 | const PMC_CERTDATA_CAP: i64 = 4194304 // Mozilla certdata.txt reserve (its own, never shared) |
| 28 | const PMC_BODY_CAP: i64 = 134217728 |
| 29 | const PMC_LINK_CAP: i64 = 65536 // getpublinkdownload JSON (~400B observed) |
| 30 | const PMC_URL_CAP: i64 = 2048 |
| 31 | const PMC_PATH_CAP: i64 = 1024 |
| 32 | const PMC_MODE_FILE: i64 = 420 // 0644 |
| 33 | const PMC_MODE_DIR: i64 = 493 // 0755 |
| 34 | const PMC_REDIRECTS: i64 = 6 // the research_fetch lane's proven follow depth |
| 116 | const PMC_HEX_0: i64 = 48 // '0' -- lowercase-hex emission base for digits |
| 117 | const PMC_HEX_A: i64 = 87 // 'a' - 10 -- lowercase-hex emission base for a..f |
| 118 | const PMC_RAW32: i64 = 32 // a sha256 digest is exactly 32 raw bytes; any other decode length is a bad pin |
| 119 | const PMC_HEXCAP: i64 = 80 // 64 hex chars + NUL, with margin |
| 120 | const PMC_HASHOUT: i64 = 4096 // nx_filehash JSON output reserve (observed ~120 B) |
functions
| 36 | func pc_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 37 | func pc_n(v: i64) -> i64 |
| 49 | func pc_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { d[o+i] = s[i]; i = i + 1 } d[o+i] = 0 as u8; return o + i } |
| 50 | func pc_catn(d: *u8, o: i64, v: i64) -> i64 calls 1: sys_mmap |
| 64 | func pc_jstr(buf: *u8, at: i64, end: i64, key: *u8, dst: *u8, dcap: i64) -> i64 |
| 89 | func pc_read_file(path: *u8, buf: *u8, cap: i64) -> i64 |
| 101 | func pc_write_file(path: *u8, buf: *u8, n: i64) -> i64 |
| 114 | func pc_eq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] != (0 as u8) { if a[i] != b[i] { return 0 } i = i + 1 } if b[i] != (0 as u8) { return 0 } return 1 } |
| 121 | func pc_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: pc_pin_ok |
| 124 | func pc_hex(raw: *u8, n: i64, out: *u8) -> i64 called by 1: pc_pin_ok |
| 140 | func pc_pin_ok(path: *u8, hb64: *u8) -> i64 |
| 161 | func pc_verify(dialect: *u8, mpath: *u8, dest: *u8) -> i64 |
| 230 | func main(argc: i64, argv: *i64) -> i64 |