wallet_adapter_common/
errors.rs

1/// Convenience type for `Result<T, WalletUtilsError>`
2pub type WalletUtilsResult<T> = Result<T, WalletUtilsError>;
3
4/// Errors for this crate
5#[derive(Debug, PartialEq, Eq, Clone, thiserror::Error)]
6pub enum WalletUtilsError {
7    /// Overflow during SystemTime::checked_add(expiration_time_milliseconds) overflow
8    #[error("SystemTime::checked_add(expiration_time_milliseconds) overflow")]
9    SystemTimeCheckedAddOverflow,
10    /// This token expires earlier than it was issued. Make sure to set the expiry time to be a later date than the issued time
11    #[error("This token expires earlier than it was issued. Make sure to set the expiry time to be a later date than the issued time")]
12    ExpiryTimeEarlierThanIssuedTime,
13    /// The expiration time is set to expire in the past
14    #[error("The expiration time is set to expire in the past")]
15    ExpirationTimeIsInThePast,
16    /// This token becomes valid earlier than it was issued. Make sure to set the not_before time to be equal to or a later date than the issued time
17    #[error("This token becomes valid earlier than it was issued. Make sure to set the not_before time to be equal to or a later date than the issued time")]
18    NotBeforeTimeEarlierThanIssuedTime,
19    /// NotBefore time is set in the past
20    #[error("NotBefore time is set in the past")]
21    NotBeforeTimeIsInThePast,
22    /// This token becomes valid after it has already expired. Make sure to set the not_before time to be equal to or a date before expiry time
23    #[error("This token becomes valid after it has already expired. Make sure to set the not_before time to be equal to or a date before expiry time")]
24    NotBeforeTimeLaterThanExpirationTime,
25    ///Expected a timestamp in the format specified by ISO8601
26    #[error("Invalid ISO 8601 timestamp `{0}. Only timestamps in the format specified by ISO8601 are supported.")]
27    InvalidISO8601Timestamp(String),
28    /// Invalid Base58 Address
29    #[error("Invalid Base58 Address")]
30    InvalidBase58Address,
31    /// The bytes provided for the Ed25519 Public Key are invalid
32    #[error("The bytes provided for the Ed25519 Public Key are invalid")]
33    InvalidEd25519PublicKeyBytes,
34    /// The Ed25519 Signature is invalid for the signed message and public key")]
35    #[error("The Ed25519 Signature is invalid for the signed message and public key")]
36    InvalidSignature,
37    /// The byte length should be equal to 64 bytes in length
38    #[error("The byte length should be equal to 64 bytes in length")]
39    Expected64ByteLength,
40    /// The byte length should be equal to 32 bytes in length
41    #[error("The byte length should be equal to 32 bytes in length")]
42    Expected32ByteLength,
43    /// The nonce is required to be at least 8 characters long
44    #[error("The nonce is required to be at least 8 characters long")]
45    NonceMustBeAtLeast8Characters,
46    /// The message signed by the wallet is not the same as the message sent to the wallet for signing
47    #[error("The message signed by the wallet is not the same as the message sent to the wallet for signing")]
48    MessageResponseMismatch,
49}