diff --git a/src/kem.rs b/src/kem.rs new file mode 100644 index 00000000..4fe7ae67 --- /dev/null +++ b/src/kem.rs @@ -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"); + } +} diff --git a/src/lib.rs b/src/lib.rs index b46df8cd..89b572ff 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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; @@ -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; diff --git a/src/signature.rs b/src/signature.rs new file mode 100644 index 00000000..ba142443 --- /dev/null +++ b/src/signature.rs @@ -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"); + } +}