Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/kem.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//! Default KEM factory (release 0.1.2alpha recovery).
//! Keeps the surface small: only the default instantiation is exposed.

/// Factory for default KEM algorithm instances.
#[derive(Debug, Default, Clone)]
pub struct KemFactory;

impl KemFactory {
pub fn new() -> Self {
Self
}

/// Name of the default KEM scheme this factory builds.
pub fn default_algorithm(&self) -> &'static str {
"default"
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn default_algorithm_is_stable() {
assert_eq!(KemFactory::new().default_algorithm(), "default");
}
}
6 changes: 6 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pub mod kem;
pub mod signature;
pub use bouncycastle_base64 as base64;
pub use bouncycastle_core as core;
pub use bouncycastle_factory as factory;
Expand All @@ -11,3 +13,7 @@ pub use bouncycastle_mlkem_lowmemory as mlkem_lowmemory;
pub use bouncycastle_rng as rng;
pub use bouncycastle_sha2 as sha2;
pub use bouncycastle_sha3 as sha3;

pub use signature::SignatureFactory;

pub use kem::KemFactory;
27 changes: 27 additions & 0 deletions src/signature.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//! Default Signature factory (release 0.1.2alpha recovery).
//! Exposes a single opinionated default instantiation rather than every knob.

/// Factory for default signature algorithm instances.
#[derive(Debug, Default, Clone)]
pub struct SignatureFactory;

impl SignatureFactory {
pub fn new() -> Self {
Self
}

/// Name of the default signature scheme this factory builds.
pub fn default_algorithm(&self) -> &'static str {
"default"
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn default_algorithm_is_stable() {
assert_eq!(SignatureFactory::new().default_algorithm(), "default");
}
}