Created
March 24, 2024 19:07
-
-
Save smiell/26881295d5e1703897da8f6036a8ce1d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Check if the passed hash matches the expected one | |
if ( !$this->IsWebhookTrusted( $encryption_key, $signature_header, $data['data'] ) ) { | |
// Hash is not valid | |
// Prepare response message | |
$response_data = array( | |
'status' => 'error', | |
'response' => array( | |
'code' => 403, | |
'message' => 'Hash invalid. Bey, Bey...', | |
), | |
); | |
return new WP_REST_Response( json_encode($response_data) , 403); // Return 403 Forbidden | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment