‪TYPO3CMS  11.5
TYPO3\CMS\Core\Authentication\Mfa\Provider\RecoveryCodes Class Reference

Public Member Functions

 __construct (string $mode)
 
array generateRecoveryCodes ()
 
string[] generatePlainRecoveryCodes (int $length=8, int $quantity=8)
 
array generatedHashedRecoveryCodes (array $codes)
 
bool verifyRecoveryCode (string $recoveryCode, array &$codes)
 

Protected Attributes

string $mode
 
PasswordHashFactory $passwordHashFactory
 

Private Attributes

const MIN_LENGTH = 8
 

Detailed Description

Implementation for generation and validation of recovery codes

should only be used by the TYPO3 Core

Definition at line 29 of file RecoveryCodes.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Authentication\Mfa\Provider\RecoveryCodes::__construct ( string  $mode)

Member Function Documentation

◆ generatedHashedRecoveryCodes()

array TYPO3\CMS\Core\Authentication\Mfa\Provider\RecoveryCodes::generatedHashedRecoveryCodes ( array  $codes)

Hash the given plain recovery codes with the default hash instance and return them

Parameters
array$codes
Returns
‪array

Definition at line 95 of file RecoveryCodes.php.

Referenced by TYPO3\CMS\Core\Authentication\Mfa\Provider\RecoveryCodes\generateRecoveryCodes().

◆ generatePlainRecoveryCodes()

string [] TYPO3\CMS\Core\Authentication\Mfa\Provider\RecoveryCodes::generatePlainRecoveryCodes ( int  $length = 8,
int  $quantity = 8 
)

Generate given amount of plain recovery codes with the given length

Parameters
int$length
int$quantity
Returns
‪string[]

Definition at line 60 of file RecoveryCodes.php.

Referenced by TYPO3\CMS\Core\Authentication\Mfa\Provider\RecoveryCodes\generateRecoveryCodes().

◆ generateRecoveryCodes()

array TYPO3\CMS\Core\Authentication\Mfa\Provider\RecoveryCodes::generateRecoveryCodes ( )

Generate plain and hashed recovery codes and return them as key/value

Returns
‪array

Definition at line 47 of file RecoveryCodes.php.

References TYPO3\CMS\Core\Authentication\Mfa\Provider\RecoveryCodes\generatedHashedRecoveryCodes(), and TYPO3\CMS\Core\Authentication\Mfa\Provider\RecoveryCodes\generatePlainRecoveryCodes().

◆ verifyRecoveryCode()

bool TYPO3\CMS\Core\Authentication\Mfa\Provider\RecoveryCodes::verifyRecoveryCode ( string  $recoveryCode,
array &  $codes 
)

Compare given recovery code against all hashed codes and unset the corresponding code on success.

Parameters
string$recoveryCode
array$codes
Returns
‪bool

Definition at line 115 of file RecoveryCodes.php.

Member Data Documentation

◆ $mode

string TYPO3\CMS\Core\Authentication\Mfa\Provider\RecoveryCodes::$mode
protected

◆ $passwordHashFactory

PasswordHashFactory TYPO3\CMS\Core\Authentication\Mfa\Provider\RecoveryCodes::$passwordHashFactory
protected

Definition at line 34 of file RecoveryCodes.php.

◆ MIN_LENGTH

const TYPO3\CMS\Core\Authentication\Mfa\Provider\RecoveryCodes::MIN_LENGTH = 8
private

Definition at line 31 of file RecoveryCodes.php.