#![doc = include_str!("../README.md")]
#![warn(unused_results)]
#![cfg_attr(test, allow(unused_results))]
mod as_protected_ref;
mod controlled;
mod conversions;
mod debug;
mod digest;
mod equatable;
mod exportable;
mod ops;
mod protected;
mod timing_safe;
mod usage;
mod zeroed;
use zeroize::Zeroize;
#[cfg(feature = "bitvec")]
pub mod bitvec;
pub mod slice_index;
pub use as_protected_ref::{AsProtectedRef, ProtectedRef};
pub use zeroed::Zeroed;
pub use controlled::Controlled;
pub use digest::ProtectedDigest;
pub use equatable::{ConstantTimeEq, Equatable};
pub use exportable::{Exportable, SafeDeserialize, SafeSerialize};
pub use protected::{flatten_array, Protected};
pub use usage::{Acceptable, DefaultScope, Scope, Usage};
pub use debug::{OpaqueDebug, Redacted};
pub use timing_safe::{Choice, TimingSafeEq};
pub use vitaminc_protected_derive::{OpaqueDebug, TimingSafeEq};
pub trait ReplaceT<K>: private::Sealed {
type Output: Controlled;
}
impl<T, K> ReplaceT<K> for Protected<T>
where
Protected<K>: Controlled,
{
type Output = Protected<K>;
}
impl<T, K> ReplaceT<K> for Equatable<Protected<T>>
where
Equatable<Protected<K>>: Controlled,
{
type Output = Equatable<Protected<K>>;
}
impl<T, K> ReplaceT<K> for Equatable<Exportable<Protected<T>>>
where
Equatable<Exportable<Protected<K>>>: Controlled,
{
type Output = Equatable<Exportable<Protected<K>>>;
}
impl<T, K> ReplaceT<K> for Exportable<Protected<T>>
where
K: Zeroize,
{
type Output = Exportable<Protected<K>>;
}
impl<T, K> ReplaceT<K> for Exportable<Equatable<Protected<T>>>
where
K: Zeroize,
{
type Output = Exportable<Equatable<Protected<K>>>;
}
impl<T, K, S> ReplaceT<K> for Usage<Protected<T>, S>
where
Protected<K>: Controlled,
{
type Output = Protected<K>;
}
mod private {
use crate::{Equatable, Exportable, Protected, Usage};
pub trait Sealed {}
impl<T> Sealed for Protected<T> {}
impl<T> Sealed for Equatable<T> {}
impl<T> Sealed for Exportable<T> {}
impl<T, S> Sealed for Usage<T, S> {}
pub trait ControlledPrivate {}
}