- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/lib/security/mfa/otpalgorithm.php
- Класс: BitrixMainSecurityMfaOtpAlgorithm
- Вызов: OtpAlgorithm::generateUri
public function generateUri($label, array $opts = [])
{
$positionalOpts = [
// Don't change order!
'secret' => Base32::encode($this->getSecret()),
];
$opts['algorithm'] = $this->getDigest();
// Digest must be in upper case for some OTP apps (e.g. Google Authenticator for iOS)
$opts['algorithm'] = mb_strtoupper($opts['algorithm']);
$opts['digits'] = $this->getDigits();
ksort($opts);
// Some devices require a specific order for some parameters (e.g. Microsoft Authenticator require "secret" at first place %) )
$opts = array_merge(
$positionalOpts,
$opts
);
$params = http_build_query($opts, '', '&', PHP_QUERY_RFC3986);
return sprintf(
'%s://%s/%s?%s',
$this->getAppScheme(),
$this->getType(),
rawurlencode($label),
$params
);
}