1pub(crate) mod ffi;
2pub(crate) mod sock_compat;
3pub mod error;
4pub mod types;
5pub mod protocol;
6pub mod role;
7pub mod log;
8pub mod encoding;
9pub mod crypto;
10pub mod keypair;
11pub mod bls;
12pub mod addr;
13pub(crate) mod msg;
14pub mod server;
15pub mod client;
16pub mod merkle;
17pub mod logindex;
18pub mod checkpoint;
19pub mod anchor;
20pub mod logserver;
21pub mod anchorserver;
22pub mod trust;
23pub mod cache;
24pub mod pool;
25
26pub use error::Error;
27pub use types::{NodeId, MerkleHash, Tstamp, Duration, Header, Identity};
28pub use role::ServerRole;
29pub use keypair::Keypair;
30pub use bls::{BlsKeypair, BlsPubkey, BlsSig};
31pub use addr::{Addr, Url};
32pub use checkpoint::Checkpoint;
33pub use anchor::AnchorSet;
34pub use merkle::{MerkleEntry, MerkleProof, MerkleLog};
35pub use logindex::LogIndex;
36pub use trust::{TrustStore, TrustSettings, TrustStorage, VerifiedIdentity, Staleness};
37pub use cache::{IdentityCache, IdentityCacheSettings, CachedIdentity, CacheStats};
38pub use pool::{LogServerPool, PoolSettings, PoolServer, PoolStrategy, ServerHealth};
39pub use server::{Server, ServerBuilder, Handler, ResponseWriter, Request, Router, Settings as ServerSettings};
40pub use client::{Client, ClientBuilder, Response, Notification};
41pub use logserver::{LogServer, LogServerSettings};
42pub use anchorserver::{AnchorServer, AnchorServerSettings};
43
44pub fn init() -> Result<(), Error> {
46 error::check(unsafe { ffi::nwep_init() })
47}
48
49pub fn version() -> &'static str {
51 unsafe {
52 let ptr = ffi::nwep_version();
53 if ptr.is_null() {
54 ""
55 } else {
56 std::ffi::CStr::from_ptr(ptr)
57 .to_str()
58 .unwrap_or("")
59 }
60 }
61}