nx_torrent_access.nx
buildroot/runtime/nx_torrent_access.nx
about
nx_torrent_access.nx -- ACCESS POLICY for torrent downloads + watch-while-stream, by AREA.
Operator directive (2026-06-20): "make the gallery able to download sfw or nsfw and the media is where
the family users can download; on the gallery it allows where to download (media for sfw OR gallery for
nsfw). this is important for the watch while streaming off /torrent."
TWO destination areas, each with a REQUIRED level (deny-by-default / fail-closed, NIST SP 800-207, the
same posture as nx_access_wall / nx_image_access):
AREA_SFW ("media" destination) -> required FAMILY (1): any logged-in family member or the operator.
AREA_NSFW ("gallery" destination) -> required OWNER (3): the operator ONLY.
A family member (1) can NEVER reach the NSFW/gallery area; no session (0) reaches nothing; garbage/negative
levels DENY; an UNKNOWN area DENIES even for the owner (no download to a bogus destination).
OWNER==3 MIRRORS nx_galx_authz GALX_OWNER (the gallery's operator-only level for cam recordings + NSFW)
and nx_image_access NX_IMGSEARCH_OWNER; single vocabulary, asserted ==3 by nx_torrent_access_gate.
The enforcement point (the torrent daemon /add + /stream) derives viewer_level from the OPAQUE-
authenticated session exactly as the gallery does (nx_opaque_login olg_whoami -> handle -> roles level),
then calls nx_taccess_allow BEFORE writing/serving any byte. Internal CLI callers are trusted
(Cardinal 12: validate at the boundary). license_tier: ORIGINAL
dependencies 1 imports · 4 importers
imports: nx_syscalls.nx
imported by: nx_torrent_access_gate.nxnx_torrent_area_gate.nxnx_torrent_daemon.nxnx_torrent_gw.nx
structs
| none |
consts
| 22 | const NX_TACCESS_OWNER: i64 = 3 // operator (== nx_galx_authz GALX_OWNER); gate asserts ==3 |
| 23 | const NX_TACCESS_FAMILY: i64 = 1 // logged-in family member; gate asserts ==1 |
| 24 | const NX_TACCESS_ANON: i64 = 0 // no session / anonymous |
| 26 | const NX_TAREA_SFW: i64 = 0 // "media" destination -> required FAMILY(1) |
| 27 | const NX_TAREA_NSFW: i64 = 1 // "gallery" destination -> required OWNER(3) |
| 29 | const NX_TACCESS_DENY: i64 = 0 |
| 30 | const NX_TACCESS_ALLOW: i64 = 1 |
functions
| 33 | func nx_taccess_required_level(area: i64) -> i64 |
| 41 | func nx_taccess_allow(viewer_level: i64, area: i64) -> i64 |