//-----------------------------------------------------------------------
//
// Copyright (c) aliasvault. All rights reserved.
// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.
//
//-----------------------------------------------------------------------
namespace AliasClientDb;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using AliasClientDb.Abstracts;
///
/// The Passkey class that stores WebAuthn/FIDO2 passkey information.
///
public class Passkey : SyncableEntity
{
///
/// Gets or sets the ID.
///
[Key]
public Guid Id { get; set; }
///
/// Gets or sets the relying party identifier.
///
[Required]
[MaxLength(255)]
public string RpId { get; set; } = string.Empty;
///
/// Gets or sets the user handle which represents the user ID provided by the relying party.
///
[Required]
public byte[] UserHandle { get; set; } = null!;
///
/// Gets or sets the public key.
///
public string PublicKey { get; set; } = string.Empty;
///
/// Gets or sets the private key.
///
public string PrivateKey { get; set; } = string.Empty;
///
/// Gets or sets the PRF encryption key associated with the passkey (optional, only set if PRF was requested by RP).
///
[MaxLength(64)]
public byte[]? PrfKey { get; set; }
///
/// Gets or sets the display name for the passkey.
///
[MaxLength(255)]
public string DisplayName { get; set; } = string.Empty;
///
/// Gets or sets the additional data as JSON blob.
///
public byte[]? AdditionalData { get; set; }
///
/// Gets or sets the credential ID.
///
public Guid CredentialId { get; set; }
///
/// Gets or sets the credential object.
///
[ForeignKey("CredentialId")]
public virtual Credential Credential { get; set; } = null!;
}