Skip to content

Commit

Permalink
adjust newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
Monadic-Cat committed Jan 19, 2024
1 parent 305f7bd commit 6366b39
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion twilight-util/src/signature_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use twilight_model::application::interaction::Interaction;
#[derive(Debug)]
pub struct FromHexError(hex::FromHexError);


/// A signature or public key was invalid.
#[derive(Debug)]
pub struct SigError(SignatureError);
Expand All @@ -26,11 +25,13 @@ pub enum SignatureValidationFailure {
/// Request had invalid signature for the given public key.
InvalidSignature(SigError),
}

impl std::fmt::Display for SignatureValidationFailure {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self)
}
}

impl std::error::Error for SignatureValidationFailure {}

/// Parsing the public key failed.
Expand All @@ -41,11 +42,13 @@ pub enum KeyError {
/// The public key was malformed.
MalformedKey(SignatureError),
}

impl std::fmt::Display for KeyError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self)
}
}

impl std::error::Error for KeyError {}

/// The key you are meant to get from the Discord Developer Portal,
Expand Down Expand Up @@ -103,6 +106,7 @@ impl From<SignatureValidationFailure> for ExtractFailure {
Self::Signature(value)
}
}

impl From<serde_json::Error> for ExtractFailure {
fn from(value: serde_json::Error) -> Self {
Self::Deserialize(value)
Expand Down

0 comments on commit 6366b39

Please sign in to comment.