Struct Encryption
pub struct Encryption<C = AutoStrategy> { /* private fields */ }Implementations§
§impl<Creds> Encryption<Creds>
impl<Creds> Encryption<Creds>
pub fn new(root_key: IndexKey, client: ZeroKMSWithClientKey<Creds>) -> Self
pub async fn encrypt<T: Into<BytesWithDescriptor>>( &self, items: impl IntoIterator<Item = T>, ) -> Result<Vec<EncryptedRecord>, EncryptionError>
pub async fn encrypt_single( &self, target: PlaintextTarget, ) -> Result<EncryptedRecord, EncryptionError>
pub async fn decrypt_single( &self, ciphertext: EncryptedRecord, ) -> Result<Plaintext, EncryptionError>
pub async fn maybe_decrypt_hex<I, C>(
&self,
ciphertexts: I,
) -> Result<Vec<Option<Plaintext>>, EncryptionError>
pub async fn maybe_decrypt_hex<I, C>( &self, ciphertexts: I, ) -> Result<Vec<Option<Plaintext>>, EncryptionError>
Like decrypt but doesn’t expect all values to be decryptable.
This only means that a given input is None or the slice is not a
serialized EncryptedRecord.
In the future this could also cover cases
where the caller is not authorized to decrypt a given value.
As it stands, this function will return an Error if any valid ciphertexts fail to decrypt.
Items in the returned vec wil be in the same order as the input
but any values that are unable to be decrypted will be returned as None.
Encrypted records must be encoded with hex.
pub async fn decrypt( &self, ciphertexts: impl IntoIterator<Item = EncryptedRecord>, ) -> Result<Vec<Plaintext>, EncryptionError>
pub fn index( &self, value: &Plaintext, index_type: &IndexType, ) -> Result<IndexTerm, EncryptionError>
pub fn index_all( &self, target: &PlaintextTarget, ) -> Result<Vec<IndexTerm>, EncryptionError>
pub fn compound_index( &self, index: &CompoundIndex<impl ComposableIndex + Send>, input: impl Into<ComposablePlaintext>, salt: Option<impl AsRef<[u8]>>, term_length: usize, ) -> Result<IndexTerm, EncryptionError>
pub fn compound_query( &self, index: &CompoundIndex<impl ComposableIndex + Send>, input: impl Into<ComposablePlaintext>, salt: Option<impl AsRef<[u8]>>, term_length: usize, ) -> Result<IndexTerm, EncryptionError>
pub fn index_for_operator( &self, value: &Plaintext, index_type: &IndexType, operator: &Operator, cast_type: &ColumnType, ) -> Result<IndexTerm, EncryptionError>
Auto Trait Implementations§
impl<C = AutoStrategy> !Freeze for Encryption<C>
impl<C = AutoStrategy> !RefUnwindSafe for Encryption<C>
impl<C = AutoStrategy> !UnwindSafe for Encryption<C>
impl<C> Send for Encryption<C>where
C: Send,
impl<C> Sync for Encryption<C>where
C: Sync,
impl<C> Unpin for Encryption<C>where
C: Unpin,
impl<C> UnsafeUnpin for Encryption<C>where
C: UnsafeUnpin,
Blanket Implementations§
impl<T> AuthStrategyBounds for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more