1pub mod compose;
8pub mod keys;
9pub mod message;
10pub mod mime;
11#[cfg(feature = "wasm")]
12mod wasm;
13
14pub use keys::{Kind, PublicKey, SecretKey};
15
16#[derive(Debug, thiserror::Error)]
18pub enum Error {
19 #[error("not an OpenPGP key: {0}")]
20 Key(String),
21 #[error("the key has no usable subkey for encryption")]
22 NoEncryptionKey,
23 #[error("wrong passphrase, or the protected key is damaged")]
24 Unlock,
25 #[error("cannot decrypt the message with these keys")]
26 Decrypt,
27 #[error("not an encrypted message")]
28 NotEncrypted,
29 #[error("not a mail message")]
30 NotMail,
31 #[error("OpenPGP: {0}")]
32 Pgp(String),
33}
34
35impl From<pgp::errors::Error> for Error {
36 fn from(error: pgp::errors::Error) -> Self {
37 Error::Pgp(error.to_string())
38 }
39}
40
41pub type Result<T> = std::result::Result<T, Error>;