Example #1
0
 /**
  * Calculates hash
  * @param IInput $input
  * @return string
  *
  * @throws \Drahak\Restful\InvalidStateException
  */
 public function calculate(IInput $input)
 {
     if (!$this->privateKey) {
         throw new InvalidStateException('Private key is not set');
     }
     $dataString = $this->mapper->stringify($input->getData());
     return hash_hmac(self::HASH, $dataString, $this->privateKey);
 }