• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/security/mfa/totpalgorithm.php
  • Класс: BitrixMainSecurityMfaTotpAlgorithm
  • Вызов: TotpAlgorithm::getSyncParameters
public function getSyncParameters($inputA, $inputB)
{
	$offset = 0;
	$this->window = 0;

	// Before detect clock drift we must check current time :-)
	[$isSuccess,] = $this->verify($inputA, $offset);

	if (!$isSuccess)
	{
		// Otherwise try to calculate resynchronization
		$offset = -self::SYNC_WINDOW;
		for ($i = $offset; $i < self::SYNC_WINDOW; $i++)
		{
			[$isSuccess,] = $this->verify($inputA, $offset);
			if ($isSuccess)
			{
				break;
			}
			$offset++;
		}
	}

	if ($offset === self::SYNC_WINDOW)
	{
		throw new OtpException('Cannot synchronize this secret key with the provided password values.');
	}

	return sprintf('%d:%d', $offset, 0);
}