示例#1
0
 /**
  * Calculate the hash.
  *
  * @param string $uri The uri to calculate the hash for.
  *
  * @return string
  */
 private function computeHash($uri)
 {
     if (!isset($this->secret)) {
         $this->secret = $this->tensideConfig->getSecret();
     }
     return urlencode(base64_encode(hash_hmac('sha256', $uri, $this->secret, true)));
 }
示例#2
0
 /**
  * Create a new instance.
  *
  * @param TensideJsonConfig $config The configuration.
  *
  * @throws \LogicException When no secret has been defined.
  */
 public function __construct(TensideJsonConfig $config)
 {
     $this->secret = $config->getSecret();
     $this->localId = $config->getLocalDomain();
 }