Example #1
0
 /**
  * Construct a new mOTP configuration.
  *
  * @param integer|null $futureWindows The number of future windows to check.
  * @param integer|null $pastWindows   The number of past windows to check.
  */
 public function __construct($futureWindows = null, $pastWindows = null)
 {
     if (null === $futureWindows) {
         $futureWindows = 3;
     }
     if (null === $pastWindows) {
         $pastWindows = 3;
     }
     parent::__construct(6, 10, $futureWindows, $pastWindows, 8);
 }
Example #2
0
 /**
  * Construct a new TOTP configuration.
  *
  * @param integer|null           $digits        The number of password digits.
  * @param integer|null           $window        The number of seconds each token is valid for.
  * @param integer|null           $futureWindows The number of future windows to check.
  * @param integer|null           $pastWindows   The number of past windows to check.
  * @param integer|null           $secretLength  The length of the shared secret.
  * @param HotpHashAlgorithm|null $algorithm     The underlying algorithm to use.
  *
  * @throws InvalidPasswordLengthException If the number of digits is invalid.
  */
 public function __construct($digits = null, $window = null, $futureWindows = null, $pastWindows = null, $secretLength = null, HotpHashAlgorithm $algorithm = null)
 {
     if (null !== $digits && $digits > 10) {
         throw new InvalidPasswordLengthException($digits);
     }
     if (null === $algorithm) {
         $algorithm = HotpHashAlgorithm::SHA1();
     }
     parent::__construct($digits, $window, $futureWindows, $pastWindows, $secretLength);
     $this->algorithm = $algorithm;
 }