diff --git a/app/src/main/kotlin/com/x8bit/bitwarden/data/platform/manager/FeatureFlagManagerImpl.kt b/app/src/main/kotlin/com/x8bit/bitwarden/data/platform/manager/FeatureFlagManagerImpl.kt index c4b06c47422..9483d95a060 100644 --- a/app/src/main/kotlin/com/x8bit/bitwarden/data/platform/manager/FeatureFlagManagerImpl.kt +++ b/app/src/main/kotlin/com/x8bit/bitwarden/data/platform/manager/FeatureFlagManagerImpl.kt @@ -19,8 +19,7 @@ class FeatureFlagManagerImpl( override val sdkFeatureFlags: Map get() = mapOf( - CIPHER_KEY_ENCRYPTION_KEY to - getCipherKeyEncryptionFlagState(), + CIPHER_KEY_ENCRYPTION_KEY to serverConfigRepository.isCipherKeyEncryptionEnabled, ) override fun getFeatureFlagFlow(key: FlagKey): Flow = @@ -43,18 +42,14 @@ class FeatureFlagManagerImpl( .serverConfigStateFlow .value .getFlagValueOrDefault(key = key) - - /** - * Get the computed value of the cipher key encryption flag based on server version and - * remote flag. - */ - private fun getCipherKeyEncryptionFlagState() = - isServerVersionAtLeast( - serverConfigRepository.serverConfigStateFlow.value, - CIPHER_KEY_ENC_MIN_SERVER_VERSION, - ) && getFeatureFlag(FlagKey.CipherKeyEncryption) } +/** + * Get the computed value of the cipher key encryption flag based on server version. + */ +private val ServerConfigRepository.isCipherKeyEncryptionEnabled: Boolean + get() = isServerVersionAtLeast(serverConfigStateFlow.value, CIPHER_KEY_ENC_MIN_SERVER_VERSION) + /** * Extract the value of a [FlagKey] from the [ServerConfig]. If there is an issue with retrieving * or if the value is null, the default value will be returned. diff --git a/app/src/test/kotlin/com/x8bit/bitwarden/data/platform/manager/FeatureFlagManagerTest.kt b/app/src/test/kotlin/com/x8bit/bitwarden/data/platform/manager/FeatureFlagManagerTest.kt index f621962cd68..2228c33b6a8 100644 --- a/app/src/test/kotlin/com/x8bit/bitwarden/data/platform/manager/FeatureFlagManagerTest.kt +++ b/app/src/test/kotlin/com/x8bit/bitwarden/data/platform/manager/FeatureFlagManagerTest.kt @@ -27,7 +27,7 @@ class FeatureFlagManagerTest { @Test fun `sdkFeatureFlags should return set feature flags`() { - val expected = mapOf("enableCipherKeyEncryption" to false) + val expected = mapOf("enableCipherKeyEncryption" to true) val actual = manager.sdkFeatureFlags diff --git a/app/src/test/kotlin/com/x8bit/bitwarden/ui/platform/feature/debugmenu/DebugMenuViewModelTest.kt b/app/src/test/kotlin/com/x8bit/bitwarden/ui/platform/feature/debugmenu/DebugMenuViewModelTest.kt index 869646ddb61..9d313e40de0 100644 --- a/app/src/test/kotlin/com/x8bit/bitwarden/ui/platform/feature/debugmenu/DebugMenuViewModelTest.kt +++ b/app/src/test/kotlin/com/x8bit/bitwarden/ui/platform/feature/debugmenu/DebugMenuViewModelTest.kt @@ -110,11 +110,9 @@ class DebugMenuViewModelTest : BaseViewModelTest() { @Test fun `handleUpdateFeatureFlag should update the feature flag via the repository`() { val viewModel = createViewModel() - viewModel.trySendAction( - DebugMenuAction.UpdateFeatureFlag(FlagKey.CipherKeyEncryption, false), - ) + viewModel.trySendAction(DebugMenuAction.UpdateFeatureFlag(FlagKey.DummyBoolean, false)) verify(exactly = 1) { - mockDebugMenuRepository.updateFeatureFlag(FlagKey.CipherKeyEncryption, false) + mockDebugMenuRepository.updateFeatureFlag(FlagKey.DummyBoolean, false) } } diff --git a/core/src/main/kotlin/com/bitwarden/core/data/manager/model/FlagKey.kt b/core/src/main/kotlin/com/bitwarden/core/data/manager/model/FlagKey.kt index 2b5eadbd8b1..f45c4db960b 100644 --- a/core/src/main/kotlin/com/bitwarden/core/data/manager/model/FlagKey.kt +++ b/core/src/main/kotlin/com/bitwarden/core/data/manager/model/FlagKey.kt @@ -33,7 +33,6 @@ sealed class FlagKey { CredentialExchangeProtocolImport, CredentialExchangeProtocolExport, ForceUpdateKdfSettings, - CipherKeyEncryption, NoLogoutOnKdfChange, MigrateMyVaultToMyItems, ArchiveItems, @@ -60,14 +59,6 @@ sealed class FlagKey { override val defaultValue: Boolean = false } - /** - * Data object holding the feature flag key for the Cipher Key Encryption feature. - */ - data object CipherKeyEncryption : FlagKey() { - override val keyName: String = "cipher-key-encryption" - override val defaultValue: Boolean = false - } - /** * Indicates the state of Bitwarden authentication. */ diff --git a/core/src/test/kotlin/com/bitwarden/core/data/manager/model/FlagKeyTest.kt b/core/src/test/kotlin/com/bitwarden/core/data/manager/model/FlagKeyTest.kt index 1ec9592a2c5..10d5327f249 100644 --- a/core/src/test/kotlin/com/bitwarden/core/data/manager/model/FlagKeyTest.kt +++ b/core/src/test/kotlin/com/bitwarden/core/data/manager/model/FlagKeyTest.kt @@ -16,10 +16,6 @@ class FlagKeyTest { FlagKey.CredentialExchangeProtocolExport.keyName, "cxp-export-mobile", ) - assertEquals( - FlagKey.CipherKeyEncryption.keyName, - "cipher-key-encryption", - ) assertEquals( FlagKey.BitwardenAuthenticationEnabled.keyName, "bitwarden-authentication-enabled", @@ -48,7 +44,6 @@ class FlagKeyTest { listOf( FlagKey.CredentialExchangeProtocolImport, FlagKey.CredentialExchangeProtocolExport, - FlagKey.CipherKeyEncryption, FlagKey.BitwardenAuthenticationEnabled, FlagKey.ForceUpdateKdfSettings, FlagKey.MigrateMyVaultToMyItems, diff --git a/ui/src/main/kotlin/com/bitwarden/ui/platform/components/debug/FeatureFlagListItems.kt b/ui/src/main/kotlin/com/bitwarden/ui/platform/components/debug/FeatureFlagListItems.kt index 9b3f88bfd62..74a84fc4886 100644 --- a/ui/src/main/kotlin/com/bitwarden/ui/platform/components/debug/FeatureFlagListItems.kt +++ b/ui/src/main/kotlin/com/bitwarden/ui/platform/components/debug/FeatureFlagListItems.kt @@ -26,7 +26,6 @@ fun FlagKey.ListItemContent( FlagKey.BitwardenAuthenticationEnabled, FlagKey.CredentialExchangeProtocolImport, FlagKey.CredentialExchangeProtocolExport, - FlagKey.CipherKeyEncryption, FlagKey.ForceUpdateKdfSettings, FlagKey.NoLogoutOnKdfChange, FlagKey.MigrateMyVaultToMyItems, @@ -75,7 +74,6 @@ private fun FlagKey.getDisplayLabel(): String = when (this) { FlagKey.CredentialExchangeProtocolImport -> stringResource(BitwardenString.cxp_import) FlagKey.CredentialExchangeProtocolExport -> stringResource(BitwardenString.cxp_export) - FlagKey.CipherKeyEncryption -> stringResource(BitwardenString.cipher_key_encryption) FlagKey.ForceUpdateKdfSettings -> stringResource(BitwardenString.force_update_kdf_settings) FlagKey.NoLogoutOnKdfChange -> stringResource(BitwardenString.avoid_logout_on_kdf_change) FlagKey.BitwardenAuthenticationEnabled -> { diff --git a/ui/src/main/res/values/strings_non_localized.xml b/ui/src/main/res/values/strings_non_localized.xml index dea03c73c1a..380de36c5d5 100644 --- a/ui/src/main/res/values/strings_non_localized.xml +++ b/ui/src/main/res/values/strings_non_localized.xml @@ -26,7 +26,6 @@ This will reset the onboarding status for the current user, if available. After clicking the button you will immediately be redirected to the onboarding flow. Onboarding flag must be enabled. Show Onboarding Carousel This will force the change to app state which will cause the first time carousel to show. The carousel will continue to show for any \"new\" account until a login is completed. May need to exit debug menu manually. - Cipher Key Encryption Reset all coach mark tours Generate crash Generate error report