Signal-iOS/SignalServiceKit/KeyBackupService/KeyBackupServiceObjcBridge.swift
Harry 6576349613
Migrate KeyBackupService to the Swift Way™️
* Put KeyBackupService in its own folder

* Put SDSKeyValueStore in its own directory

* Put SDSDatabaseStorage in its own directory

* Stop doing useless dispatches in SDSTransactable

* Add V2 DB classes

* Wrap SDSKeyValueStore in a protocol and factory

* Make TSConstantsProtocol public to take it as a param in other places

* Take explicit transactions and do single lookups in TSAccountManager registration state methods

* Take explicit transaction on OWS2FAManager

* Make KeyBackupService an instance that takes dependencies on init

* Protocolize KeyBackupService

* Put Dependencies+SSK in its own directory

* Add DependenciesBridge

* add ViewControllerContext

* used shared context in OnboardingController

* Don't check KeyBackupService in RemoteConfigManager; the one and only callsite already checks it separately

* All the random cleanup that needed to happen to get the app to build again.

* Add mock dbv2 classes

* Migrate existing KeyBackupServiceTests

* Namespace KBS shims

* DBV2 -> DB, after changing the min swiftlint type length to 2 chars

* add toy example

* Unwrap writes as reads

* pr comments

* pr comments 2: return of the nits

* final Pr comment
2023-02-02 09:42:05 -08:00

35 lines
907 B
Swift

//
// Copyright 2023 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
//
import Foundation
/// Just a container for simple static helper methods on KeyBackupService
/// that can be shared with other classes (incl. objc classes).
@objc
public final class KeyBackupServiceObjcBridge: NSObject {
private override init() {}
@objc
public static func normalizePin(_ pin: String) -> String {
return KeyBackupService.normalizePin(pin)
}
@objc
public static func warmKBSCaches() {
DependenciesBridge.shared.keyBackupService.warmCaches()
}
@objc
public static var hasBackedUpMasterKey: Bool {
DependenciesBridge.shared.keyBackupService.hasBackedUpMasterKey
}
@objc
public static func deriveRegistrationLockToken() -> String? {
return DependenciesBridge.shared.keyBackupService.deriveRegistrationLockToken()
}
}