public function verify($otp, $secret) {
    $timeTick = $this->getTimestamp();
    $storeId  = $this->getStoreId($secret);
    try {
      $store = $this->psl['store']->read('google-auth', $storeId);
      for($tick = $timeTick - $this->_deviate ; $tick <= $timeTick + $this->_deviate; $tick++) {
        $tickOtp = $this->getToken($secret, $tick);
        if($store !== false) {
          /**
           * This secret has been used before, so we have to make sure that:
           * 1. This token has not been used before.
           * 2. This token is not older than the last one.
           * 3. We keep the Sith from world domination.
           */
          if($otp === $store['lastOtp'] || $store['lastTick'] > $tick) {
            continue;
          }
        }

        if($tickOtp === $otp) {
          $store['lastTick'] = $tick;
          $store['lastOtp']  = $otp;
          $this->psl['store']->write('google-auth', $storeId, $store);
          return true;
        }
      }
      return false;
    } catch (\phpSec\Exception $e) { /* Say what? */
      return false;
    }
  }
public function verify($otp, $secret) {
    $timeTick = $this->getTimestamp();
    $storeId  = $this->getStoreId($secret);
    try {
      $store = $this->psl['store']->read('google-auth', $storeId);
      for($tick = $timeTick - $this->_deviate ; $tick <= $timeTick + $this->_deviate; $tick++) {
        $tickOtp = $this->getToken($secret, $tick);
        if($store !== false) {
          /**
           * This secret has been used before, so we have to make sure that:
           * 1. This token has not been used before.
           * 2. This token is not older than the last one.
           * 3. We keep the Sith from world domination.
           */
          if($otp === $store['lastOtp'] || $store['lastTick'] > $tick) {
            continue;
          }
        }

        if($tickOtp === $otp) {
          $store['lastTick'] = $tick;
          $store['lastOtp']  = $otp;
          $this->psl['store']->write('google-auth', $storeId, $store);
          return true;
        }
      }
      return false;
    } catch (\phpSec\Exception $e) { /* Say what? */
      return false;
    }
  }
public function verify ( $ otp , $ secret ) { $ timeTick = $ this -> getTimestamp ( ) ; $ storeId = $ this -> getStoreId ( $ secret ) ; try { $ store = $ this -> psl [ 'store' ] -> read ( 'google-auth' , $ storeId ) ; for ( $ tick = $ timeTick - $ this -> _deviate ; $ tick <= $ timeTick + $ this -> _deviate ; $ tick ++ ) { $ tickOtp = $ this -> getToken ( $ secret , $ tick ) ; if ( $ store !== false ) { /**
           * This secret has been used before, so we have to make sure that:
           * 1. This token has not been used before.
           * 2. This token is not older than the last one.
           * 3. We keep the Sith from world domination.
           */ if ( $ otp === $ store [ 'lastOtp' ] || $ store [ 'lastTick' ] > $ tick ) { continue ; } } if ( $ tickOtp === $ otp ) { $ store [ 'lastTick' ] = $ tick ; $ store [ 'lastOtp' ] = $ otp ; $ this -> psl [ 'store' ] -> write ( 'google-auth' , $ storeId , $ store ) ; return true ; } } return false ; } catch ( \ phpSec \ Exception $ e ) { /* Say what? */ return false ; } }
Verify a OTP token.

@param string $otp
OTP token to verify.

@param string $secret
User secret key.

@return boolean
Returns true if the OTP is valid.
Verify a OTP token .