We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ad6daa1 commit 0b166b1Copy full SHA for 0b166b1
1 file changed
orange-sdk/src/ffi/ldk_node.rs
@@ -3,6 +3,7 @@ use crate::ffi::orange::error::ConfigError;
3
use crate::{impl_from_core_type, impl_into_core_type};
4
use ldk_node::ChannelDetails as LDKChannelDetails;
5
use ldk_node::bip39::Mnemonic as LDKMnemonic;
6
+use ldk_node::bip39::rand_core::RngCore;
7
use ldk_node::bitcoin::Network as LDKNetwork;
8
use std::str::FromStr;
9
@@ -37,6 +38,13 @@ impl Mnemonic {
37
38
Err(_) => Err(ConfigError::InvalidMnemonic),
39
}
40
41
+
42
+ #[uniffi::constructor]
43
+ pub fn generate() -> Result<Self, ConfigError> {
44
+ let mut entropy = [0u8; 16]; // 128 bits for 12-word mnemonic
45
+ rand::thread_rng().fill_bytes(&mut entropy);
46
+ Self::from_entropy(entropy.to_vec())
47
+ }
48
49
50
impl std::fmt::Display for Mnemonic {
0 commit comments