mirror of
https://github.com/bitwarden/ios.git
synced 2025-12-13 02:58:59 -06:00
BIT-2072: Enables enableCipherKeyEncryption feature flag (#530)
This commit is contained in:
parent
f7553097ef
commit
aeac35b4cc
@ -5,6 +5,7 @@ import BitwardenSdk
|
|||||||
class MockClientPlatform: ClientPlatformProtocol {
|
class MockClientPlatform: ClientPlatformProtocol {
|
||||||
var fingerprintMaterialString: String?
|
var fingerprintMaterialString: String?
|
||||||
var fingerprintResult: Result<String, Error> = .success("a-fingerprint-phrase-string-placeholder")
|
var fingerprintResult: Result<String, Error> = .success("a-fingerprint-phrase-string-placeholder")
|
||||||
|
var featureFlags: [String: Bool] = ["": false]
|
||||||
var userFingerprintCalled = false
|
var userFingerprintCalled = false
|
||||||
|
|
||||||
func fingerprint(req: BitwardenSdk.FingerprintRequest) async throws -> String {
|
func fingerprint(req: BitwardenSdk.FingerprintRequest) async throws -> String {
|
||||||
@ -12,8 +13,7 @@ class MockClientPlatform: ClientPlatformProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func loadFlags(flags: [String: Bool]) async throws {
|
func loadFlags(flags: [String: Bool]) async throws {
|
||||||
// Nothing yet.
|
featureFlags = flags
|
||||||
throw BitwardenTestError.example
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func userFingerprint(fingerprintMaterial: String) async throws -> String {
|
func userFingerprint(fingerprintMaterial: String) async throws -> String {
|
||||||
|
|||||||
@ -0,0 +1,12 @@
|
|||||||
|
import Foundation
|
||||||
|
|
||||||
|
// MARK: - FeatureFlagsConstants
|
||||||
|
|
||||||
|
/// An enumeration of feature flags.
|
||||||
|
///
|
||||||
|
enum FeatureFlagsConstants {
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// A flag that enables individual cipher encryption.
|
||||||
|
static let enableCipherKeyEncryption = "enableCipherKeyEncryption"
|
||||||
|
}
|
||||||
@ -86,9 +86,10 @@ public class AppProcessor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await loadFlags()
|
||||||
await services.migrationService.performMigrations()
|
await services.migrationService.performMigrations()
|
||||||
|
|
||||||
await services.environmentService.loadURLsForActiveAccount()
|
await services.environmentService.loadURLsForActiveAccount()
|
||||||
|
|
||||||
services.application?.registerForRemoteNotifications()
|
services.application?.registerForRemoteNotifications()
|
||||||
|
|
||||||
if let initialRoute {
|
if let initialRoute {
|
||||||
@ -199,3 +200,17 @@ extension AppProcessor: SyncServiceDelegate {
|
|||||||
await coordinator?.handleEvent(.didLogout(userId: userId, userInitiated: false))
|
await coordinator?.handleEvent(.didLogout(userId: userId, userInitiated: false))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - Feature flags
|
||||||
|
|
||||||
|
extension AppProcessor {
|
||||||
|
/// Loads feature flags.
|
||||||
|
///
|
||||||
|
func loadFlags() async {
|
||||||
|
do {
|
||||||
|
try await services.clientPlatform.loadFlags(flags: [FeatureFlagsConstants.enableCipherKeyEncryption: true])
|
||||||
|
} catch {
|
||||||
|
services.errorReporter.log(error: error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ class AppProcessorTests: BitwardenTestCase {
|
|||||||
|
|
||||||
var appModule: MockAppModule!
|
var appModule: MockAppModule!
|
||||||
var authRepository: MockAuthRepository!
|
var authRepository: MockAuthRepository!
|
||||||
|
var clientPlatform: MockClientPlatform!
|
||||||
var coordinator: MockCoordinator<AppRoute, AppEvent>!
|
var coordinator: MockCoordinator<AppRoute, AppEvent>!
|
||||||
var errorReporter: MockErrorReporter!
|
var errorReporter: MockErrorReporter!
|
||||||
var migrationService: MockMigrationService!
|
var migrationService: MockMigrationService!
|
||||||
@ -28,6 +29,7 @@ class AppProcessorTests: BitwardenTestCase {
|
|||||||
router = MockRouter(routeForEvent: { _ in .landing })
|
router = MockRouter(routeForEvent: { _ in .landing })
|
||||||
appModule = MockAppModule()
|
appModule = MockAppModule()
|
||||||
authRepository = MockAuthRepository()
|
authRepository = MockAuthRepository()
|
||||||
|
clientPlatform = MockClientPlatform()
|
||||||
coordinator = MockCoordinator()
|
coordinator = MockCoordinator()
|
||||||
appModule.authRouter = router
|
appModule.authRouter = router
|
||||||
appModule.appCoordinator = coordinator
|
appModule.appCoordinator = coordinator
|
||||||
@ -44,6 +46,7 @@ class AppProcessorTests: BitwardenTestCase {
|
|||||||
appModule: appModule,
|
appModule: appModule,
|
||||||
services: ServiceContainer.withMocks(
|
services: ServiceContainer.withMocks(
|
||||||
authRepository: authRepository,
|
authRepository: authRepository,
|
||||||
|
clientService: MockClientService(clientPlatform: clientPlatform),
|
||||||
errorReporter: errorReporter,
|
errorReporter: errorReporter,
|
||||||
migrationService: migrationService,
|
migrationService: migrationService,
|
||||||
notificationService: notificationService,
|
notificationService: notificationService,
|
||||||
@ -114,6 +117,12 @@ class AppProcessorTests: BitwardenTestCase {
|
|||||||
XCTAssertIdentical(syncService.delegate, subject)
|
XCTAssertIdentical(syncService.delegate, subject)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// `.loadFlags()` loads the feature flags.
|
||||||
|
func test_loadFlags() async {
|
||||||
|
await subject.loadFlags()
|
||||||
|
XCTAssertEqual(clientPlatform.featureFlags, ["enableCipherKeyEncryption": true])
|
||||||
|
}
|
||||||
|
|
||||||
/// `messageReceived(_:notificationDismissed:notificationTapped)` passes the data to the notification service.
|
/// `messageReceived(_:notificationDismissed:notificationTapped)` passes the data to the notification service.
|
||||||
func test_messageReceived() async {
|
func test_messageReceived() async {
|
||||||
let message: [AnyHashable: Any] = ["knock knock": "who's there?"]
|
let message: [AnyHashable: Any] = ["knock knock": "who's there?"]
|
||||||
|
|||||||
@ -13,7 +13,7 @@ options:
|
|||||||
indentWidth: 4
|
indentWidth: 4
|
||||||
tabWidth: 4
|
tabWidth: 4
|
||||||
settings:
|
settings:
|
||||||
MARKETING_VERSION: 1.0.0 # Bump this for a new version update.
|
MARKETING_VERSION: 2024.03.0 # Bump this for a new version update.
|
||||||
CURRENT_PROJECT_VERSION: 1
|
CURRENT_PROJECT_VERSION: 1
|
||||||
packages:
|
packages:
|
||||||
BitwardenSdk:
|
BitwardenSdk:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user