code wiki / _hdl_build / nx_social_recovery.nx
nx_social_recovery.nx
buildroot/runtime/_hdl_build/nx_social_recovery.nx
about
nx_social_recovery.nx -- ELDERLY-FRIENDLY recovery: split a user's 256-bit recovery secret across N trusted
contacts (family) so ANY K of them can bring the user back in, and K-1 learn NOTHING. This REPLACES the
24-word BIP39 mnemonic the user would otherwise have to safeguard (and could lose) -- the user holds nothing;
their family IS the backup. "Best security, least stress": no password to remember, no seed phrase to lose.
Built on the sovereign Shamir primitive (nx_vault_shamir, GF(2^31-1)). That field splits ONE scalar < 2^31,
so a 256-bit secret is split CHUNK-WISE: 32 bytes -> 11 big-endian chunks (ten 3-byte + one 2-byte, each
< 2^24 < 2^31-1), each Shamir-split under the SAME contact x-coords. Reconstruct each chunk from K shares,
reassemble the 32 bytes. The recovery secret = the BIP39 entropy behind nx_modern_auth_recover, so a quorum
rebuilds exactly what's needed to reset the account -- no mnemonic ever handed to the user. license_tier: ORIGINAL
dependencies 3 imports · 3 importers
imports: nx_vault_shamir.nxnx_csprng.nxnx_syscalls.nx
imported by: nx_social_auth_recover.nxnx_social_recovery_gate.nxnx_succession_recover.nx
structs
| none |
consts
| 15 | const SR_KEY_BYTES: i64 = 32 |
| 16 | const SR_CHUNKS: i64 = 11 // ceil(32 / 3) |
functions
| 18 | func sr_chunk_nbytes(c: i64) -> i64 { if c == SR_CHUNKS - 1 { return 2 } return 3 } |
| 21 | func sr_pack(secret: *u8, bo: i64, nbytes: i64) -> i64 called by 1: nx_sr_split |
| 28 | func sr_unpack(val: i64, out: *u8, bo: i64, nbytes: i64) -> i64 called by 1: nx_sr_reconstruct |
| 40 | func nx_sr_split(secret: *u8, n: i64, k: i64, shares_out: *i64) -> i64 called by 3: nx_sar_enroll_splitmainmain calls 6: sr_chunk_nbytessys_mmapsr_packnx_csprng_fillsh_modsh_eval |
| 70 | func nx_sr_reconstruct(k: i64, xs: *i64, shares_in: *i64, secret_out: *u8) -> i64 called by 3: nx_sar_recovermainnx_succession_recover calls 4: sys_mmapsh_reconstructsr_unpacksr_chunk_nbytes |