pub struct Decryptor<R> { /* private fields */ }Expand description
Decryptor for an age file.
Implementations§
Source§impl<R: Read> Decryptor<R>
impl<R: Read> Decryptor<R>
Sourcepub fn new(input: R) -> Result<Self, DecryptError>
pub fn new(input: R) -> Result<Self, DecryptError>
Attempts to create a decryptor for an age file.
Returns an error if the input does not contain a valid age file.
§Performance
This constructor will work with any type implementing io::Read, and uses a
slower parser and internal buffering to ensure no overreading occurs. Consider
using Decryptor::new_buffered for types implementing std::io::BufRead, which
includes &[u8] slices.
Sourcepub fn decrypt<'a>(
self,
identities: impl Iterator<Item = &'a dyn Identity>,
) -> Result<StreamReader<R>, DecryptError>
pub fn decrypt<'a>( self, identities: impl Iterator<Item = &'a dyn Identity>, ) -> Result<StreamReader<R>, DecryptError>
Attempts to decrypt the age file.
If successful, returns a reader that will provide the plaintext.
Source§impl<R: BufRead> Decryptor<R>
impl<R: BufRead> Decryptor<R>
Sourcepub fn new_buffered(input: R) -> Result<Self, DecryptError>
pub fn new_buffered(input: R) -> Result<Self, DecryptError>
Attempts to create a decryptor for an age file.
Returns an error if the input does not contain a valid age file.
§Performance
This constructor is more performant than Decryptor::new for types implementing
io::BufRead, which includes &[u8] slices.
Source§impl<R: AsyncRead + Unpin> Decryptor<R>
impl<R: AsyncRead + Unpin> Decryptor<R>
Sourcepub async fn new_async(input: R) -> Result<Self, DecryptError>
Available on crate feature async only.
pub async fn new_async(input: R) -> Result<Self, DecryptError>
async only.Attempts to create a decryptor for an age file.
Returns an error if the input does not contain a valid age file.
§Performance
This constructor will work with any type implementing AsyncRead, and uses a
slower parser and internal buffering to ensure no overreading occurs. Consider
using Decryptor::new_async_buffered for types implementing AsyncBufRead,
which includes &[u8] slices.
Sourcepub fn decrypt_async<'a>(
self,
identities: impl Iterator<Item = &'a dyn Identity>,
) -> Result<StreamReader<R>, DecryptError>
Available on crate feature async only.
pub fn decrypt_async<'a>( self, identities: impl Iterator<Item = &'a dyn Identity>, ) -> Result<StreamReader<R>, DecryptError>
async only.Attempts to decrypt the age file.
If successful, returns a reader that will provide the plaintext.
Source§impl<R: AsyncBufRead + Unpin> Decryptor<R>
impl<R: AsyncBufRead + Unpin> Decryptor<R>
Sourcepub async fn new_async_buffered(input: R) -> Result<Self, DecryptError>
Available on crate feature async only.
pub async fn new_async_buffered(input: R) -> Result<Self, DecryptError>
async only.Attempts to create a decryptor for an age file.
Returns an error if the input does not contain a valid age file.
§Performance
This constructor is more performant than Decryptor::new_async for types
implementing AsyncBufRead, which includes &[u8] slices.
Auto Trait Implementations§
impl<R> Freeze for Decryptor<R>where
R: Freeze,
impl<R> RefUnwindSafe for Decryptor<R>where
R: RefUnwindSafe,
impl<R> Send for Decryptor<R>where
R: Send,
impl<R> Sync for Decryptor<R>where
R: Sync,
impl<R> Unpin for Decryptor<R>where
R: Unpin,
impl<R> UnwindSafe for Decryptor<R>where
R: UnwindSafe,
Blanket Implementations§
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> 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 more