code wiki / _hdl_build / nx_social_recovery.nx

nx_social_recovery.nx

buildroot/runtime/_hdl_build/nx_social_recovery.nx

3468 B81 linesdepth 5pulls 6 transitivereach 5 importersview sourcekind librarytopic social
docsdependenciesstructsconstsfunctions

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

nx_vault_shamir.nx nx_csprng.nx nx_syscalls.nx nx_social_recovery.nx nx_social_auth_recover.nx nx_social_recovery_gate.nx nx_succession_recover.nx

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

15const SR_KEY_BYTES: i64 = 32
16const SR_CHUNKS: i64 = 11 // ceil(32 / 3)

functions

18func sr_chunk_nbytes(c: i64) -> i64 { if c == SR_CHUNKS - 1 { return 2 } return 3 }
21func sr_pack(secret: *u8, bo: i64, nbytes: i64) -> i64
called by 1: nx_sr_split
28func sr_unpack(val: i64, out: *u8, bo: i64, nbytes: i64) -> i64
called by 1: nx_sr_reconstruct
40func nx_sr_split(secret: *u8, n: i64, k: i64, shares_out: *i64) -> i64
70func nx_sr_reconstruct(k: i64, xs: *i64, shares_in: *i64, secret_out: *u8) -> i64