pub enum Decryptor<R> {
Recipients(RecipientsDecryptor<R>),
Passphrase(PassphraseDecryptor<R>),
}
Expand description
Decryptor for an age file.
Variants§
Recipients(RecipientsDecryptor<R>)
Decryption with a list of identities.
Passphrase(PassphraseDecryptor<R>)
Decryption with a passphrase.
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.
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.
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.