lib for mobile
This commit is contained in:
parent
089f126e4f
commit
997a4ec44b
|
@ -0,0 +1,4 @@
|
|||
# README
|
||||
|
||||
## mobile
|
||||
`cargo build --release --lib --target aarch64-apple-ios`
|
|
@ -0,0 +1,15 @@
|
|||
use std::os::raw::{c_char};
|
||||
use std::ffi::{CString, CStr};
|
||||
mod identity;
|
||||
|
||||
#[no_mangle]
|
||||
pub extern fn generate_identity_commitment(seed: *const c_char) -> *mut c_char {
|
||||
let c_str = unsafe { CStr::from_ptr(seed) };
|
||||
let seed = match c_str.to_str() {
|
||||
Err(_) => "there",
|
||||
Ok(string) => string,
|
||||
};
|
||||
let id = identity::Identity::new(seed.as_bytes());
|
||||
|
||||
CString::new(id.identity_commitment().to_str_radix(10)).unwrap().into_raw()
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
#include <stdint.h>
|
||||
|
||||
const char* generate_identity_commitment(const char* to);
|
Loading…
Reference in New Issue