Ejemplo n.º 1
0
 /**
  * Creates a signature string for use with recurly.js
  *
  * @param array $data
  *
  * @throws \InvalidArgumentException
  * @return string
  */
 public function sign(array $data)
 {
     if (null === $this->privateKey) {
         throw new \InvalidArgumentException('No privateKey set');
     }
     $data += ['nonce' => md5(uniqid()), 'timestamp' => time()];
     $query = http_build_query($data);
     return Hasher::hash($query, $this->privateKey) . '|' . $query;
 }
Ejemplo n.º 2
0
 public function testHash()
 {
     $this->assertEquals('85d155c55ed286a300bd1cf124de08d87e914f3a', Hasher::hash('foo', 'bar'));
 }