packages/otplib-core/totpCheckWithWindow.js
function totpCheckWithWindow(token, secret, options) {
  let opt = Object.assign({}, options);

  const bounds = getWindowBounds(opt);
  const checker = createChecker(token, secret, opt);
  const backward = checker(-1, 0, bounds[0]);
  return backward !== null ? backward : checker(1, 1, bounds[1]);
}
function totpCheckWithWindow(token, secret, options) {
  let opt = Object.assign({}, options);

  const bounds = getWindowBounds(opt);
  const checker = createChecker(token, secret, opt);
  const backward = checker(-1, 0, bounds[0]);
  return backward !== null ? backward : checker(1, 1, bounds[1]);
}
function totpCheckWithWindow ( token , secret , options ) { let opt = Object . assign ( { } , options ) ; const bounds = getWindowBounds ( opt ) ; const checker = createChecker ( token , secret , opt ) ; const backward = checker ( - 1 , 0 , bounds [ 0 ] ) ; return backward !== null ? backward : checker ( 1 , 1 , bounds [ 1 ] ) ; }
Checks the provided OTP token against system generated token
with support for checking previous or future x time-step windows

@module otplib-core/totpCheckWithWindow
@param {string} token - the OTP token to check
@param {string} secret - your secret that is used to generate the token
@param {object} options - options which was used to generate it originally
@return {integer | null} - the number of windows back (eg: -1) or forward if it was successful. null otherwise
Checks the provided OTP token against system generated token with support for checking previous or future x time - step windows