Ejemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 public function sign($client, $secret, $version, $method, $resource)
 {
     $this->nonce = bin2hex(openssl_random_pseudo_bytes(10));
     $param = array('client' => $client, 'hash' => $this->hash, 'method' => strtoupper($method), 'nonce' => $this->nonce, 'resource' => $resource, 'timestamp' => time(), 'version' => $version);
     ksort($param);
     $param['signature'] = hash_hmac($this->hash, Compat::buildQuery($param), $secret);
     return $param;
 }
Ejemplo n.º 2
0
 public function testIndexedArrayBuildQuery()
 {
     $query = Compat::buildQuery(array('a' => array('b' => 'c', 'd' => 'e'), 'f' => 'g'));
     $this->assertSame('a%5Bb%5D=c&a%5Bd%5D=e&f=g', $query);
 }