refactor: Refactor PasskeysController and Passkey model

- Remove unused `use` statements and imports in `PasskeysController.php` and `Passkey.php`
- Improve code cleanliness and remove unnecessary dependencies
This commit is contained in:
Jonny Barnes 2023-10-27 20:33:43 +01:00
parent 4253764f39
commit 483b3016ba
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8
2 changed files with 5 additions and 8 deletions

View file

@ -16,8 +16,6 @@ use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Illuminate\View\View;
use ParagonIE\ConstantTime\Base64UrlSafe;
use Throwable;
@ -126,7 +124,7 @@ class PasskeysController extends Controller
$publicKeyCredential = $publicKeyCredentialLoader->load(json_encode($request->all(), JSON_THROW_ON_ERROR));
if (!$publicKeyCredential->response instanceof AuthenticatorAttestationResponse) {
if (! $publicKeyCredential->response instanceof AuthenticatorAttestationResponse) {
throw new WebAuthnException('Invalid response type');
}
@ -198,7 +196,7 @@ class PasskeysController extends Controller
$publicKeyCredential = $publicKeyCredentialLoader->load(json_encode($request->all(), JSON_THROW_ON_ERROR));
if (!$publicKeyCredential->response instanceof AuthenticatorAssertionResponse) {
if (! $publicKeyCredential->response instanceof AuthenticatorAssertionResponse) {
return response()->json([
'success' => false,
'message' => 'Invalid response type',
@ -206,7 +204,7 @@ class PasskeysController extends Controller
}
$passkey = Passkey::firstWhere('passkey_id', $publicKeyCredential->id);
if (!$passkey) {
if (! $passkey) {
return response()->json([
'success' => false,
'message' => 'Passkey not found',

View file

@ -4,7 +4,6 @@ declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;