pub struct CompiledEncryption { /* private fields */ }encryption only.Expand description
A compiled, validated encryption policy: the derived write key plus every derived read key (write key first).
Implementations§
Source§impl CompiledEncryption
impl CompiledEncryption
Sourcepub fn compile(spec: &EncryptionSpec) -> Result<Self, FaucetError>
pub fn compile(spec: &EncryptionSpec) -> Result<Self, FaucetError>
Validate and compile an EncryptionSpec. Fail-fast: empty key
material is a typed config error at load time, never mid-run.
Sourcepub fn encrypt(&self, plaintext: &[u8]) -> Vec<u8> ⓘ
pub fn encrypt(&self, plaintext: &[u8]) -> Vec<u8> ⓘ
Seal plaintext with the current key under a fresh random nonce.
Sourcepub fn encrypt_bound(&self, plaintext: &[u8], context: &[u8]) -> Vec<u8> ⓘ
pub fn encrypt_bound(&self, plaintext: &[u8], context: &[u8]) -> Vec<u8> ⓘ
encrypt, binding context (the identity of what is
sealed — a state key, say) as associated data: the payload opens only
through decrypt_bound with the same context,
so a sealed file copied over another key’s file no longer decrypts.
Sourcepub fn decrypt(&self, data: &[u8]) -> Result<Vec<u8>, FaucetError>
pub fn decrypt(&self, data: &[u8]) -> Result<Vec<u8>, FaucetError>
Open a sealed payload, trying the current key and then each previous
key. Every failure is a typed error — a wrong key or tampered file
must never be silently treated as “no data”. A context-bound payload
needs decrypt_bound.
Sourcepub fn decrypt_bound(
&self,
data: &[u8],
context: &[u8],
) -> Result<Vec<u8>, FaucetError>
pub fn decrypt_bound( &self, data: &[u8], context: &[u8], ) -> Result<Vec<u8>, FaucetError>
Open a payload sealed by encrypt_bound under
context, or a legacy unbound one.
Source§impl CompiledEncryption
impl CompiledEncryption
Sourcepub fn open_line(&self, sealed: &[u8]) -> Result<SealedLine, FaucetError>
pub fn open_line(&self, sealed: &[u8]) -> Result<SealedLine, FaucetError>
Open one sealed line of a per-line sealed file, telling record lines from the header and trailer by the context each was sealed under.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CompiledEncryption
impl RefUnwindSafe for CompiledEncryption
impl Send for CompiledEncryption
impl Sync for CompiledEncryption
impl Unpin for CompiledEncryption
impl UnsafeUnpin for CompiledEncryption
impl UnwindSafe for CompiledEncryption
Blanket Implementations§
impl<T> Allocation 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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> ⓘ
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> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request