Skip to content

Conversation

@ovitrif
Copy link

@ovitrif ovitrif commented Jan 11, 2026

Integrated in:

This PR exposes a new utility function derive_node_secret_from_mnemonic that derives the node secret key from a BIP39 mnemonic phrase.

Changes

  • Added derive_node_secret_from_mnemonic(mnemonic, passphrase) function
  • Added InvalidMnemonic error variant
  • Exposed the new function in the UniFFI bindings for Kotlin, Swift, and Python
  • Bumped version to 0.7.0-rc.3

Usage

This function returns the same secret key that would be used by a Node built with the mnemonic via Builder::set_entropy_bip39_mnemonic. This is useful for applications that need access to the node secret without instantiating a full node.

let secret = derive_node_secret_from_mnemonic(
    "abandon abandon abandon...".to_string(),
    Some("optional passphrase".to_string()),
)?;

QA Notes

Testing

  • cargo test passes
  • cargo clippy clean
  • Android bindings: ./scripts/uniffi_bindgen_generate_kotlin_android.sh
  • iOS bindings: ./scripts/uniffi_bindgen_generate_swift.sh

Release: v0.7.0-rc.3

Add a new public function to derive the node secret key from a BIP39
mnemonic without requiring a running Node instance. This enables backup
authentication before the node starts.
@ovitrif ovitrif changed the title feat: expose derive_node_secret_from_mnemonic feat: expose derive_node_secret_from_mnemonic Jan 11, 2026
@ovitrif ovitrif self-assigned this Jan 11, 2026
@ovitrif ovitrif marked this pull request as ready for review January 11, 2026 22:39
Copy link

@ben-kaufman ben-kaufman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utAck, just note comment about moving imports up

Address PR review feedback:
- Move Xpriv import to top with other bitcoin imports
- Use already-imported Error instead of crate::Error

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link

@ben-kaufman ben-kaufman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ben-kaufman ben-kaufman merged commit e7e8fe8 into main Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants