public function validate($otp, $action, $uid = null, $data = null) {
    $hash  = $this->psl['crypt/hash'];
    $store = $this->psl['store'];

    if($uid === null) {
	    $uid = $this->psl->getUid();
	  }

    $storeData = $store->read('otp', $this->storeId($uid, $action));

    if($storeData !== false) {
      if($storeData['ttl'] < time()) {
        $store->delete('otp', $this->storeId($uid, $action));
        return false;
      }

      if($hash->check($otp, $storeData['pw']) && $hash->check(serialize($data), $storeData['data'])) {
        $store->delete('otp', $this->storeId($uid, $action));
        return true;
      }
    }
    return false;
  }
public function validate($otp, $action, $uid = null, $data = null) {
    $hash  = $this->psl['crypt/hash'];
    $store = $this->psl['store'];

    if($uid === null) {
	    $uid = $this->psl->getUid();
	  }

    $storeData = $store->read('otp', $this->storeId($uid, $action));

    if($storeData !== false) {
      if($storeData['ttl'] < time()) {
        $store->delete('otp', $this->storeId($uid, $action));
        return false;
      }

      if($hash->check($otp, $storeData['pw']) && $hash->check(serialize($data), $storeData['data'])) {
        $store->delete('otp', $this->storeId($uid, $action));
        return true;
      }
    }
    return false;
  }
public function validate ( $ otp , $ action , $ uid = null , $ data = null ) { $ hash = $ this -> psl [ 'crypt/hash' ] ; $ store = $ this -> psl [ 'store' ] ; if ( $ uid === null ) { $ uid = $ this -> psl -> getUid ( ) ; } $ storeData = $ store -> read ( 'otp' , $ this -> storeId ( $ uid , $ action ) ) ; if ( $ storeData !== false ) { if ( $ storeData [ 'ttl' ] < time ( ) ) { $ store -> delete ( 'otp' , $ this -> storeId ( $ uid , $ action ) ) ; return false ; } if ( $ hash -> check ( $ otp , $ storeData [ 'pw' ] ) && $ hash -> check ( serialize ( $ data ) , $ storeData [ 'data' ] ) ) { $ store -> delete ( 'otp' , $ this -> storeId ( $ uid , $ action ) ) ; return true ; } } return false ; }
Validate a one-time-password.

@param strgin $otp
OTP supplied by user.

@param string $action
See phpsecOtp::generate().

@param string $uid
See phpsecOtp::generate().

@param array $data
See phpsecOtp::generate().
Validate a one - time - password .