checkCode() публичный Метод

Check is the given passcode $code is a valid TOTP generated using secret key $secret
public checkCode ( string $secret, string $code, integer $time = null ) : boolean
$secret string The Base32-encoded secret key
$code string The passcode to check
$time integer The time to check it against. Leave null to check for the current server time.
Результат boolean True if the code is valid
Пример #1
0
 public function testCheckCode()
 {
     $secret = '4FDAGLLSP6BIVU5H';
     $time = 1375000339;
     $code = $this->totp->getCode($secret, $time);
     $codePrev = $this->totp->getCode($secret, $time - 30);
     $codeNext = $this->totp->getCode($secret, $time + 30);
     $this->assertTrue($this->totp->checkCode($secret, $code, $time));
     $this->assertTrue($this->totp->checkCode($secret, $codePrev, $time));
     $this->assertTrue($this->totp->checkCode($secret, $codeNext, $time));
 }