示例#1
0
 public function testSetAcceptedVersionsWithSingleValue()
 {
     $obj = new SqrlConfiguration();
     $obj->setAcceptedVersions(1);
     $this->assertEquals(array(1), $obj->getAcceptedVersions());
 }
示例#2
0
 /**
  * Generates a random, one time use key to be used in the sqrl validation
  *
  * The implementation of this may get more complicated depending on the
  * requirements detailed in any reference implementation. Users wanting to
  * make this library more (or less) secure should override this function
  * to strengthen (or weaken) the randomness of the generation.
  *
  * @param int    $action [Optional] The type of action this nonce is being generated for
  * @param string $key [Optional] The public key associated with the nonce
  * @param string $previousNonce [Optional] The previous nonce in the transaction that should be associated to this nonce
  *
  * @return string
  */
 protected function generateNonce($action = 0, $key = '', $previousNonce = '')
 {
     $this->nonce = hash_hmac('sha256', uniqid('', true), $this->configuration->getNonceSalt());
     $this->store->storeNonce($this->nonce, $action, $key, $previousNonce);
     return $this->nonce;
 }