cw_auth_types/errors.rs
1
2#[cfg(feature = "session")]
3pub use smart_account_auth::SessionError;
4pub use smart_account_auth::ReplayError;
5pub use smart_account_auth::StorageError;
6pub use smart_account_auth::AuthError;
7
8
9
10/* #[saa_error]
11pub enum SessionError {
12 #[error("The session key has already expired")]
13 Expired,
14
15 #[error("No session key found")]
16 NotFound,
17
18 #[error("Only the owner or session key granter can perform this operation")]
19 NotOwner,
20
21 #[error("This session key wasn't granted to the given grantee")]
22 NotGrantee,
23
24 #[error("Must have both id and name specified")]
25 InvalidGrantee,
26
27 #[error("Invalid data or indifferent from the grantee")]
28 InvalidGranter,
29
30 #[error("Passed a list with no actions. Use AllowedActions::All() if you want to allow all of them")]
31 EmptyCreateActions,
32
33 #[error("No actions passed to execute")]
34 EmptyPassedActions,
35
36 #[error("Couldn't derivate a String result from given message and method")]
37 DerivationError,
38
39 #[error("Invalid actions provided. Check that there are no empty results not dublicates")]
40 InvalidActions,
41
42 #[error("Session creation messages aren't allowed to be in allowed message list")]
43 InnerSessionAction,
44
45 #[error("Current item cant't be used with the given session key")]
46 NotAllowedAction,
47}
48 */
49
50/* #[saa_error]
51pub enum ReplayError {
52 #[error("{0} is invalid as nonce. Expected: {1}")]
53 DifferentNonce(u64, u64),
54
55 #[error("The provided credential was meant for a different chain")]
56 ChainIdMismatch,
57
58 #[error("The provided credential was meant for a different contract address")]
59 ContractMismatch,
60
61 #[error("Error converting binary to {0}")]
62 Convertation(String),
63}
64 */
65
66
67
68
69
70
71
72/* #[saa_error]
73pub enum AuthError {
74
75 #[error("No credentials provided or credentials are partially missing")]
76 NoCredentials,
77
78 #[error("{0}")]
79 MissingData(String),
80
81 #[error("Invalid length of {0}. Expected: {1}; Received: {2}")]
82 InvalidLength(String, u16, u16),
83
84 #[error("Values of v other than 27 and 28 not supported. Replay protection (EIP-155) cannot be used here.")]
85 RecoveryParam,
86
87 #[error("Error recovering from the signature: Addresses do not match")]
88 RecoveryMismatch,
89
90 #[error("The signed data is expected to be a replay attach protection envelope")]
91 InvalidSignedData,
92
93 #[error("Passkey challenge must be base64url to base64 encoded string")]
94 PasskeyChallenge,
95
96 #[error("Unauthorized: {0}")]
97 Unauthorized(String),
98
99 #[error("{0}")]
100 Signature(String),
101
102 #[error("{0}")]
103 Recovery(String),
104
105 #[error("{0}")]
106 Generic(String),
107
108 #[error("{0}")]
109 Crypto(String),
110
111 #[error("Error converting binary to {0}")]
112 Convertation(String),
113
114 #[error("Semver parsing error: {0}")]
115 SemVer(String),
116
117 #[error("{0}")]
118 SAAAuthError(#[from] SAAAuthError),
119
120 #[error("Std: {0}")]
121 StdError(#[from] StdError),
122
123 #[error("Replay Protection Error: {0}")]
124 Replay(#[from] ReplayError),
125
126 #[error("{0}")]
127 Storage(#[from] StorageError),
128
129 #[cfg(feature = "session")]
130 #[error("Session Error: {0}")]
131 Session(#[from] SessionError),
132}
133 */
134
135
136
137/* impl AuthError {
138 pub fn generic<M: Into<String>>(msg: M) -> Self {
139 AuthError::Generic(msg.into())
140 }
141}
142 */