#![allow(non_camel_case_types)]
use core::ffi::{c_char, c_int, c_void};
pub const NWEP_NODEID_SIZE: usize = 32;
pub const NWEP_PUBKEY_SIZE: usize = 32;
pub const NWEP_PRIVKEY_SIZE: usize = 32;
pub const NWEP_SIG_SIZE: usize = 64;
#[repr(C)]
#[derive(Clone, Copy)]
pub struct nwep_node_id {
pub bytes: [u8; NWEP_NODEID_SIZE],
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct nwep_keypair {
pub pub_: [u8; NWEP_PUBKEY_SIZE],
pub priv_: [u8; NWEP_PRIVKEY_SIZE],
}
extern "C" {
pub fn nwep_identity_generate(out_id: *mut nwep_node_id, out_kp: *mut nwep_keypair) -> c_int;
pub fn nwep_nodeid_verify(id: *const nwep_node_id, pubkey: *const u8) -> c_int;
pub fn nwep_nodeid_to_base58(
out: *mut c_char,
outlen: *mut usize,
id: *const nwep_node_id,
) -> c_int;
pub fn nwep_nodeid_from_base58(out: *mut nwep_node_id, s: *const c_char, len: usize) -> c_int;
pub fn nwep_nodeid_from_pubkey(out: *mut nwep_node_id, pubkey: *const u8) -> c_int;
pub fn nwep_ed25519_sign(
out_sig: *mut u8,
msg: *const u8,
msg_len: usize,
privkey: *const u8,
) -> c_int;
pub fn nwep_ed25519_verify(
sig: *const u8,
msg: *const u8,
msg_len: usize,
pubkey: *const u8,
) -> c_int;
pub fn nwep_keypair_save_pem(
out: *mut u8,
outlen: *mut usize,
kp: *const nwep_keypair,
) -> c_int;
pub fn nwep_keypair_load_pem(out_kp: *mut nwep_keypair, pem: *const u8, len: usize) -> c_int;
}
extern "C" {
pub fn nwep_zeroize(ptr: *mut c_void, len: usize);
pub fn nwep_strerror(err: c_int) -> *const c_char;
pub fn nwep_version() -> *const c_char;
pub fn nwep_shamir_split(
secret: *const u8,
secret_len: usize,
t: usize,
n: usize,
out: *mut u8,
outlen: *mut usize,
) -> c_int;
pub fn nwep_shamir_combine(
shares: *const u8,
n_shares: usize,
share_len: usize,
out_secret: *mut u8,
out_secret_len: *mut usize,
) -> c_int;
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct nwep_address {
pub opaque: [u8; 32],
}
extern "C" {
pub fn nwep_address_loopback(out: *mut nwep_address, port: u16);
pub fn nwep_address_wildcard(out: *mut nwep_address, port: u16);
pub fn nwep_address_ipv4_mapped(out: *mut nwep_address, a: u8, b: u8, c: u8, d: u8, port: u16);
pub fn nwep_address_from_bytes(out: *mut nwep_address, addr: *const u8, port: u16);
pub fn nwep_address_get_port(addr: *const nwep_address) -> u16;
}
#[repr(C)]
pub struct nwep_uri {
pub node_id: nwep_node_id,
pub port: u16,
pub path: *const c_char,
pub path_len: usize,
}
extern "C" {
pub fn nwep_uri_parse(out: *mut nwep_uri, input: *const c_char, len: usize) -> c_int;
}
extern "C" {
pub fn nwep_method_str(method: c_int) -> *const c_char;
pub fn nwep_status_str(status: c_int) -> *const c_char;
}
pub enum nwep_server {}
pub enum nwep_client {}
pub enum nwep_message {}
#[repr(C)]
pub struct nwep_buf {
pub opaque: *mut c_void,
}
#[repr(C)]
pub struct nwep_header {
pub name: *const c_char,
pub value: *const c_char,
}
pub type nwep_handler_fn = unsafe extern "C" fn(
server: *mut nwep_server,
conn_id: u64,
stream_id: u64,
request: *const nwep_message,
resp_buf: *mut nwep_buf,
userdata: *mut c_void,
) -> c_int;
pub const NWEP_DEFER: c_int = 1;
extern "C" {
pub fn nwep_server_listen(
out: *mut *mut nwep_server,
identity: *const nwep_keypair,
bind_addr: *const nwep_address,
) -> c_int;
pub fn nwep_server_set_handler(
server: *mut nwep_server,
handler: Option<nwep_handler_fn>,
userdata: *mut c_void,
) -> c_int;
pub fn nwep_server_tick(server: *mut nwep_server, now_ms: i64) -> c_int;
pub fn nwep_server_fd(server: *const nwep_server) -> isize;
pub fn nwep_server_next_timeout_ms(server: *mut nwep_server, now_ms: i64) -> c_int;
pub fn nwep_server_local_port(server: *const nwep_server) -> u16;
pub fn nwep_server_local_nodeid(server: *const nwep_server, out: *mut nwep_node_id) -> c_int;
pub fn nwep_server_close(server: *mut nwep_server);
pub fn nwep_server_listen_fd(
out: *mut *mut nwep_server,
identity: *const nwep_keypair,
fd: usize,
) -> c_int;
pub fn nwep_server_listen_fd_sharded(
out: *mut *mut nwep_server,
identity: *const nwep_keypair,
fd: usize,
shard_id: u16,
) -> c_int;
pub fn nwep_server_begin_stream(
server: *mut nwep_server,
conn_id: u64,
stream_id: u64,
path: *const c_char,
status: *const c_char,
headers: *const nwep_header,
) -> c_int;
pub fn nwep_server_stream_send(
server: *mut nwep_server,
conn_id: u64,
stream_id: u64,
body: *const u8,
body_len: usize,
) -> c_int;
pub fn nwep_server_stream_end(server: *mut nwep_server, conn_id: u64, stream_id: u64) -> c_int;
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct nwep_server_metrics {
pub connections_active: u64,
pub connections_accepted: u64,
pub connections_refused: u64,
pub connections_closed: u64,
pub bytes_received: u64,
pub bytes_sent: u64,
pub datagrams_received: u64,
pub datagrams_sent: u64,
pub requests_dispatched: u64,
pub requests_shed: u64,
pub parked_active: u64,
pub load: i32,
}
pub const NWEP_SERVER_CID_LEN: usize = 18;
extern "C" {
pub fn nwep_server_listen_reuseport(
out: *mut *mut nwep_server,
identity: *const nwep_keypair,
bind_addr: *const nwep_address,
) -> c_int;
pub fn nwep_reuse_port_supported() -> c_int;
pub fn nwep_server_get_peer_nodeid(
server: *const nwep_server,
conn_id: u64,
out_node_id: *mut nwep_node_id,
) -> c_int;
pub fn nwep_server_metrics_get(
server: *const nwep_server,
out: *mut nwep_server_metrics,
) -> c_int;
pub fn nwep_server_load(server: *const nwep_server) -> c_int;
pub fn nwep_server_set_overloaded(server: *mut nwep_server, on: c_int);
pub fn nwep_server_set_max_parked(server: *mut nwep_server, max_parked: usize);
pub fn nwep_server_conn_compression(server: *const nwep_server, conn_id: u64) -> c_int;
pub fn nwep_server_last_handshake_error(server: *const nwep_server) -> c_int;
pub fn nwep_server_drain(server: *mut nwep_server) -> c_int;
pub fn nwep_server_is_drained(server: *const nwep_server) -> c_int;
pub fn nwep_cid_shard_id(cid: *const u8, cid_len: usize) -> c_int;
pub fn nwep_server_notify(
server: *mut nwep_server,
conn_id: u64,
event: *const c_char,
headers: *const nwep_header,
body: *const u8,
body_len: usize,
) -> c_int;
pub fn nwep_server_respond_header(
server: *mut nwep_server,
conn_id: u64,
stream_id: u64,
name: *const c_char,
value: *const c_char,
) -> c_int;
pub fn nwep_server_respond(
server: *mut nwep_server,
conn_id: u64,
stream_id: u64,
status: *const c_char,
body: *const u8,
body_len: usize,
) -> c_int;
pub fn nwep_server_relay(
server: *mut nwep_server,
conn_id: u64,
stream_id: u64,
origin_resp: *const nwep_message,
) -> c_int;
pub fn nwep_server_respond_blit(
server: *mut nwep_server,
conn_id: u64,
stream_id: u64,
frame: *const u8,
len: usize,
) -> c_int;
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct nwep_range {
pub start: u64,
pub end: u64,
}
pub const NWEP_RANGE_OK: c_int = 0;
pub const NWEP_RANGE_NONE: c_int = 1;
pub const NWEP_RANGE_UNSATISFIABLE: c_int = 2;
extern "C" {
pub fn nwep_response_ok(resp: *mut nwep_buf, body: *const u8, body_len: usize) -> c_int;
pub fn nwep_response_status(
resp: *mut nwep_buf,
status: *const c_char,
body: *const u8,
body_len: usize,
) -> c_int;
pub fn nwep_response_not_modified(resp: *mut nwep_buf, etag: *const c_char) -> c_int;
pub fn nwep_response_partial(
resp: *mut nwep_buf,
body: *const u8,
body_len: usize,
ranges: *const nwep_range,
count: usize,
content_type: *const c_char,
) -> c_int;
pub fn nwep_response_range_not_satisfiable(resp: *mut nwep_buf, total_len: u64) -> c_int;
pub fn nwep_response_header(
resp: *mut nwep_buf,
name: *const c_char,
value: *const c_char,
) -> c_int;
pub fn nwep_response_verify(
resp: *const nwep_message,
pubkey: *const u8,
path: *const c_char,
now_secs: u64,
) -> c_int;
pub fn nwep_response_capture(
resp: *mut nwep_buf,
out: *mut u8,
cap: usize,
out_len: *mut usize,
) -> c_int;
pub fn nwep_response_blit(resp: *mut nwep_buf, frame: *const u8, len: usize) -> c_int;
pub fn nwep_response_relay(resp: *mut nwep_buf, origin: *const nwep_message) -> c_int;
}
pub enum nwep_cache {}
extern "C" {
pub fn nwep_cache_create(max_bytes: usize, max_entries: usize) -> *mut nwep_cache;
pub fn nwep_cache_free(cache: *mut nwep_cache);
pub fn nwep_cache_put_signed(
cache: *mut nwep_cache,
method: *const c_char,
path: *const c_char,
resp: *const nwep_message,
origin_pubkey: *const u8,
now_secs: u64,
) -> c_int;
pub fn nwep_cache_get_signed(
cache: *mut nwep_cache,
method: *const c_char,
path: *const c_char,
origin_pubkey: *const u8,
now_secs: u64,
out: *mut *mut nwep_message,
) -> c_int;
pub fn nwep_cache_clear(cache: *mut nwep_cache);
pub fn nwep_cache_stats(
cache: *const nwep_cache,
out_hits: *mut u64,
out_misses: *mut u64,
out_stores: *mut u64,
out_evictions: *mut u64,
);
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct nwep_client_metrics {
pub requests_inflight: u64,
pub requests_completed: u64,
pub requests_failed: u64,
pub smoothed_rtt_us: u64,
pub alive: i32,
}
extern "C" {
pub fn nwep_client_connect(
out: *mut *mut nwep_client,
identity: *const nwep_keypair,
target_node_id: *const nwep_node_id,
target_addr: *const nwep_address,
) -> c_int;
pub fn nwep_client_send(
client: *mut nwep_client,
method: c_int,
path: *const c_char,
headers: *const nwep_header,
body: *const u8,
body_len: usize,
out_response: *mut *mut nwep_message,
) -> c_int;
pub fn nwep_client_close(client: *mut nwep_client);
pub fn nwep_client_connect_async(
out: *mut *mut nwep_client,
identity: *const nwep_keypair,
target_node_id: *const nwep_node_id,
target_addr: *const nwep_address,
) -> c_int;
pub fn nwep_client_connect_fd(
out: *mut *mut nwep_client,
identity: *const nwep_keypair,
target_node_id: *const nwep_node_id,
target_addr: *const nwep_address,
fd: usize,
) -> c_int;
pub fn nwep_client_connect_fd_async(
out: *mut *mut nwep_client,
identity: *const nwep_keypair,
target_node_id: *const nwep_node_id,
target_addr: *const nwep_address,
fd: usize,
) -> c_int;
pub fn nwep_client_connect_poll(client: *mut nwep_client) -> c_int;
pub fn nwep_client_request_submit(
client: *mut nwep_client,
method: c_int,
path: *const c_char,
headers: *const nwep_header,
body: *const u8,
body_len: usize,
out_id: *mut u64,
) -> c_int;
pub fn nwep_client_request_poll(
client: *mut nwep_client,
id: u64,
out_response: *mut *mut nwep_message,
) -> c_int;
pub fn nwep_client_request_cancel(client: *mut nwep_client, id: u64);
pub fn nwep_client_fd(client: *const nwep_client) -> isize;
pub fn nwep_client_tick(client: *mut nwep_client, now_ms: i64) -> c_int;
pub fn nwep_client_next_timeout_ms(client: *mut nwep_client, now_ms: i64) -> c_int;
pub fn nwep_client_is_alive(client: *const nwep_client) -> c_int;
pub fn nwep_client_compression(client: *const nwep_client) -> c_int;
pub fn nwep_client_peer_pubkey(client: *const nwep_client, out_pubkey: *mut u8) -> c_int;
pub fn nwep_client_metrics_get(
client: *const nwep_client,
out: *mut nwep_client_metrics,
) -> c_int;
pub fn nwep_client_open_stream(
client: *mut nwep_client,
method: c_int,
path: *const c_char,
headers: *const nwep_header,
out_stream_id: *mut u64,
) -> c_int;
pub fn nwep_client_stream_response(
client: *mut nwep_client,
stream_id: u64,
out_response: *mut *mut nwep_message,
) -> c_int;
pub fn nwep_client_stream_recv(
client: *mut nwep_client,
stream_id: u64,
out_buf: *mut u8,
cap: usize,
out_len: *mut usize,
out_ended: *mut c_int,
) -> c_int;
pub fn nwep_client_stream_verify(
client: *mut nwep_client,
stream_id: u64,
pubkey: *const u8,
) -> c_int;
pub fn nwep_client_stream_close(client: *mut nwep_client, stream_id: u64);
pub fn nwep_client_poll_notify(client: *mut nwep_client) -> *mut nwep_message;
pub fn nwep_client_verify_response(
client: *const nwep_client,
resp: *const nwep_message,
path: *const c_char,
now_secs: u64,
) -> c_int;
pub fn nwep_client_set_cache(client: *mut nwep_client, cache: *mut nwep_cache) -> c_int;
pub fn nwep_client_set_request_done(
client: *mut nwep_client,
cb: Option<nwep_request_done_fn>,
ud: *mut c_void,
) -> c_int;
}
pub type nwep_request_done_fn = unsafe extern "C" fn(
client: *mut nwep_client,
id: u64,
status: c_int,
resp: *mut nwep_message,
ud: *mut c_void,
);
extern "C" {
pub fn nwep_message_get_status(msg: *const nwep_message) -> *const c_char;
pub fn nwep_message_get_header(msg: *const nwep_message, name: *const c_char) -> *const c_char;
pub fn nwep_message_get_body(msg: *const nwep_message, out_len: *mut usize) -> *const u8;
pub fn nwep_message_header_count(msg: *const nwep_message) -> usize;
pub fn nwep_message_header_at(
msg: *const nwep_message,
i: usize,
name: *mut *const c_char,
value: *mut *const c_char,
) -> c_int;
pub fn nwep_message_free(msg: *mut nwep_message);
pub fn nwep_request_is_fresh(req: *const nwep_message, etag: *const c_char) -> c_int;
pub fn nwep_request_range(
req: *const nwep_message,
total_len: u64,
etag: *const c_char,
out: *mut nwep_range,
max_out: usize,
out_count: *mut usize,
) -> c_int;
}
pub enum nwep_dht {}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct nwep_bootstrap_entry {
pub node_id: nwep_node_id,
pub addr: nwep_address,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct nwep_dht_record {
pub node_id: nwep_node_id,
pub addr: nwep_address,
pub pubkey: [u8; NWEP_PUBKEY_SIZE],
pub seq: u64,
pub timestamp: u64,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct nwep_dht_metrics {
pub datagrams_sent: u64,
pub datagrams_received: u64,
pub bytes_sent: u64,
pub bytes_received: u64,
}
extern "C" {
pub fn nwep_dht_parse_bootstrap(
out: *mut nwep_bootstrap_entry,
input: *const c_char,
len: usize,
) -> c_int;
pub fn nwep_dht_attach(
out: *mut *mut nwep_dht,
server: *mut nwep_server,
bootstrap_nodes: *const nwep_bootstrap_entry,
bootstrap_count: usize,
initial_seq: u64,
) -> c_int;
pub fn nwep_dht_bootstrap(dht: *mut nwep_dht, now_secs: u64) -> c_int;
pub fn nwep_dht_announce(
dht: *mut nwep_dht,
service_addr: *const nwep_address,
now_secs: u64,
) -> c_int;
pub fn nwep_dht_start_lookup(
dht: *mut nwep_dht,
target_node_id: *const nwep_node_id,
now_secs: u64,
) -> c_int;
pub fn nwep_dht_lookup_result(
dht: *const nwep_dht,
target_node_id: *const nwep_node_id,
out_record: *mut nwep_dht_record,
) -> c_int;
pub fn nwep_dht_tick(dht: *mut nwep_dht, now_secs: u64) -> c_int;
pub fn nwep_dht_next_timeout_ms(dht: *const nwep_dht, now_secs: u64) -> c_int;
pub fn nwep_dht_metrics_get(dht: *const nwep_dht, out: *mut nwep_dht_metrics) -> c_int;
pub fn nwep_dht_close(dht: *mut nwep_dht);
}
extern "C" {
pub fn nwep_client_connect_by_nodeid(
out: *mut *mut nwep_client,
identity: *const nwep_keypair,
target_node_id: *const nwep_node_id,
dht: *mut nwep_dht,
lookup_timeout_ms: u32,
) -> c_int;
}
pub enum nwep_log {}
pub const NWEP_ENTRY_KEY_BINDING: c_int = 1;
pub const NWEP_ENTRY_KEY_ROTATION: c_int = 2;
pub const NWEP_ENTRY_REVOCATION: c_int = 3;
pub const NWEP_ENTRY_ANCHOR_CHANGE: c_int = 4;
#[repr(C)]
#[derive(Clone, Copy)]
pub struct nwep_keybinding {
pub node_id: [u8; NWEP_NODEID_SIZE],
pub pubkey: [u8; NWEP_PUBKEY_SIZE],
pub recovery_commitment: [u8; 32],
pub timestamp: u64,
pub signature: [u8; 64],
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct nwep_keyrotation {
pub node_id: [u8; NWEP_NODEID_SIZE],
pub old_pubkey: [u8; NWEP_PUBKEY_SIZE],
pub new_pubkey: [u8; NWEP_PUBKEY_SIZE],
pub timestamp: u64,
pub overlap_expiry: u64,
pub sig_old: [u8; 64],
pub sig_new: [u8; 64],
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct nwep_revocation {
pub node_id: [u8; NWEP_NODEID_SIZE],
pub revoked_pubkey: [u8; NWEP_PUBKEY_SIZE],
pub recovery_pubkey: [u8; NWEP_PUBKEY_SIZE],
pub reason: u8,
pub timestamp: u64,
pub signature: [u8; 64],
}
extern "C" {
pub fn nwep_log_entry_type(bytes: *const u8, len: usize) -> c_int;
pub fn nwep_keybinding_create(
pubkey: *const u8,
recovery_commitment: *const u8,
timestamp: u64,
privkey: *const u8,
out: *mut u8,
outlen: *mut usize,
) -> c_int;
pub fn nwep_keybinding_decode(bytes: *const u8, len: usize, out: *mut nwep_keybinding)
-> c_int;
pub fn nwep_keyrotation_create(
node_id: *const u8,
old_pubkey: *const u8,
new_pubkey: *const u8,
timestamp: u64,
overlap_expiry: u64,
old_privkey: *const u8,
new_privkey: *const u8,
out: *mut u8,
outlen: *mut usize,
) -> c_int;
pub fn nwep_keyrotation_decode(
bytes: *const u8,
len: usize,
out: *mut nwep_keyrotation,
) -> c_int;
pub fn nwep_revocation_create(
node_id: *const u8,
revoked_pubkey: *const u8,
recovery_pubkey: *const u8,
reason: u8,
timestamp: u64,
recovery_privkey: *const u8,
out: *mut u8,
outlen: *mut usize,
) -> c_int;
pub fn nwep_revocation_decode(bytes: *const u8, len: usize, out: *mut nwep_revocation)
-> c_int;
pub fn nwep_log_create() -> *mut nwep_log;
pub fn nwep_log_free(log: *mut nwep_log);
pub fn nwep_log_append(log: *mut nwep_log, bytes: *const u8, len: usize) -> i64;
pub fn nwep_log_size(log: *const nwep_log) -> u64;
pub fn nwep_log_root(log: *const nwep_log, out_root: *mut u8) -> c_int;
}
pub enum nwep_log_server {}
pub type nwep_log_append_fn =
unsafe extern "C" fn(ctx: *mut c_void, entry: *const u8, len: usize, index: u64);
extern "C" {
pub fn nwep_log_server_create(
identity: *const nwep_keypair,
log: *mut nwep_log,
) -> *mut nwep_log_server;
pub fn nwep_log_server_free(ls: *mut nwep_log_server);
pub fn nwep_log_server_set_on_append(
ls: *mut nwep_log_server,
cb: Option<nwep_log_append_fn>,
ctx: *mut c_void,
);
pub fn nwep_log_server_dispatch(
ls: *mut nwep_log_server,
conn_id: u64,
req: *const nwep_message,
resp: *mut nwep_buf,
now_secs: i64,
) -> c_int;
}
#[cfg(feature = "trust")]
pub const NWEP_BLS_PUBKEY_SIZE: usize = 48;
#[cfg(feature = "trust")]
pub const NWEP_BLS_SECKEY_SIZE: usize = 32;
#[cfg(feature = "trust")]
pub const NWEP_BLS_SIGNATURE_SIZE: usize = 96;
#[cfg(feature = "trust")]
pub enum nwep_checkpoint {}
#[cfg(feature = "trust")]
pub enum nwep_trust_store {}
#[cfg(feature = "trust")]
pub const NWEP_CHECKPOINT_FRESH: c_int = 0;
#[cfg(feature = "trust")]
pub const NWEP_CHECKPOINT_WARNING: c_int = 1;
#[cfg(feature = "trust")]
pub const NWEP_CHECKPOINT_STALE: c_int = 2;
#[cfg(feature = "trust")]
extern "C" {
pub fn nwep_trust_version() -> *const c_char;
pub fn nwep_bls_keygen(out_sk: *mut u8, out_pk: *mut u8) -> c_int;
pub fn nwep_bls_sign(out_sig: *mut u8, sk: *const u8, msg: *const u8, msg_len: usize) -> c_int;
pub fn nwep_bls_verify(sig: *const u8, pk: *const u8, msg: *const u8, msg_len: usize) -> c_int;
pub fn nwep_bls_aggregate(out_sig: *mut u8, sigs: *const u8, n: usize) -> c_int;
pub fn nwep_bls_verify_aggregate(
agg_sig: *const u8,
pks: *const u8,
n: usize,
msg: *const u8,
msg_len: usize,
) -> c_int;
pub fn nwep_checkpoint_decode(
bytes: *const u8,
len: usize,
out_cp: *mut *mut nwep_checkpoint,
) -> c_int;
pub fn nwep_checkpoint_free(cp: *mut nwep_checkpoint);
pub fn nwep_checkpoint_staleness(cp: *const nwep_checkpoint, now_secs: i64) -> c_int;
pub fn nwep_genesis_checkpoint_create(
bls_secrets: *const u8,
bls_pubkeys: *const u8,
indices: *const u8,
n_founders: usize,
threshold: usize,
out: *mut u8,
outlen: *mut usize,
) -> c_int;
pub fn nwep_trust_store_create() -> *mut nwep_trust_store;
pub fn nwep_trust_store_free(ts: *mut nwep_trust_store);
pub fn nwep_trust_store_load_genesis_anchors(
ts: *mut nwep_trust_store,
pubkeys: *const u8,
n: usize,
) -> c_int;
pub fn nwep_trust_store_update_checkpoint(
ts: *mut nwep_trust_store,
cp_bytes: *const u8,
cp_len: usize,
now_secs: i64,
) -> c_int;
pub fn nwep_checkpoint_verify(
ts: *const nwep_trust_store,
cp_bytes: *const u8,
cp_len: usize,
now_secs: i64,
) -> c_int;
pub fn nwep_trust_store_observe_log_size(ts: *mut nwep_trust_store, observed: u64) -> c_int;
pub fn nwep_trust_store_max_log_size(ts: *const nwep_trust_store) -> u64;
pub fn nwep_trust_store_save(
ts: *const nwep_trust_store,
out: *mut u8,
outlen: *mut usize,
) -> c_int;
pub fn nwep_trust_store_load(ts: *mut nwep_trust_store, bytes: *const u8, len: usize) -> c_int;
pub fn nwep_trust_store_evaluate_key_rotation(
rotation_bytes: *const u8,
rotation_len: usize,
presented_pubkey: *const u8,
now_secs: i64,
) -> c_int;
pub fn nwep_trust_store_verify_key(
ts: *mut nwep_trust_store,
client: *mut nwep_client,
node_id: *const u8,
recovery_commitment: *const u8,
now_secs: i64,
) -> c_int;
pub fn nwep_trust_store_verify_key_binding(
ts: *mut nwep_trust_store,
node_id: *const u8,
expected_pubkey: *const u8,
bundle: *const u8,
bundle_len: usize,
now_secs: i64,
) -> c_int;
pub fn nwep_trust_store_apply_anchor_change(
ts: *mut nwep_trust_store,
entry_bytes: *const u8,
entry_len: usize,
current_epoch: u64,
) -> c_int;
}
#[cfg(feature = "trust")]
pub enum nwep_anchor_node {}
#[cfg(feature = "trust")]
extern "C" {
pub fn nwep_anchor_node_create(
pubkey: *const u8,
privkey: *const u8,
bls_secret: *const u8,
bls_pubkey: *const u8,
share_index: u64,
collection_window_ms: u64,
) -> *mut nwep_anchor_node;
pub fn nwep_anchor_node_free(node: *mut nwep_anchor_node);
pub fn nwep_anchor_node_collect_log_root(
node: *mut nwep_anchor_node,
epoch: u64,
server_root: *const u8,
server_log_size: u64,
local_root: *const u8,
) -> c_int;
pub fn nwep_anchor_node_dispatch(
node: *mut nwep_anchor_node,
requester_node_id: *const u8,
anchor_ids: *const u8,
n_anchors: usize,
req: *const nwep_message,
resp: *mut nwep_buf,
now_secs: i64,
) -> c_int;
pub fn nwep_anchor_node_produce_partial_sig(
node: *mut nwep_anchor_node,
epoch: u64,
merkle_root: *const u8,
log_size: u64,
out_index: *mut u8,
out_sig: *mut u8,
) -> c_int;
pub fn nwep_anchor_request_partial_sig(
client: *mut nwep_client,
epoch: u64,
merkle_root: *const u8,
log_size: u64,
peer_bls_pubkey: *const u8,
out_index: *mut u8,
out_sig: *mut u8,
) -> c_int;
pub fn nwep_anchor_finish_checkpoint(
epoch: u64,
merkle_root: *const u8,
log_size: u64,
indices: *const u8,
sigs: *const u8,
n_partials: usize,
anchor_bls_pks: *const u8,
n_anchors: usize,
out: *mut u8,
outlen: *mut usize,
) -> c_int;
}