예제 #1
0
 /**
  * Testing all the getters and setters in the entity class
  */
 public function testGettersAndSetters()
 {
     $array = $this->getDummyHmacData();
     $this->entity->setData($array['data']);
     $this->entity->setKey($array['key']);
     $this->entity->setTime($array['time']);
     $this->entity->setHmac($array['hmac']);
     $this->assertTrue($array['data'] === $this->entity->getData());
     $this->assertTrue($array['key'] === $this->entity->getKey());
     $this->assertTrue($array['time'] === $this->entity->getTime());
     $this->assertTrue($array['hmac'] === $this->entity->getHmac());
 }
예제 #2
0
파일: Manager.php 프로젝트: rolies106/hmac
 /**
  * Checks the HMAC key to make sure it is valid
  *
  * @param string $hmac
  * @return boolean
  */
 public function isValid($hmac)
 {
     $this->adapter->encode();
     if (time() - $this->entity->getTime() >= $this->ttl && $this->ttl != 0 || $hmac != $this->entity->getHmac()) {
         return false;
     }
     return true;
 }
예제 #3
0
파일: Manager.php 프로젝트: mardy-git/hmac
 /**
  * Checks the HMAC key to make sure it is valid
  *
  * @param string $hmac
  * @return boolean
  */
 public function isValid($hmac)
 {
     $this->adapter->encode();
     return !(time() - $this->entity->getTime() >= $this->ttl && $this->ttl != 0 || $hmac != $this->entity->getHmac());
 }