<?php
//Obfuscated by YAK Pro - Php Obfuscator 2.0.13 at 2025-06-18 09:19:09
 namespace App\Traits; use PragmaRX\Google2FA\Google2FA; use Illuminate\Support\Facades\Cache; use Illuminate\Support\Str; use BaconQrCode\Renderer\ImageRenderer; use BaconQrCode\Renderer\Image\SvgImageBackEnd; use BaconQrCode\Renderer\RendererStyle\RendererStyle; use BaconQrCode\Writer; trait TwoFactorAuthenticatable { public function initializeTwoFactorAuthenticatable() { goto umLL0; umLL0: if (isset($this->hidden)) { goto Y9RKk; } $this->hidden = []; Y9RKk: goto Wzg0j; JslPF: if (isset($this->casts)) { goto FtReW; } $this->casts = []; FtReW: goto R7FvC; Wzg0j: $r3WKh = ["\147\x6f\157\x67\x6c\x65\x32\146\141\137\x73\145\x63\x72\145\x74", "\x74\x77\x6f\137\146\141\143\x74\x6f\162\x5f\x72\x65\143\x6f\x76\x65\162\171\137\143\x6f\144\145\163"]; foreach ($r3WKh as $zT47Z) { if (in_array($zT47Z, $this->hidden)) { goto RwReP; } $this->hidden[] = $zT47Z; RwReP: exKPJ: } mKgZj: goto JslPF; R7FvC: $this->casts = array_merge(["\x67\157\x6f\x67\x6c\145\62\146\x61\137\145\156\x61\142\x6c\145\x64" => "\142\157\x6f\154\x65\x61\156", "\147\x6f\x6f\147\154\145\62\146\x61\137\x76\x65\162\x69\146\x69\145\x64" => "\142\x6f\157\x6c\x65\141\156", "\162\x65\143\x6f\x76\145\x72\171\x5f\143\157\144\145\163" => "\141\162\x72\141\x79"], $this->casts); goto baQSM; baQSM: } public function getRecoveryCodesAttribute() { if (!empty($this->two_factor_recovery_codes)) { goto iDcJ4; } return []; iDcJ4: return json_decode(decrypt($this->two_factor_recovery_codes), true); } public function setRecoveryCodesAttribute($cIv0o) { $this->attributes["\x74\167\157\137\x66\x61\x63\x74\157\162\x5f\162\145\x63\x6f\x76\145\162\171\137\143\x6f\x64\x65\x73"] = encrypt(json_encode($cIv0o)); } public function enableTwoFactorAuth($MipaX = null) { $this->forceFill(["\x67\157\x6f\147\x6c\145\x32\x66\x61\137\163\x65\143\x72\x65\164" => $MipaX ?: app("\160\x72\x61\147\x6d\x61\162\x78\x2e\147\x6f\x6f\147\x6c\x65\62\x66\x61")->generateSecretKey(), "\x67\157\157\147\154\x65\x32\146\141\137\145\x6e\x61\142\154\145\144" => true, "\x67\x6f\157\147\x6c\145\62\x66\141\137\166\x65\x72\151\146\151\145\x64" => false])->save(); } public function disableTwoFactorAuth() { $this->forceFill(["\x67\x6f\x6f\x67\x6c\145\62\x66\141\x5f\163\145\x63\162\145\164" => null, "\147\157\157\147\154\145\x32\x66\x61\x5f\x65\156\141\142\154\x65\144" => false, "\147\x6f\157\147\154\x65\62\146\x61\x5f\x76\x65\162\151\146\x69\x65\144" => false, "\164\167\157\x5f\x66\141\143\164\157\x72\x5f\x72\x65\x63\157\x76\x65\x72\x79\137\143\157\144\145\163" => null])->save(); } protected function generateRecoveryCode() { return strtoupper(Str::random(10)); } public function generateNewRecoveryCodes() { $cIv0o = collect(range(1, 8))->map(function () { return $this->generateRecoveryCode(); })->all(); $this->recovery_codes = $cIv0o; $this->save(); return $cIv0o; } public function twoFactorQrCodeSvg() { $AVr63 = $this->twoFactorQrCodeUrl(); $mH885 = new ImageRenderer(new RendererStyle(200), new SvgImageBackEnd()); $NATod = new Writer($mH885); return $NATod->writeString($AVr63); } public function twoFactorQrCodeUrl() { $CznUt = app("\160\x72\141\147\x6d\141\162\170\56\147\157\x6f\147\x6c\x65\x32\x66\141"); return $CznUt->getQRCodeUrl(config("\141\160\x70\x2e\x6e\141\x6d\145"), $this->email, $this->google2fa_secret); } public function verifyTwoFactorCode($t8PeW) { goto E_9XN; KKjyz: return $CznUt->verifyKey($this->google2fa_secret, $t8PeW, config("\x61\x75\x74\x68\56\62\x66\141\x2e\167\x69\156\x64\157\x77", 1)); goto UYq_3; MOZ2e: if (!in_array($t8PeW, $this->recovery_codes ?? [])) { goto M19ss; } $this->recovery_codes = array_values(array_diff($this->recovery_codes, [$t8PeW])); $this->save(); goto L73I0; L73I0: return true; M19ss: $CznUt = app("\x70\x72\x61\147\x6d\x61\x72\x78\56\147\157\157\x67\x6c\x65\62\146\141"); goto KKjyz; E_9XN: if (!empty($this->google2fa_secret)) { goto KK26u; } return false; KK26u: goto MOZ2e; UYq_3: } }