1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-05 23:53:33 +00:00

PM-115 removed ForceKeyRotation from new cipher encryption model given that another approach will be taken

This commit is contained in:
Federico Maccaroni
2023-05-22 21:25:23 +03:00
parent 7cdc5a6233
commit 1a0e9e961d
6 changed files with 3 additions and 14 deletions

View File

@@ -27,7 +27,6 @@ namespace Bit.Core.Models.Data
CollectionIds = collectionIds?.ToList() ?? response.CollectionIds; CollectionIds = collectionIds?.ToList() ?? response.CollectionIds;
Reprompt = response.Reprompt; Reprompt = response.Reprompt;
Key = response.Key; Key = response.Key;
ForceKeyRotation = response.ForceKeyRotation;
try // Added to address Issue (https://github.com/bitwarden/mobile/issues/1006) try // Added to address Issue (https://github.com/bitwarden/mobile/issues/1006)
{ {
@@ -89,6 +88,5 @@ namespace Bit.Core.Models.Data
public DateTime? DeletedDate { get; set; } public DateTime? DeletedDate { get; set; }
public Enums.CipherRepromptType Reprompt { get; set; } public Enums.CipherRepromptType Reprompt { get; set; }
public string Key { get; set; } public string Key { get; set; }
public bool ForceKeyRotation { get; set; }
} }
} }

View File

@@ -35,7 +35,6 @@ namespace Bit.Core.Models.Domain
CollectionIds = obj.CollectionIds != null ? new HashSet<string>(obj.CollectionIds) : null; CollectionIds = obj.CollectionIds != null ? new HashSet<string>(obj.CollectionIds) : null;
LocalData = localData; LocalData = localData;
Reprompt = obj.Reprompt; Reprompt = obj.Reprompt;
ForceKeyRotation = obj.ForceKeyRotation;
if (obj.Key != null) if (obj.Key != null)
{ {
@@ -89,7 +88,6 @@ namespace Bit.Core.Models.Domain
public DateTime? DeletedDate { get; set; } public DateTime? DeletedDate { get; set; }
public CipherRepromptType Reprompt { get; set; } public CipherRepromptType Reprompt { get; set; }
public EncString Key { get; set; } public EncString Key { get; set; }
public bool ForceKeyRotation { get; set; }
public async Task<CipherView> DecryptAsync() public async Task<CipherView> DecryptAsync()
{ {
@@ -195,8 +193,7 @@ namespace Bit.Core.Models.Domain
CollectionIds = CollectionIds.ToList(), CollectionIds = CollectionIds.ToList(),
DeletedDate = DeletedDate, DeletedDate = DeletedDate,
Reprompt = Reprompt, Reprompt = Reprompt,
Key = Key?.EncryptedString, Key = Key?.EncryptedString
ForceKeyRotation = ForceKeyRotation
}; };
BuildDataModel(this, c, new HashSet<string> BuildDataModel(this, c, new HashSet<string>
{ {

View File

@@ -20,7 +20,6 @@ namespace Bit.Core.Models.Request
LastKnownRevisionDate = cipher.RevisionDate; LastKnownRevisionDate = cipher.RevisionDate;
Reprompt = cipher.Reprompt; Reprompt = cipher.Reprompt;
Key = cipher.Key?.EncryptedString; Key = cipher.Key?.EncryptedString;
ForceKeyRotation = cipher.ForceKeyRotation;
switch (Type) switch (Type)
{ {
@@ -127,6 +126,5 @@ namespace Bit.Core.Models.Request
public DateTime LastKnownRevisionDate { get; set; } public DateTime LastKnownRevisionDate { get; set; }
public CipherRepromptType Reprompt { get; set; } public CipherRepromptType Reprompt { get; set; }
public string Key { get; set; } public string Key { get; set; }
public bool ForceKeyRotation { get; set; }
} }
} }

View File

@@ -29,6 +29,5 @@ namespace Bit.Core.Models.Response
public DateTime? DeletedDate { get; set; } public DateTime? DeletedDate { get; set; }
public CipherRepromptType Reprompt { get; set; } public CipherRepromptType Reprompt { get; set; }
public string Key { get; set; } public string Key { get; set; }
public bool ForceKeyRotation { get; set; }
} }
} }

View File

@@ -25,7 +25,6 @@ namespace Bit.Core.Models.View
RevisionDate = c.RevisionDate; RevisionDate = c.RevisionDate;
DeletedDate = c.DeletedDate; DeletedDate = c.DeletedDate;
Reprompt = c.Reprompt; Reprompt = c.Reprompt;
ForceKeyRotation = c.ForceKeyRotation;
} }
public string Id { get; set; } public string Id { get; set; }
@@ -51,7 +50,6 @@ namespace Bit.Core.Models.View
public DateTime? DeletedDate { get; set; } public DateTime? DeletedDate { get; set; }
public CipherRepromptType Reprompt { get; set; } public CipherRepromptType Reprompt { get; set; }
public SymmetricCryptoKey Key { get; set; } public SymmetricCryptoKey Key { get; set; }
public bool ForceKeyRotation { get; set; }
public ItemView Item public ItemView Item
{ {

View File

@@ -177,8 +177,7 @@ namespace Bit.Core.Services
Type = model.Type, Type = model.Type,
CollectionIds = model.CollectionIds, CollectionIds = model.CollectionIds,
RevisionDate = model.RevisionDate, RevisionDate = model.RevisionDate,
Reprompt = model.Reprompt, Reprompt = model.Reprompt
ForceKeyRotation = model.ForceKeyRotation
}; };
key = await UpdateCipherAndGetCipherKeyAsync(cipher, model, key); key = await UpdateCipherAndGetCipherKeyAsync(cipher, model, key);
@@ -210,7 +209,7 @@ namespace Bit.Core.Services
} }
} }
if (cipherView.Key != null && !cipherView.ForceKeyRotation) if (cipherView.Key != null)
{ {
cipher.Key = await _cryptoService.EncryptAsync(cipherView.Key.Key, key); cipher.Key = await _cryptoService.EncryptAsync(cipherView.Key.Key, key);
return cipherView.Key; return cipherView.Key;