Skip to main content

Module mnemonic

Module mnemonic 

Source
Expand description

huddle 2.0: BIP39 seed-phrase encoding of the 32-byte Ed25519 identity seed (F6).

This is a deterministic 1:1 encoding, not a key-derivation step. The 256-bit Ed25519 seed maps to a checksummed 24-word English mnemonic and back, so the phrase is the crown-jewel root secret: written on paper it restores the whole identity — PeerId, the deterministically-derived ML-KEM-768 keypair, and every DM key — on a fresh install, without ever touching the database (the DB only ever stores the raw 32 bytes). There is no passphrase / PBKDF2 stretching and no RNG here: we use only bip39’s entropy <-> word mapping. See crate::identity::IdentityKeys::{seed, from_seed} for the identity-level export/import that sits on top of this.

Functions§

phrase_to_seed
Decode a 24-word BIP39 mnemonic back to the 32-byte Ed25519 seed, validating the checksum. Input is trimmed and lower-cased first (BIP39 English words are ASCII-lowercase, and split_whitespace inside the parser collapses any run of spaces/tabs/newlines), so a phrase pasted with odd casing or stray whitespace still imports cleanly.
seed_to_phrase
Encode a 32-byte Ed25519 identity seed as a 24-word BIP39 English mnemonic. 256 bits of entropy → 24 words, where the last word folds in an 8-bit SHA-256 checksum, so a single mistyped or transposed word is caught on import. Deterministic: the same seed always yields the same phrase.