You are here

public function Subscription::checkSignature in Feeds 8.3

Verifies that the content that was pushed comes from a verified source.

Parameters

string $sha1: The HMAC signature from the hub.

string $data: The data to hash and then compare to the hub's signature.

Return value

bool True if the signature is valid, false otherwise.

Overrides SubscriptionInterface::checkSignature

File

src/Entity/Subscription.php, line 117

Class

Subscription
Defines the subscription entity class.

Namespace

Drupal\feeds\Entity

Code

public function checkSignature($sha1, $data) {
  return $sha1 === hash_hmac('sha1', $data, $this
    ->getSecret());
}