1
0
mirror of https://github.com/bitwarden/server synced 2025-12-20 02:03:46 +00:00

added identity cipher type

This commit is contained in:
Kyle Spearrin
2017-10-06 15:47:31 -04:00
parent e93b72ae71
commit 7e848e5c55
3 changed files with 138 additions and 3 deletions

View File

@@ -30,6 +30,7 @@ namespace Bit.Core.Models.Api
public LoginType Login { get; set; }
public CardType Card { get; set; }
public IdentityType Identity { get; set; }
public SecureNoteType SecureNote { get; set; }
public CipherDetails ToCipherDetails(Guid userId)
@@ -65,12 +66,16 @@ namespace Bit.Core.Models.Api
existingCipher.Data = JsonConvert.SerializeObject(new CardDataModel(this),
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
break;
case CipherType.Identity:
existingCipher.Data = JsonConvert.SerializeObject(new IdentityDataModel(this),
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
break;
case CipherType.SecureNote:
existingCipher.Data = JsonConvert.SerializeObject(new SecureNoteDataModel(this),
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
break;
default:
throw new ArgumentException("Unsupported " + nameof(Type) + ".");
throw new ArgumentException("Unsupported type: " + nameof(Type) + ".");
}
if((Attachments?.Count ?? 0) == 0)
@@ -155,6 +160,55 @@ namespace Bit.Core.Models.Api
public string Code { get; set; }
}
public class IdentityType
{
[EncryptedString]
[StringLength(1000)]
public string Title { get; set; }
[EncryptedString]
[StringLength(1000)]
public string FirstName { get; set; }
[EncryptedString]
[StringLength(1000)]
public string MiddleName { get; set; }
[EncryptedString]
[StringLength(1000)]
public string LastName { get; set; }
[EncryptedString]
[StringLength(1000)]
public string Address1 { get; set; }
[EncryptedString]
[StringLength(1000)]
public string Address2 { get; set; }
[EncryptedString]
[StringLength(1000)]
public string Address3 { get; set; }
[EncryptedString]
[StringLength(1000)]
public string City { get; set; }
[EncryptedString]
[StringLength(1000)]
public string State { get; set; }
[EncryptedString]
[StringLength(1000)]
public string PostalCode { get; set; }
[EncryptedString]
[StringLength(1000)]
public string Country { get; set; }
[EncryptedString]
[StringLength(1000)]
public string Company { get; set; }
[EncryptedString]
[StringLength(1000)]
public string Email { get; set; }
[EncryptedString]
[StringLength(1000)]
public string Phone { get; set; }
[EncryptedString]
[StringLength(1000)]
public string SSN { get; set; }
}
public class SecureNoteType
{
public Enums.SecureNoteType Type { get; set; }