Esempio n. 1
0
 /**
  * Adds the authentication header to the request.
  * @param resource $ch The CURL handle.
  */
 private function getAuthenticationHeaders()
 {
     if (!$this->_config->getSecretKey() || !$this->_config->getAPIKey()) {
         throw new RESTException("An API Key and Secret Key is required to make calls to the api.");
     }
     $date = date_create("now", new \DateTimeZone("GMT"))->format('D, d M Y H:i:s e');
     $hash = hash_hmac("sha1", $date, $this->_config->getSecretKey());
     return array("x-dnsme-apiKey: {$this->_config->getAPIKey()}", "x-dnsme-requestDate: {$date}", "x-dnsme-hmac: {$hash}");
 }
Esempio n. 2
0
 /**
  * @covers DNSMadeEasy\driver\Configuration::getAPIKey
  */
 public function testGetAPIKey()
 {
     $this->assertEquals($this->apiKey, $this->configuration->getAPIKey(), "The api keys do not match");
 }