public function isAuthentic()
    {
        // get the Github signature
        $xhub = $this->request->header('X-Hub-Signature') ?: 'nothing';

        // reconstruct the hash on this side
        $hash = 'sha1='.hash_hmac('sha1', $this->request->getContent(), config('auto-deploy.secret'));

        // securely compare them
        return hash_equals($xhub, $hash);
    }
public function isAuthentic()
    {
        // get the Github signature
        $xhub = $this->request->header('X-Hub-Signature') ?: 'nothing';

        // reconstruct the hash on this side
        $hash = 'sha1='.hash_hmac('sha1', $this->request->getContent(), config('auto-deploy.secret'));

        // securely compare them
        return hash_equals($xhub, $hash);
    }
public function isAuthentic ( ) { // get the Github signature $ xhub = $ this -> request -> header ( 'X-Hub-Signature' ) ? : 'nothing' ; // reconstruct the hash on this side $ hash = 'sha1=' . hash_hmac ( 'sha1' , $ this -> request -> getContent ( ) , config ( 'auto-deploy.secret' ) ) ; // securely compare them return hash_equals ( $ xhub , $ hash ) ; }
Verifies the authenticity of a webhook request from Github.

Follows the procedure described here: https://developer.github.com/webhooks/securing/

@return bool Returns true if the request is authentic. False otherwise.
Verifies the authenticity of a webhook request from Github .