'datetime', 'password' => 'hashed', 'two_factor_enabled' => 'boolean', 'two_factor_recovery_codes' => 'array', ]; public function isTwoFactorEnabled(): bool { return $this->two_factor_enabled === true; } public function getTwoFactorSecret(): ?string { return $this->two_factor_secret ? decrypt($this->two_factor_secret) : null; } public function setTwoFactorSecret(string $secret): void { $this->two_factor_secret = encrypt($secret); } public function generateRecoveryCodes(): array { $codes = []; for ($i = 0; $i < 8; $i++) { $codes[] = bin2hex(random_bytes(4)); } return $codes; } }