Skip to content

Commit c23fcd4

Browse files
authored
[PM-18265] Made cipher key encryption feature flag default value -> false (#1360)
1 parent 9bacbdd commit c23fcd4

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

BitwardenShared/Core/Platform/Models/Enum/FeatureFlag.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ enum FeatureFlag: String, CaseIterable, Codable {
9999
/// but if `isRemotelyConfigured` is false for the flag, then the value here will be used.
100100
/// This is a helpful way to manage local feature flags.
101101
static let initialValues: [FeatureFlag: AnyCodable] = [
102-
.cipherKeyEncryption: .bool(true),
103102
.testLocalInitialBoolFlag: .bool(true),
104103
.testLocalInitialIntFlag: .int(42),
105104
.testLocalInitialStringFlag: .string("Test String"),

BitwardenShared/Core/Platform/Models/Enum/FeatureFlagTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ final class FeatureFlagTests: BitwardenTestCase {
1414

1515
/// `initialValues` returns the correct value for each flag.
1616
func test_initialValues() {
17-
XCTAssertTrue(FeatureFlag.initialValues[.cipherKeyEncryption]?.boolValue == true)
17+
XCTAssertNil(FeatureFlag.initialValues[.cipherKeyEncryption]?.boolValue)
1818
}
1919

2020
/// `getter:isRemotelyConfigured` returns the correct value for each flag.

BitwardenShared/Core/Platform/Services/ClientService.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,7 @@ actor DefaultClientService: ClientService {
295295
}
296296

297297
let cipherKeyEncryptionFlagEnabled: Bool = await configService.getFeatureFlag(
298-
.cipherKeyEncryption,
299-
defaultValue: true
298+
.cipherKeyEncryption
300299
)
301300
let enableCipherKeyEncryption = cipherKeyEncryptionFlagEnabled && config.supportsCipherKeyEncryption()
302301

BitwardenShared/Core/Platform/Services/ClientServiceTests.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ final class ClientServiceTests: BitwardenTestCase { // swiftlint:disable:this ty
215215
/// `configPublisher` loads flags into the SDK.
216216
@MainActor
217217
func test_configPublisher_loadFlags() async throws {
218+
configService.featureFlagsBool[.cipherKeyEncryption] = true
218219
configService.configSubject.send(
219220
MetaServerConfig(
220221
isPreAuth: false,
@@ -282,11 +283,11 @@ final class ClientServiceTests: BitwardenTestCase { // swiftlint:disable:this ty
282283

283284
try await waitForAsync {
284285
let client = try? XCTUnwrap(self.clientBuilder.clients.first)
285-
return client?.platformClient.featureFlags == ["enableCipherKeyEncryption": true]
286+
return client?.platformClient.featureFlags == ["enableCipherKeyEncryption": false]
286287
}
287288
XCTAssertEqual(clientBuilder.clients.count, 1)
288289

289-
configService.featureFlagsBool[.cipherKeyEncryption] = false
290+
configService.featureFlagsBool[.cipherKeyEncryption] = true
290291
configService.configSubject.send(
291292
MetaServerConfig(
292293
isPreAuth: false,
@@ -295,7 +296,7 @@ final class ClientServiceTests: BitwardenTestCase { // swiftlint:disable:this ty
295296
date: Date(year: 2024, month: 2, day: 14, hour: 7, minute: 50, second: 0),
296297
responseModel: ConfigResponseModel(
297298
environment: nil,
298-
featureStates: [:],
299+
featureStates: ["cipher-key-encryption": .bool(true)],
299300
gitHash: "75238191",
300301
server: nil,
301302
version: "2024.4.0"
@@ -306,7 +307,7 @@ final class ClientServiceTests: BitwardenTestCase { // swiftlint:disable:this ty
306307

307308
try await waitForAsync {
308309
let client = try? XCTUnwrap(self.clientBuilder.clients.first)
309-
return client?.platformClient.featureFlags == ["enableCipherKeyEncryption": false]
310+
return client?.platformClient.featureFlags == ["enableCipherKeyEncryption": true]
310311
}
311312
XCTAssertEqual(clientBuilder.clients.count, 1)
312313
}

0 commit comments

Comments
 (0)