1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#[derive(Debug, snafu::Snafu)]
#[snafu(visibility = "pub")]
pub enum Error {
#[snafu(display("failed to create block mode decryptor: {}", source))]
CreateBlockMode {
source: block_modes::InvalidKeyIvLength,
},
#[snafu(display("failed to decrypt: {}", source))]
Decrypt { source: block_modes::BlockModeError },
#[snafu(display("failed to parse pinentry output ({:?})", out,))]
FailedToParsePinentry { out: Vec<u8> },
#[snafu(display(
"failed to parse pinentry output ({:?}): {}",
out,
source
))]
FailedToParsePinentryUtf8 {
out: Vec<u8>,
source: std::string::FromUtf8Error,
},
// no Error impl
// #[snafu(display("failed to expand with hkdf: {}", source))]
// HkdfExpand { source: hkdf::InvalidLength },
#[snafu(display("failed to expand with hkdf"))]
HkdfExpand,
// no Error impl
// #[snafu(display("failed to create hkdf: {}", source))]
// HkdfFromPrk { source: hkdf::InvalidPrkLength },
#[snafu(display("failed to create hkdf"))]
HkdfFromPrk,
#[snafu(display("invalid base64: {}", source))]
InvalidBase64 { source: base64::DecodeError },
#[snafu(display("invalid cipherstring"))]
InvalidCipherString,
#[snafu(display("invalid mac"))]
InvalidMac,
// no Error impl
// #[snafu(display("invalid mac key: {}", source))]
// InvalidMacKey { source: hmac::crypto_mac::InvalidKeyLength },
#[snafu(display("invalid mac key"))]
InvalidMacKey,
#[snafu(display("error waiting for pinentry to exit: {}", source))]
ProcessWaitOutput { source: tokio::io::Error },
#[snafu(display("error making api request: {}", source))]
Reqwest { source: reqwest::Error },
#[snafu(display("error spawning pinentry: {}", source))]
Spawn { source: tokio::io::Error },
#[snafu(display("error writing to pinentry stdin: {}", source))]
WriteStdin { source: tokio::io::Error },
}
pub type Result<T> = std::result::Result<T, Error>;
|