src/ImboClient/EventSubscriber/Authenticate.php
private function addAuthenticationHeaders(Request $request) {
        $client = $request->getClient();

        // Get a GMT/UTC timestamp
        $timestamp = gmdate('Y-m-d\TH:i:s\Z');

        // Build the data to base the hash on
        $data = $request->getMethod() . '|' .
                $request->getUrl() . '|' .
                $client->getConfig('publicKey') . '|' .
                $timestamp;

        // Generate signature
        $signature = hash_hmac('sha256', $data, $client->getConfig('privateKey'));

        // Add relevant request headers (overwriting once that might already exist)
        $request->setHeader('X-Imbo-Authenticate-Signature', $signature);
        $request->setHeader('X-Imbo-Authenticate-Timestamp', $timestamp);
    }
private function addAuthenticationHeaders(Request $request) {
        $client = $request->getClient();

        // Get a GMT/UTC timestamp
        $timestamp = gmdate('Y-m-d\TH:i:s\Z');

        // Build the data to base the hash on
        $data = $request->getMethod() . '|' .
                $request->getUrl() . '|' .
                $client->getConfig('publicKey') . '|' .
                $timestamp;

        // Generate signature
        $signature = hash_hmac('sha256', $data, $client->getConfig('privateKey'));

        // Add relevant request headers (overwriting once that might already exist)
        $request->setHeader('X-Imbo-Authenticate-Signature', $signature);
        $request->setHeader('X-Imbo-Authenticate-Timestamp', $timestamp);
    }
private function addAuthenticationHeaders ( Request $ request ) { $ client = $ request -> getClient ( ) ; // Get a GMT/UTC timestamp $ timestamp = gmdate ( 'Y-m-d\TH:i:s\Z' ) ; // Build the data to base the hash on $ data = $ request -> getMethod ( ) . '|' . $ request -> getUrl ( ) . '|' . $ client -> getConfig ( 'publicKey' ) . '|' . $ timestamp ; // Generate signature $ signature = hash_hmac ( 'sha256' , $ data , $ client -> getConfig ( 'privateKey' ) ) ; // Add relevant request headers (overwriting once that might already exist) $ request -> setHeader ( 'X-Imbo-Authenticate-Signature' , $ signature ) ; $ request -> setHeader ( 'X-Imbo-Authenticate-Timestamp' , $ timestamp ) ; }
Sign the current request for write operations

@param Request $request The current request
Sign the current request for write operations