You are here

function acquia_agent_valid_response in Acquia Connector 7

Same name and namespace in other branches
  1. 6.2 acquia_agent/acquia_agent_streams.inc \acquia_agent_valid_response()
  2. 6 acquia_agent/acquia_agent_streams.inc \acquia_agent_valid_response()
  3. 7.3 acquia_agent/acquia_agent.module \acquia_agent_valid_response()
  4. 7.2 acquia_agent/acquia_agent.module \acquia_agent_valid_response()

Determine if a response from the Acquia Network is valid.

Parameters

$data: The data array returned by acquia_agent_call().

Return value

TRUE or FALSE.

1 call to acquia_agent_valid_response()
acquia_agent_check_subscription in acquia_agent/acquia_agent.module
Get subscription status from the Acquia Network, and store the result.

File

acquia_agent/acquia_agent.module, line 537
Acquia Agent securely sends information to Acquia Network.

Code

function acquia_agent_valid_response($data) {
  $authenticator = $data['authenticator'];
  $result = $data['result'];
  $result_auth = $result['authenticator'];
  $valid = $authenticator['nonce'] == $result_auth['nonce'];
  $valid = $valid && $authenticator['time'] < $result_auth['time'];
  $key = acquia_agent_settings('acquia_key');
  $hash = _acquia_agent_hmac($key, $result_auth['time'], $result_auth['nonce'], $result['body']);
  return $valid && $hash == $result_auth['hash'];
}