Skip to content

Instantly share code, notes, and snippets.

@smiell
Created March 24, 2024 19:07
Show Gist options
  • Save smiell/26881295d5e1703897da8f6036a8ce1d to your computer and use it in GitHub Desktop.
Save smiell/26881295d5e1703897da8f6036a8ce1d to your computer and use it in GitHub Desktop.
// 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