mirror of
https://github.com/bitwarden/server.git
synced 2025-06-20 02:48:03 -05:00
35 lines
964 B
C#
35 lines
964 B
C#
using System.ComponentModel.DataAnnotations;
|
|
using Bit.Core.Entities;
|
|
using Bit.Core.KeyManagement.Enums;
|
|
using Bit.Core.KeyManagement.Models.Data;
|
|
using Bit.Core.Utilities;
|
|
|
|
#nullable enable
|
|
|
|
namespace Bit.Core.KeyManagement.Entities;
|
|
|
|
public class UserSignatureKeyPair : ITableObject<Guid>, IRevisable
|
|
{
|
|
public Guid Id { get; set; }
|
|
public Guid UserId { get; set; }
|
|
public SignatureAlgorithm SignatureAlgorithm { get; set; }
|
|
|
|
[MaxLength(500)]
|
|
required public string VerifyingKey { get; set; }
|
|
[MaxLength(500)]
|
|
required public string SigningKey { get; set; }
|
|
|
|
public DateTime CreationDate { get; set; } = DateTime.UtcNow;
|
|
public DateTime RevisionDate { get; set; } = DateTime.UtcNow;
|
|
|
|
public void SetNewId()
|
|
{
|
|
Id = CoreHelpers.GenerateComb();
|
|
}
|
|
|
|
public SignatureKeyPairData ToSignatureKeyPairData()
|
|
{
|
|
return new SignatureKeyPairData(SignatureAlgorithm, SigningKey, VerifyingKey);
|
|
}
|
|
}
|