From 1a0e9e961d36a5d1818f2398a9f5d99a717dd7ac Mon Sep 17 00:00:00 2001 From: Federico Maccaroni Date: Mon, 22 May 2023 21:25:23 +0300 Subject: [PATCH] PM-115 removed ForceKeyRotation from new cipher encryption model given that another approach will be taken --- src/Core/Models/Data/CipherData.cs | 2 -- src/Core/Models/Domain/Cipher.cs | 5 +---- src/Core/Models/Request/CipherRequest.cs | 2 -- src/Core/Models/Response/CipherResponse.cs | 1 - src/Core/Models/View/CipherView.cs | 2 -- src/Core/Services/CipherService.cs | 5 ++--- 6 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/Core/Models/Data/CipherData.cs b/src/Core/Models/Data/CipherData.cs index 9599cee78..3d7c1a2dd 100644 --- a/src/Core/Models/Data/CipherData.cs +++ b/src/Core/Models/Data/CipherData.cs @@ -27,7 +27,6 @@ namespace Bit.Core.Models.Data CollectionIds = collectionIds?.ToList() ?? response.CollectionIds; Reprompt = response.Reprompt; Key = response.Key; - ForceKeyRotation = response.ForceKeyRotation; 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 Enums.CipherRepromptType Reprompt { get; set; } public string Key { get; set; } - public bool ForceKeyRotation { get; set; } } } diff --git a/src/Core/Models/Domain/Cipher.cs b/src/Core/Models/Domain/Cipher.cs index f5fe6192c..87d9f5a0a 100644 --- a/src/Core/Models/Domain/Cipher.cs +++ b/src/Core/Models/Domain/Cipher.cs @@ -35,7 +35,6 @@ namespace Bit.Core.Models.Domain CollectionIds = obj.CollectionIds != null ? new HashSet(obj.CollectionIds) : null; LocalData = localData; Reprompt = obj.Reprompt; - ForceKeyRotation = obj.ForceKeyRotation; if (obj.Key != null) { @@ -89,7 +88,6 @@ namespace Bit.Core.Models.Domain public DateTime? DeletedDate { get; set; } public CipherRepromptType Reprompt { get; set; } public EncString Key { get; set; } - public bool ForceKeyRotation { get; set; } public async Task DecryptAsync() { @@ -195,8 +193,7 @@ namespace Bit.Core.Models.Domain CollectionIds = CollectionIds.ToList(), DeletedDate = DeletedDate, Reprompt = Reprompt, - Key = Key?.EncryptedString, - ForceKeyRotation = ForceKeyRotation + Key = Key?.EncryptedString }; BuildDataModel(this, c, new HashSet { diff --git a/src/Core/Models/Request/CipherRequest.cs b/src/Core/Models/Request/CipherRequest.cs index 3a1a18eb0..e4e2a6e36 100644 --- a/src/Core/Models/Request/CipherRequest.cs +++ b/src/Core/Models/Request/CipherRequest.cs @@ -20,7 +20,6 @@ namespace Bit.Core.Models.Request LastKnownRevisionDate = cipher.RevisionDate; Reprompt = cipher.Reprompt; Key = cipher.Key?.EncryptedString; - ForceKeyRotation = cipher.ForceKeyRotation; switch (Type) { @@ -127,6 +126,5 @@ namespace Bit.Core.Models.Request public DateTime LastKnownRevisionDate { get; set; } public CipherRepromptType Reprompt { get; set; } public string Key { get; set; } - public bool ForceKeyRotation { get; set; } } } diff --git a/src/Core/Models/Response/CipherResponse.cs b/src/Core/Models/Response/CipherResponse.cs index 373987b16..6ce575a20 100644 --- a/src/Core/Models/Response/CipherResponse.cs +++ b/src/Core/Models/Response/CipherResponse.cs @@ -29,6 +29,5 @@ namespace Bit.Core.Models.Response public DateTime? DeletedDate { get; set; } public CipherRepromptType Reprompt { get; set; } public string Key { get; set; } - public bool ForceKeyRotation { get; set; } } } diff --git a/src/Core/Models/View/CipherView.cs b/src/Core/Models/View/CipherView.cs index 7047accd9..dce3de47a 100644 --- a/src/Core/Models/View/CipherView.cs +++ b/src/Core/Models/View/CipherView.cs @@ -25,7 +25,6 @@ namespace Bit.Core.Models.View RevisionDate = c.RevisionDate; DeletedDate = c.DeletedDate; Reprompt = c.Reprompt; - ForceKeyRotation = c.ForceKeyRotation; } public string Id { get; set; } @@ -51,7 +50,6 @@ namespace Bit.Core.Models.View public DateTime? DeletedDate { get; set; } public CipherRepromptType Reprompt { get; set; } public SymmetricCryptoKey Key { get; set; } - public bool ForceKeyRotation { get; set; } public ItemView Item { diff --git a/src/Core/Services/CipherService.cs b/src/Core/Services/CipherService.cs index 6aeec2a47..8ed352ccb 100644 --- a/src/Core/Services/CipherService.cs +++ b/src/Core/Services/CipherService.cs @@ -177,8 +177,7 @@ namespace Bit.Core.Services Type = model.Type, CollectionIds = model.CollectionIds, RevisionDate = model.RevisionDate, - Reprompt = model.Reprompt, - ForceKeyRotation = model.ForceKeyRotation + Reprompt = model.Reprompt }; 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); return cipherView.Key;