mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
[PM-1380] Modify Device Table (#2937)
* Update Models - Add Controller Method * Add MSSQL Migration * Update SQL Proj * Update SQL Migration * Update Models * Update SQL Project * Add EF Migrations * Switch to using Identifier * Update Code Comment
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Api.Models.Request;
|
||||
|
||||
@ -47,3 +48,30 @@ public class DeviceTokenRequestModel
|
||||
return existingDevice;
|
||||
}
|
||||
}
|
||||
|
||||
public class DeviceKeysRequestModel
|
||||
{
|
||||
/// <inheritdoc cref="Device.EncryptedUserKey" />
|
||||
[Required]
|
||||
[EncryptedString]
|
||||
public string EncryptedUserKey { get; set; }
|
||||
|
||||
/// <inheritdoc cref="Device.EncryptedPublicKey" />
|
||||
[Required]
|
||||
[EncryptedString]
|
||||
public string EncryptedPublicKey { get; set; }
|
||||
|
||||
/// <inheritdoc cref="Device.EncryptedPrivateKey" />
|
||||
[Required]
|
||||
[EncryptedString]
|
||||
public string EncryptedPrivateKey { get; set; }
|
||||
|
||||
public Device ToDevice(Device existingDevice)
|
||||
{
|
||||
existingDevice.EncryptedUserKey = EncryptedUserKey;
|
||||
existingDevice.EncryptedPublicKey = EncryptedPublicKey;
|
||||
existingDevice.EncryptedPrivateKey = EncryptedPrivateKey;
|
||||
|
||||
return existingDevice;
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,9 @@ public class DeviceResponseModel : ResponseModel
|
||||
Type = device.Type;
|
||||
Identifier = device.Identifier;
|
||||
CreationDate = device.CreationDate;
|
||||
EncryptedUserKey = device.EncryptedUserKey;
|
||||
EncryptedPublicKey = device.EncryptedPublicKey;
|
||||
EncryptedPrivateKey = device.EncryptedPrivateKey;
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
@ -26,4 +29,7 @@ public class DeviceResponseModel : ResponseModel
|
||||
public DeviceType Type { get; set; }
|
||||
public string Identifier { get; set; }
|
||||
public DateTime CreationDate { get; set; }
|
||||
public string EncryptedUserKey { get; }
|
||||
public string EncryptedPublicKey { get; }
|
||||
public string EncryptedPrivateKey { get; }
|
||||
}
|
||||
|
Reference in New Issue
Block a user