forked from junkurihara/httpsig-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.rs
More file actions
68 lines (58 loc) · 2.15 KB
/
Copy patherror.rs
File metadata and controls
68 lines (58 loc) · 2.15 KB
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
66
67
68
use thiserror::Error;
/// Result type for http signature
pub type HttpSigResult<T> = std::result::Result<T, HttpSigError>;
/// Error type for http signature
#[derive(Error, Debug)]
pub enum HttpSigError {
#[error("Base64 decode error: {0}")]
Base64DecodeError(#[from] base64::DecodeError),
/* ----- Crypto errors ----- */
/// Invalid private key for asymmetric algorithm
#[error("Failed to parse private key: {0}")]
ParsePrivateKeyError(String),
/// Invalid public key for asymmetric algorithm
#[error("Failed to parse public key: {0}")]
ParsePublicKeyError(String),
/// Signature parse error
#[error("Failed to parse signature: {0}")]
ParseSignatureError(String),
/// Invalid Signature
#[error("Invalid Signature: {0}")]
InvalidSignature(String),
/* ----- Component errors ----- */
/// Failed to parse structured field value
#[error("Failed to parse structured field value: {0}")]
ParseSFVError(String),
/// Invalid http message component name
#[error("Invalid http message component name: {0}")]
InvalidComponentName(String),
/// Invalid http message component param
#[error("Invalid http message component param: {0}")]
InvalidComponentParam(String),
/// Invalid http message component id
#[error("Invalid http message component id: {0}")]
InvalidComponentId(String),
/// Invalid http message component
#[error("Invalid http message component: {0}")]
InvalidComponent(String),
/* ----- Signature params errors ----- */
/// Invalid signature params
#[error("Invalid signature params: {0}")]
InvalidSignatureParams(String),
/// Error in building signature header
#[error("Failed to build signature header: {0}")]
BuildSignatureHeaderError(String),
/// Error in building signature base
#[error("Failed to build signature base: {0}")]
BuildSignatureBaseError(String),
/// Expired signature params
#[error("Expired signature params: {0}")]
ExpiredSignatureParams(String),
/// Invalid algorithm name
#[error("Invalid algorithm name: {0}")]
InvalidAlgorithmName(String),
/* ----- Other errors ----- */
/// NotYetImplemented
#[error("Not yet implemented: {0}")]
NotYetImplemented(String),
}