1#![doc = include_str!("../README.md")]
2#![no_std]
3#![cfg_attr(docsrs, feature(doc_auto_cfg))]
4#![doc(
5 html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/8f1a9894/logo.svg",
6 html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/8f1a9894/logo.svg",
7 html_root_url = "https://docs.rs/kem"
8)]
9#![forbid(unsafe_code)]
10#![warn(missing_docs, unused_qualifications, missing_debug_implementations)]
11
12use core::fmt::Debug;
13use rand_core::CryptoRngCore;
14
15pub trait Encapsulate<EK, SS> {
19 type Error: Debug;
21
22 fn encapsulate(&self, rng: &mut impl CryptoRngCore) -> Result<(EK, SS), Self::Error>;
24}
25
26pub trait Decapsulate<EK, SS> {
30 type Error: Debug;
32
33 fn decapsulate(&self, encapsulated_key: &EK) -> Result<SS, Self::Error>;
35}