Files
server/src/Api/Models/CipherFieldModel.cs

38 lines
927 B
C#
Raw Normal View History

2021-12-14 15:05:07 +00:00
using Bit.Core.Enums;
using Bit.Core.Models.Data;
2018-08-02 08:57:32 -04:00
using Bit.Core.Utilities;
2017-09-13 16:54:23 -04:00
2021-12-14 15:05:07 +00:00
namespace Bit.Api.Models
2017-09-13 16:54:23 -04:00
{
public class CipherFieldModel
2017-09-13 16:54:23 -04:00
{
2018-03-01 09:29:49 -05:00
public CipherFieldModel() { }
public CipherFieldModel(CipherFieldData data)
{
Type = data.Type;
Name = data.Name;
Value = data.Value;
2021-11-04 07:27:15 +10:00
LinkedId = data.LinkedId ?? null;
}
2017-09-13 16:54:23 -04:00
public FieldType Type { get; set; }
2018-08-02 08:57:32 -04:00
[EncryptedStringLength(1000)]
2017-09-13 16:54:23 -04:00
public string Name { get; set; }
[EncryptedStringLength(5000)]
2017-09-13 16:54:23 -04:00
public string Value { get; set; }
2021-11-04 07:27:15 +10:00
public int? LinkedId { get; set; }
2021-12-14 15:05:07 +00:00
public CipherFieldData ToCipherFieldData()
{
return new CipherFieldData
{
Type = Type,
Name = Name,
Value = Value,
LinkedId = LinkedId ?? null,
};
}
2017-09-13 16:54:23 -04:00
}
}