Imbo\EventListener\Authenticate::signatureIsValid PHP Method

signatureIsValid() private method

Check if the signature is valid
private signatureIsValid ( string $httpMethod, string $url, string $publicKey, array $privateKey, string $timestamp, string $signature ) : boolean
$httpMethod string The current HTTP method
$url string The accessed URL
$publicKey string The current public key
$privateKey array The private key to sign the hash with
$timestamp string A valid timestamp
$signature string The signature to compare with
return boolean
    private function signatureIsValid($httpMethod, $url, $publicKey, $privateKey, $timestamp, $signature)
    {
        // Generate data for the HMAC
        $data = $httpMethod . '|' . $url . '|' . $publicKey . '|' . $timestamp;
        // Compare
        if ($signature === hash_hmac($this->algorithm, $data, $privateKey)) {
            return true;
        }
        return false;
    }