Files
pterodactyl-panel/app/Contracts/Users/TogglesTwoFactor.php
T
6c0413e39b Start 2.0 development
Co-authored-by: Anthony <anthony@infraly.co>
Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
2026-10-05 18:10:18 -04:00

30 lines
987 B
PHP

<?php
declare(strict_types=1);
namespace Pterodactyl\Contracts\Users;
use PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException;
use PragmaRX\Google2FA\Exceptions\InvalidCharactersException;
use PragmaRX\Google2FA\Exceptions\SecretKeyTooShortException;
use Pterodactyl\Exceptions\Service\User\TwoFactorAuthenticationTokenInvalid;
use Pterodactyl\Models\User;
use Throwable;
interface TogglesTwoFactor
{
/**
* Toggle 2FA on an account only if the token provided is valid.
*
* @return list<string> The plaintext recovery tokens generated for the account,
* empty when 2FA is being turned off.
*
* @throws Throwable
* @throws IncompatibleWithGoogleAuthenticatorException
* @throws InvalidCharactersException
* @throws SecretKeyTooShortException
* @throws TwoFactorAuthenticationTokenInvalid
*/
public function toggle(User $user, string $token, ?bool $toggleState = null): array;
}