2021-04-20 07:06:32 +02:00
|
|
|
using System;
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
|
|
namespace BTCPayServer.Data
|
|
|
|
{
|
|
|
|
public class Fido2Credential
|
|
|
|
{
|
|
|
|
public string Name { get; set; }
|
|
|
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
|
|
public string Id { get; set; }
|
|
|
|
|
|
|
|
public string ApplicationUserId { get; set; }
|
|
|
|
|
|
|
|
public byte[] Blob { get; set; }
|
|
|
|
public CredentialType Type { get; set; }
|
|
|
|
public enum CredentialType
|
|
|
|
{
|
2021-04-28 06:14:15 +02:00
|
|
|
FIDO2
|
2021-04-20 07:06:32 +02:00
|
|
|
}
|
|
|
|
public static void OnModelCreating(ModelBuilder builder)
|
|
|
|
{
|
|
|
|
builder.Entity<Fido2Credential>()
|
|
|
|
.HasOne(o => o.ApplicationUser)
|
|
|
|
.WithMany(i => i.Fido2Credentials)
|
|
|
|
.HasForeignKey(i => i.ApplicationUserId).OnDelete(DeleteBehavior.Cascade);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public ApplicationUser ApplicationUser { get; set; }
|
|
|
|
}
|
|
|
|
}
|