. */ namespace App\Entity\UserSystem; use Doctrine\DBAL\Types\Types; use App\Entity\Base\TimestampTrait; use Doctrine\ORM\Mapping as ORM; use Webauthn\PublicKeyCredentialSource as BasePublicKeyCredentialSource; #[ORM\Entity] #[ORM\HasLifecycleCallbacks] #[ORM\Table(name: 'webauthn_keys')] class WebauthnKey extends BasePublicKeyCredentialSource { use TimestampTrait; #[ORM\Id] #[ORM\Column(type: Types::INTEGER)] #[ORM\GeneratedValue] protected int $id; #[ORM\Column(type: Types::STRING)] protected string $name; #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'webauthn_keys')] protected ?User $user = null; public function getName(): string { return $this->name; } public function setName(string $name): WebauthnKey { $this->name = $name; return $this; } public function getUser(): ?User { return $this->user; } public function setUser(?User $user): WebauthnKey { $this->user = $user; return $this; } public function getId(): int { return $this->id; } public static function fromRegistration(BasePublicKeyCredentialSource $registration): self { return new self( $registration->getPublicKeyCredentialId(), $registration->getType(), $registration->getTransports(), $registration->getAttestationType(), $registration->getTrustPath(), $registration->getAaguid(), $registration->getCredentialPublicKey(), $registration->getUserHandle(), $registration->getCounter(), $registration->getOtherUI() ); } }