/** * Construct a new counter-based one-time password authentication * configuration. * * @param integer|null $digits The number of password digits. * @param integer|null $window The amount of counter increments to search through for a match. * @param integer|null $initialCounter The initial counter value. * @param integer|null $secretLength The length of the shared secret. * * @throws InvalidPasswordLengthException If the number of digits is invalid. */ public function __construct($digits = null, $window = null, $initialCounter = null, $secretLength = null) { if (null === $window) { $window = 10; } if (null === $initialCounter) { $initialCounter = 1; } parent::__construct($digits, $secretLength); $this->window = $window; $this->initialCounter = $initialCounter; }
/** * Construct a new time-based one-time password authentication * 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. * * @throws InvalidPasswordLengthException If the number of digits is invalid. */ public function __construct($digits = null, $window = null, $futureWindows = null, $pastWindows = null, $secretLength = null) { if (null === $window) { $window = 30; } if (null === $futureWindows) { $futureWindows = 1; } if (null === $pastWindows) { $pastWindows = 1; } parent::__construct($digits, $secretLength); $this->window = $window; $this->futureWindows = $futureWindows; $this->pastWindows = $pastWindows; }