pub struct RootSeed(/* private fields */);Expand description
The root secret from which the user node’s keys and credentials are derived.
Implementations§
Source§impl RootSeed
impl RootSeed
Sourcepub fn read(wallet_env: &WalletEnv) -> Result<Option<Self>>
pub fn read(wallet_env: &WalletEnv) -> Result<Option<Self>>
Read a RootSeed from the default seedphrase path for this
environment (~/.lexe/seedphrase[.env].txt).
Returns Ok(None) if the file doesn’t exist.
Sourcepub fn write(&self, wallet_env: &WalletEnv) -> Result<()>
pub fn write(&self, wallet_env: &WalletEnv) -> Result<()>
Write this RootSeed to the default seedphrase path for this
environment (~/.lexe/seedphrase[.env].txt).
Creates parent directories if needed. Fails if the file already exists.
Sourcepub fn read_from_path(path: &Path) -> Result<Option<Self>>
pub fn read_from_path(path: &Path) -> Result<Option<Self>>
Read a RootSeed from a seedphrase file at a specific path.
Returns Ok(None) if the file doesn’t exist.
Sourcepub fn write_to_path(&self, path: &Path) -> Result<()>
pub fn write_to_path(&self, path: &Path) -> Result<()>
Write this RootSeed to a seedphrase file at a specific path.
Creates parent directories if needed. Returns an error if the file already exists. On Unix, the file is created with mode 0600 (owner read/write only).
Sourcepub fn from_mnemonic(mnemonic: Mnemonic) -> Result<Self>
pub fn from_mnemonic(mnemonic: Mnemonic) -> Result<Self>
Construct a RootSeed from a BIP39 mnemonic.
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_bytes(bytes: &[u8]) -> Result<Self>
Construct a RootSeed from a 32-byte slice.
Sourcepub fn from_hex(hex: &str) -> Result<Self>
pub fn from_hex(hex: &str) -> Result<Self>
Construct a RootSeed from a 64-character hex string.
Sourcepub fn to_mnemonic(&self) -> Mnemonic
pub fn to_mnemonic(&self) -> Mnemonic
Convert this root secret to its BIP39 mnemonic.
Sourcepub fn derive_user_pk(&self) -> UserPk
pub fn derive_user_pk(&self) -> UserPk
Derive the user’s public key.
Sourcepub fn derive_node_pk(&self) -> NodePk
pub fn derive_node_pk(&self) -> NodePk
Derive the node public key.