ergo-lib-c 0.28.0

C bindings for ergo-lib
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use ergo_lib_c_core::mnemonic::mnemonic_to_seed;
use std::ffi::CStr;
use std::os::raw::c_char;

/// Convert a mnemonic phrase into a mnemonic seed
/// mnemonic_pass is optional and is used to salt the seed
#[no_mangle]
pub unsafe extern "C" fn ergo_lib_mnemonic_to_seed(
    mnemonic_phrase: *const c_char,
    mnemonic_pass: *const c_char,
    output: *mut u8,
) {
    let mnemonic_phrase = CStr::from_ptr(mnemonic_phrase).to_string_lossy();
    let mnemonic_pass = CStr::from_ptr(mnemonic_pass).to_string_lossy();
    #[allow(clippy::unwrap_used)]
    mnemonic_to_seed(&mnemonic_phrase, &mnemonic_pass, output).unwrap()
}