code wiki / (root) / nx_connect_device_client.nx

nx_connect_device_client.nx

buildroot/runtime/nx_connect_device_client.nx

14989 B111 linesdepth 2pulls 3 transitivereach 1 importersview sourcekind tooltopic connect
docsdependenciesstructsconstsfunctions

about

nx_connect_device_client.nx -- CONNECT, PRIVACY-FIRST / DATA-ON-THE-ENDPOINT. The evolution of the E2E client (nx_connect_e2e_client): the user's PRIVATE data -- their contact list and their whole message history -- lives in THIS BROWSER, encrypted at rest, and NEVER on our server. Our server only ever sees two things: a user's PUBLIC key (public by definition) and CIPHERTEXT in transit to a named recipient. There is nothing private on our systems to sniff, subpoena, or leak. This is the Berners-Lee/Solid model (you own your data) made concrete with our own sovereign crypto. HOW (all crypto is our own wasm, KAT-proven; no third-party libraries, no new wat chain): - Identity: an X25519 keypair per handle; the PRIVATE half stays in localStorage, never sent (RFC 7748, nx_x25519.wasm; DH agreement proven in nx_connect_keyx_vm_gate 5/5). - Device vault: {contacts, messages} serialised to JSON and sealed with sovereign ChaCha20 (RFC 8439, nx_media_crypt.wasm 3/3) under a VAULT KEY derived on-device from the private identity key, with a fresh random nonce each save (no keystream reuse). The vault ciphertext lives in localStorage -- so even the browser's own storage-at-rest holds only ciphertext; only the running page (with the key derived from the private key) can read it. - Messaging: a per-conversation key is AGREED via X25519 with the peer's published key; the message is ChaCha20-sealed and only the ciphertext is POSTed for delivery; on sync, fetched ciphertext is decrypted in-browser and the PLAINTEXT is written into the device vault (encrypted at rest), never back to the server. HONEST SCOPE (stated on the page): the delivery relay still holds in-transit ciphertext until it is fetched (delete-on-delivery + a sender-held outbox are the next rungs); the pubkey directory is TOFU (identity binding is a separate rung); localStorage is the store (IndexedDB/OPFS is the scale rung). nx_connect_device_client <chacha.wasm> <x25519.wasm> <out.html> cd_emit_html(b64c,b64clen,b64x,b64xlen,dst) is the pure emitter (gate-testable without real wasm). license_tier: ORIGINAL

dependencies 2 imports · 1 importers

nx_syscalls.nx nx_base64.nx nx_connect_device_client.nx nx_connect_device_client_gate.nx

imports: nx_syscalls.nxnx_base64.nx

imported by: nx_connect_device_client_gate.nx

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

main sys_write sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close b64_encode b64_enc_char cd_emit_html cd_puts cd_putb sys_openat_wr sys_close ↻

structs

none

consts

29const K_MAGIC_524288: i64 = 524288

functions

31func cd_puts(dst: *u8, off: i64, s: *u8) -> i64 { var o: i64=off; var i: i64=0; while s[i]!=(0 as u8){dst[o]=s[i]; o=o+1; i=i+1} return o }
called by 1: cd_emit_html
32func cd_putb(dst: *u8, off: i64, b: *u8, n: i64) -> i64 { var i: i64=0; while i<n { dst[off+i]=b[i]; i=i+1 } return off+n }
called by 1: cd_emit_html
34func cd_emit_html(b64c: *u8, b64clen: i64, b64x: *u8, b64xlen: i64, dst: *u8) -> i64
called by 2: mainmain calls 2: cd_putscd_putb
88func main(argc: i64, argv: *i64) -> i64