Skip to content

Commit

Permalink
Merge pull request marucjmar#9 from 47ng/feat/client-server-separation
Browse files Browse the repository at this point in the history
Allow building separate client/server packages
  • Loading branch information
marucjmar authored Feb 2, 2023
2 parents 71aa948 + 53a0453 commit a99c848
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ description = "An implementation of the OPAQUE key exchange protocol in WASM(Web
crate-type = ["cdylib", "rlib"]

[features]
default = ["console_error_panic_hook"]
default = ["console_error_panic_hook", "client", "server"]
client = ["console_error_panic_hook", "wee_alloc"]
server = ["console_error_panic_hook"]

[dependencies]
wasm-bindgen = "0.2.63"
Expand Down Expand Up @@ -43,6 +45,7 @@ wasm-bindgen-test = "0.3.13"
[profile.release]
# Tell `rustc` to optimize for small code size.
opt-level = "s"
strip = "debuginfo"

[package.metadata.wasm-pack.profile.release]
wasm-opt = false
11 changes: 11 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
#[cfg(feature = "client")]
pub mod client_login;
#[cfg(feature = "client")]
pub mod client_registration;
#[cfg(feature = "server")]
pub mod handle_login;
#[cfg(feature = "server")]
pub mod handle_registration;
#[cfg(feature = "server")]
pub mod server_setup;

mod hash_methods;
mod utils;

Expand All @@ -12,10 +18,15 @@ mod utils;
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;

#[cfg(feature = "client")]
pub use client_login::Login;
#[cfg(feature = "client")]
pub use client_registration::Registration;
#[cfg(feature = "server")]
pub use handle_login::HandleLogin;
#[cfg(feature = "server")]
pub use handle_registration::HandleRegistration;
#[cfg(feature = "server")]
pub use server_setup::ServerSetup;

// -----------------------------------------------------------------------------
Expand Down

0 comments on commit a99c848

Please sign in to comment.