1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-03 17:12:49 -05:00
Files
bitwarden/src/Api/Models/Response/DeviceResponseModel.cs
Bernd Schoolmann c195f83402 [PM-19728] Add keys on devices list and get responses (#5633)
* Add keys on devices list and get responses

* Mark retrieve device keys endpoint as deprecated
2025-04-21 13:49:17 +02:00

42 lines
1.2 KiB
C#

using Bit.Core.Auth.Utilities;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Models.Api;
using Bit.Core.Utilities;
namespace Bit.Api.Models.Response;
public class DeviceResponseModel : ResponseModel
{
public DeviceResponseModel(Device device)
: base("device")
{
if (device == null)
{
throw new ArgumentNullException(nameof(device));
}
Id = device.Id;
Name = device.Name;
Type = device.Type;
Identifier = device.Identifier;
CreationDate = device.CreationDate;
IsTrusted = device.IsTrusted();
EncryptedUserKey = device.EncryptedUserKey;
EncryptedPublicKey = device.EncryptedPublicKey;
}
public Guid Id { get; set; }
public string Name { get; set; }
public DeviceType Type { get; set; }
public string Identifier { get; set; }
public DateTime CreationDate { get; set; }
public bool IsTrusted { get; set; }
[EncryptedString]
[EncryptedStringLength(2000)]
public string EncryptedUserKey { get; set; }
[EncryptedString]
[EncryptedStringLength(2000)]
public string EncryptedPublicKey { get; set; }
}