code wiki / _hdl_build / nx_social_auth_recover.nx

nx_social_auth_recover.nx

buildroot/runtime/_hdl_build/nx_social_auth_recover.nx

2854 B45 linesdepth 15pulls 45 transitivereach 1 importersview sourcekind librarytopic social
docsdependenciesstructsconstsfunctions

about

nx_social_auth_recover.nx -- the WIRING that makes elderly social recovery REAL: it connects the Shamir family-quorum primitive (nx_social_recovery) to actual account recovery (nx_modern_auth_recover), via the BIP39 codec. The recovery secret IS the entropy behind the user's issued mnemonic, so: ENROLL: decode the issued mnemonic -> its 256-bit entropy -> Shamir-split across N trusted contacts (K threshold). The USER HOLDS NOTHING; the family holds shares. RECOVER: K contacts reconstruct the entropy -> re-encode the mnemonic -> nx_modern_auth_recover (sets a new passphrase, rotates the mnemonic). K-1 reconstruct GARBAGE -> a wrong mnemonic -> refused. After a recovery the mnemonic rotates, so the caller MUST re-split the new mnemonic (nx_sar_enroll_split) for the next cycle. No seed phrase is ever handed to the user; the family quorum is the backup. Composes nx_social_recovery + nx_bip39 + nx_modern_auth_flow. license_tier: ORIGINAL

dependencies 4 imports · 1 importers

nx_social_recovery.nx nx_bip39.nx nx_modern_auth_flow.nx nx_syscalls.nx nx_social_auth_recover.nx nx_social_auth_recover_gate.nx

imports: nx_social_recovery.nxnx_bip39.nxnx_modern_auth_flow.nxnx_syscalls.nx

imported by: nx_social_auth_recover_gate.nx

structs

none

consts

16const NX_SAR_OK: i64 = 0
17const NX_SAR_BAD_MNEMONIC: i64 = 1 // the issued mnemonic didn't decode to 256-bit entropy
18const NX_SAR_RECOVER_FAILED: i64 = 2 // the reconstructed entropy didn't recover the account (e.g. < K shares)

functions

21func nx_sar_enroll_split(mn: *u8, mn_n: i64, n: i64, k: i64, shares_out: *i64) -> i64
33func nx_sar_recover(ctx: *NxAuthContext, handle: *u8, handle_n: i64,