protected function setUp() { $tm = new TOTPTimeManager(); $this->stamp = $tm->getCurrentStamp(); $this->validator = new TOTPValidator(35, 5); $this->key = TOTPKeyGenerator::generate(); }
public function testKeyGeneration() { for ($i = 0; $i < 15; ++$i) { $length = rand(8, 100); $key = TOTPKeyGenerator::generate($length); $this->assertRegExp(sprintf('#[%s]{%d}#', $this->characters, $length), $key); } }