protected function isValidLoginRequest()
    {
        $check_hash = $this->queryParameters->get('hash');

        // Get sorted array of values
        $check = $this->queryParameters
            ->except('hash')
            ->map(function ($value, $key) {
                return $key.'='.$value;
            })
            ->values()
            ->sort();
        $check_string = implode("\n", $check->toArray());

        $secret = hash('sha256', $this->config->get('token'), true);
        $hash = hash_hmac('sha256', $check_string, $secret);

        if (strcmp($hash, $check_hash) !== 0) {
            return false;
        }
        if ((time() - $this->queryParameters->get('auth_date')) > 86400) {
            return false;
        }

        return true;
    }
protected function isValidLoginRequest()
    {
        $check_hash = $this->queryParameters->get('hash');

        // Get sorted array of values
        $check = $this->queryParameters
            ->except('hash')
            ->map(function ($value, $key) {
                return $key.'='.$value;
            })
            ->values()
            ->sort();
        $check_string = implode("\n", $check->toArray());

        $secret = hash('sha256', $this->config->get('token'), true);
        $hash = hash_hmac('sha256', $check_string, $secret);

        if (strcmp($hash, $check_hash) !== 0) {
            return false;
        }
        if ((time() - $this->queryParameters->get('auth_date')) > 86400) {
            return false;
        }

        return true;
    }
protected function isValidLoginRequest ( ) { $ check_hash = $ this -> queryParameters -> get ( 'hash' ) ; // Get sorted array of values $ check = $ this -> queryParameters -> except ( 'hash' ) -> map ( function ( $ value , $ key ) { return $ key . '=' . $ value ; } ) -> values ( ) -> sort ( ) ; $ check_string = implode ( "\n" , $ check -> toArray ( ) ) ; $ secret = hash ( 'sha256' , $ this -> config -> get ( 'token' ) , true ) ; $ hash = hash_hmac ( 'sha256' , $ check_string , $ secret ) ; if ( strcmp ( $ hash , $ check_hash ) !== 0 ) { return false ; } if ( ( time ( ) - $ this -> queryParameters -> get ( 'auth_date' ) ) > 86400 ) { return false ; } return true ; }
Check if the query parameters contain information about a
valid Telegram login request.

@return bool
Check if the query parameters contain information about a valid Telegram login request .