pub mod compose;
pub mod keys;
pub mod message;
pub mod mime;
#[cfg(feature = "wasm")]
mod wasm;
pub use keys::{Kind, PublicKey, SecretKey};
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("not an OpenPGP key: {0}")]
Key(String),
#[error("the key has no usable subkey for encryption")]
NoEncryptionKey,
#[error("wrong passphrase, or the protected key is damaged")]
Unlock,
#[error("cannot decrypt the message with these keys")]
Decrypt,
#[error("not an encrypted message")]
NotEncrypted,
#[error("not a mail message")]
NotMail,
#[error("OpenPGP: {0}")]
Pgp(String),
}
impl From<pgp::errors::Error> for Error {
fn from(error: pgp::errors::Error) -> Self {
Error::Pgp(error.to_string())
}
}
pub type Result<T> = std::result::Result<T, Error>;