passkey support

This commit is contained in:
NekoCH
2025-03-09 14:34:25 +08:00
parent 7b0b51cb7e
commit e035ff1512
15 changed files with 1463 additions and 701 deletions

32
app/Models/Passkey.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
namespace App\Models;
class Passkey extends NexusModel
{
protected $table = 'user_passkeys';
public $timestamps = true;
protected $fillable = [
'id', 'user_id', 'AAGUID', 'credential_id', 'public_key', 'counter',
];
public function user()
{
return $this->belongsTo(User::class, 'user_id');
}
public function AAGUID() {
$guid = $this->AAGUID;
return sprintf(
'%s-%s-%s-%s-%s',
substr($guid, 0, 8),
substr($guid, 8, 4),
substr($guid, 12, 4),
substr($guid, 16, 4),
substr($guid, 20, 12)
);
}
}