public function Webhook::setSignature in Webhooks 8
Set the payload signature.
Parameters
string $body: The encoded request body.
Return value
Webhook The webhook.
File
- src/
Webhook.php, line 379
Class
- Webhook
- Class Webhook .
Namespace
Drupal\webhooksCode
public function setSignature($body) {
$this
->addHeaders([
// Add the SHA256 signature for improved security.
'X-Hub-Signature-256' => 'sha256=' . hash_hmac('sha256', $body, $this->secret, FALSE),
// Keep the SHA1 signature for backwards compatibility.
'X-Hub-Signature' => 'sha1=' . hash_hmac('sha1', $body, $this->secret, FALSE),
]);
return $this;
}