mirror of
https://codeberg.org/Mo8it/git-webhook-client
synced 2024-11-21 11:06:32 +00:00
Remove unneeded async
This commit is contained in:
parent
1f3046c4d3
commit
46ad6275ba
1 changed files with 2 additions and 5 deletions
|
@ -37,7 +37,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ReceivedSignature {
|
impl ReceivedSignature {
|
||||||
pub async fn is_valid(&self, secret: &[u8], body: &[u8]) -> bool {
|
pub fn is_valid(&self, secret: &[u8], body: &[u8]) -> bool {
|
||||||
let mut mac = Hmac::<Sha256>::new_from_slice(secret)
|
let mut mac = Hmac::<Sha256>::new_from_slice(secret)
|
||||||
.expect("Can not generate a mac from the secret!");
|
.expect("Can not generate a mac from the secret!");
|
||||||
mac.update(body);
|
mac.update(body);
|
||||||
|
@ -69,10 +69,7 @@ where
|
||||||
|
|
||||||
let state_config = state.config();
|
let state_config = state.config();
|
||||||
|
|
||||||
if !received_signature
|
if !received_signature.is_valid(&state_config.secret, &body) {
|
||||||
.is_valid(&state_config.secret, &body)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
return Err("Invalid signature!".into());
|
return Err("Invalid signature!".into());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue