use serde::{Deserialize, Serialize};
use tfhe_versionable::Versionize;
use crate::conformance::ParameterSetConformant;
use crate::high_level_api::backward_compatibility::transciphering::StreamCiphertextVersions;
use crate::integer::transciphering::{
IntegerStreamCiphertext, IntegerStreamCiphertextConformanceParams, IntegerStreamCiphertextKind,
};
use crate::named::Named;
use crate::transciphering::StreamCipherKind;
#[derive(Clone, Debug, Serialize, Deserialize, Versionize)]
#[versionize(StreamCiphertextVersions)]
pub struct StreamCiphertext {
inner: IntegerStreamCiphertext,
}
impl StreamCiphertext {
pub fn cipher_kind(&self) -> StreamCipherKind {
self.inner.inner().kind()
}
pub fn kind(&self) -> IntegerStreamCiphertextKind {
self.inner.kind()
}
pub fn encryption_counter(&self) -> u64 {
self.inner.inner().encryption_counter()
}
pub fn n_bits(&self) -> usize {
self.inner.n_bits()
}
pub fn from_raw_parts(inner: IntegerStreamCiphertext) -> Self {
Self { inner }
}
pub fn into_raw_parts(self) -> IntegerStreamCiphertext {
self.inner
}
pub(super) fn integer(&self) -> &IntegerStreamCiphertext {
&self.inner
}
}
impl ParameterSetConformant for StreamCiphertext {
type ParameterSet = IntegerStreamCiphertextConformanceParams;
fn is_conformant(&self, params: &Self::ParameterSet) -> bool {
self.inner.is_conformant(params)
}
}
impl Named for StreamCiphertext {
const NAME: &'static str = "high_level_api::StreamCiphertext";
}