nio-olm: Remove our olm bindings since we're gonna use olm-rs.
parent
19383fd28c
commit
fbd65fde26
|
@ -1,10 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "nio-olm-rs"
|
|
||||||
version = "3.1.4-beta"
|
|
||||||
authors = ["Damir Jelić <poljar@termina.org.uk>"]
|
|
||||||
description = "Higher level bindings for the Olm C library"
|
|
||||||
license = "ISC"
|
|
||||||
edition = "2018"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
nio-olm-sys = { path = "../nio-olm-sys" }
|
|
|
@ -1,46 +0,0 @@
|
||||||
use nio_olm_sys::OlmAccount;
|
|
||||||
|
|
||||||
pub struct Account {
|
|
||||||
account: *mut OlmAccount,
|
|
||||||
buffer: Vec<u8>,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct IdentityKeys {
|
|
||||||
ed25519: String,
|
|
||||||
curve25519: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Account {
|
|
||||||
#[allow(clippy::new_without_default)]
|
|
||||||
pub fn new() -> Account {
|
|
||||||
let account_size = unsafe { nio_olm_sys::olm_account_size() };
|
|
||||||
|
|
||||||
let account_data: Vec<u8> = vec![0; account_size];
|
|
||||||
|
|
||||||
let acc_ptr = unsafe { nio_olm_sys::olm_account(account_data.as_ptr() as *mut _) };
|
|
||||||
|
|
||||||
Account {
|
|
||||||
account: acc_ptr,
|
|
||||||
buffer: account_data,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn identity_keys(&self) {
|
|
||||||
let keys_length = unsafe { nio_olm_sys::olm_account_identity_keys_length(self.account) };
|
|
||||||
|
|
||||||
let out_buffer: Vec<u8> = vec![0; keys_length];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Drop for Account {
|
|
||||||
fn drop(&mut self) {
|
|
||||||
unsafe {
|
|
||||||
nio_olm_sys::olm_clear_account(self.account);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn create_account() {
|
|
||||||
Account::new();
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
pub mod account;
|
|
|
@ -1,14 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "nio-olm-sys"
|
|
||||||
version = "3.1.4-beta"
|
|
||||||
authors = ["Damir Jelić <poljar@termina.org.uk>"]
|
|
||||||
description = "Low level bindings for the Olm C library"
|
|
||||||
license = "ISC"
|
|
||||||
edition = "2018"
|
|
||||||
build = "build.rs"
|
|
||||||
|
|
||||||
[build-dependencies]
|
|
||||||
bindgen = "0.51.1"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
libc = "0.2.65"
|
|
|
@ -1,21 +0,0 @@
|
||||||
use bindgen::Bindings;
|
|
||||||
use std::env;
|
|
||||||
use std::path::PathBuf;
|
|
||||||
|
|
||||||
fn build(file: &str) -> Result<Bindings, ()> {
|
|
||||||
println!("cargo:rustc-link-lib=olm");
|
|
||||||
|
|
||||||
bindgen::Builder::default()
|
|
||||||
.rustfmt_bindings(true)
|
|
||||||
.header(file)
|
|
||||||
.generate()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let bindings = build("src/wrapper.h").expect("Unable to build bindings");
|
|
||||||
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
|
||||||
|
|
||||||
bindings
|
|
||||||
.write_to_file(out_path.join("bindings.rs"))
|
|
||||||
.expect("Couldn't write bindings!");
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
#![allow(non_upper_case_globals)]
|
|
||||||
#![allow(non_camel_case_types)]
|
|
||||||
#![allow(non_snake_case)]
|
|
||||||
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
|
|
@ -1 +0,0 @@
|
||||||
#include <olm/olm.h>
|
|
Loading…
Reference in New Issue