nx_nexus_fetch.nx
buildroot/runtime/nx_nexus_fetch.nx
about
nx_nexus_fetch.nx -- THE NEXUS MODS API DOOR (/compare/modding MD28, 2026-09-05): the modder's OWN API key, from the
sovereign vault, over our own TLS, against api.nexusmods.com -- never a scraper through the mod page's Cloudflare
challenge (measured 2026-09-05: nexusmods.com/skyrimspecialedition/mods/54994 answers the sovereign fetcher 403
Cf-Mitigated challenge, 8,279 B), never a bundled third-party client.
THE FETCH LADDER IS THE SPINE'S OWN: nx_https_fetch_follow_hdr_best -- minimal TLS-1.3 hello, then the Chrome-JA3
hello, then TLS-1.2 -- with the api header injected into every 1.3 request. MEASURED 2026-09-06: the single-hello
path (nx_https_fetch_hdr) completed the handshake with api.nexusmods.com and received ZERO application bytes
(nrecs=1), which is what a fingerprint-gated CDN does to a bare client; the ladder exists for exactly that host class.
THE KEY NEVER TOUCHES ARGV, STDOUT, A JOURNAL OR A LOG: it is opened by the estate's secret CLI
(nx_secret get nexus_api -> /tmp/nxsecret.out, machine-bound AES-128-GCM vault), read once, used to build one request
header, then the buffers are zeroed and the plaintext file is overwritten and unlinked. validate.json ECHOES the key in
its body, so that body is never printed -- only the fields named below.
usage: nx_nexus_fetch validate
nx_nexus_fetch info <game_domain> <mod_id>
nx_nexus_fetch files <game_domain> <mod_id>
nx_nexus_fetch link <game_domain> <mod_id> <file_id> [nxm_key nxm_expires]
nx_nexus_fetch fetch <game_domain> <mod_id> <file_id> <out-path> [nxm_key nxm_expires]
exits: 0 ok | 2 usage | 3 NO-KEY (the vault could not open nexus_api) | 4 NET (the ladder returned nothing: bad url,
trust, connect or every hello refused) | 5 HTTP (a status other than 200 -- the body's first bytes are printed,
they carry the API's own reason) | 6 UNPARSED (200 but the named field is absent -- printed as absent, never
invented)
Every receipt is one line per record with key=value fields; the download receipt carries the sha256 of the bytes it
wrote, sized from the file's DECLARED size_kb (an output buffer derived from the input, never a guessed cap).
license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
dependencies 7 imports · 0 importers
imports: nx_syscalls.nxnx_x509_trust_store.nxnx_trust_store_load_from_certdata.nxnx_https_fetch_follow.nxnx_tool_run.nxnx_media_state.nxnx_sha256.nx
imported by: nobody (leaf or entry point)
structs
| none |
consts
| 33 | const NF_API: *u8 = "https://api.nexusmods.com/v1/" |
| 34 | const NF_SECRET_CLI: *u8 = "_offc/nx_secret_cli.elf" |
| 35 | const NF_SECRET_NAME: *u8 = "nexus_api" |
| 36 | const NF_SECRET_OUT: *u8 = "/tmp/nxsecret.out" |
| 37 | const NF_CERTDATA: *u8 = "data/mozilla_certdata.txt" |
| 38 | const NF_TRUST_MAX_CERTS: i64 = 512 // the fetch spine's own trust-store load parameters (nx_https_fetch.nx) |
| 39 | const NF_TRUST_RESERVE: i64 = 4194304 |
| 40 | const NF_MAX_HOPS: i64 = 5 |
| 41 | const NF_OUT_CAP: i64 = 4194304 // one API body; the spine REFUSES a body that does not fit, it never truncates silently |
| 42 | const NF_URL_CAP: i64 = 2048 |
| 43 | const NF_HDR_CAP: i64 = 2048 |
| 44 | const NF_KEY_CAP: i64 = 512 |
| 45 | const NF_CLI_CAP: i64 = 8192 |
| 46 | const NF_CLI_TMO_MS: i64 = 180000 // the machine-key derive is argon2id at 32 MiB, measured ~40 s on the NAS under load; a hang guard |
| 47 | const NF_VAL_CAP: i64 = 65536 |
| 48 | const NF_SNIP: i64 = 300 |
| 49 | const NF_DL_HEADROOM: i64 = 1048576 // headers plus rounding above the declared size |
| 50 | const NF_MODE_0644: i64 = 420 |
| 51 | const NF_EXIT_USAGE: i64 = 2 |
| 52 | const NF_EXIT_NOKEY: i64 = 3 |
| 53 | const NF_EXIT_NET: i64 = 4 |
| 54 | const NF_EXIT_HTTP: i64 = 5 |
| 55 | const NF_EXIT_UNPARSED: i64 = 6 |
| 56 | const NF_HTTP_OK: i64 = 200 |
functions
| 58 | func nf_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 59 | func nf_puts(s: *u8) -> i64 { sys_write(1, s, nf_slen(s)); return 0 } |
| 60 | func nf_putn(v: i64) -> i64 |
| 74 | func nf_streq(a: *u8, b: *u8) -> i64 |
| 80 | func nf_cat(dst: *u8, off: i64, s: *u8, cap: i64) -> i64 |
| 87 | func nf_catn(dst: *u8, off: i64, s: *u8, n: i64, cap: i64) -> i64 |
| 94 | func nf_crlf(dst: *u8, off: i64, cap: i64) -> i64 |
| 100 | func nf_zero(b: *u8, n: i64) -> i64 { var i: i64 = 0; while i < n { b[i] = 0 as u8; i = i + 1 } return 0 } |
| 101 | func nf_unlink(path: *u8) -> i64 { __syscall(263, AT_FDCWD, path, 0, 0, 0, 0) return 0 } |
| 102 | func nf_is_digit(c: i64) -> i64 { if c >= 48 { if c <= 57 { return 1 } } return 0 } |
| 106 | func nf_key(out: *u8, cap: i64) -> i64 |
| 149 | func nf_get(store: *TrustStore, tail: *u8, key: *u8, klen: i64, out: *u8, cap: i64, st: *i64) -> i64 |
| 172 | func nf_json_field(obj: *u8, n: i64, key: *u8, out: *u8, cap: i64) -> i64 |
| 211 | func nf_field_out(obj: *u8, n: i64, key: *u8, label: *u8, val: *u8, cap: i64) -> i64 |
| 222 | func nf_array_start(body: *u8, n: i64, key: *u8) -> i64 |
| 235 | func nf_http_refuse(body: *u8, n: i64, st: i64) -> i64 |
| 245 | func nf_call(store: *TrustStore, tail: *u8, key: *u8, klen: i64, resp: *u8, cap: i64, lenbox: *i64) -> i64 |
| 259 | func nf_tail3(dst: *u8, game: *u8, modid: *u8, suffix: *u8) -> i64 |
| 268 | func nf_validate(store: *TrustStore, key: *u8, klen: i64) -> i64 |
| 287 | func nf_info(store: *TrustStore, game: *u8, modid: *u8, key: *u8, klen: i64) -> i64 |
| 316 | func nf_files(store: *TrustStore, game: *u8, modid: *u8, key: *u8, klen: i64, want_fid: *u8, size_kb_out: *i64) -> i64 |
| 376 | func nf_link(store: *TrustStore, game: *u8, modid: *u8, fid: *u8, nxm_key: *u8, nxm_exp: *u8, key: *u8, klen: i64, uri: *u8, ucap: i64, quiet: i64) -> i64 |
| 428 | func nf_hex(dig: *u8, out: *u8) -> i64 |
| 436 | func nf_fetch(store: *TrustStore, game: *u8, modid: *u8, fid: *u8, outp: *u8, nxm_key: *u8, nxm_exp: *u8, key: *u8, klen: i64) -> i64 |
| 477 | func nf_usage() -> i64 |
| 482 | func main(argc: i64, argv: *i64) -> i64 |