session-ios/Session/Database/Storage+Shared.swift

24 lines
659 B
Swift
Raw Normal View History

extension Storage {
public static let shared = Storage()
public func with(_ work: @escaping (Any) -> Void) {
Storage.writeSync { work($0) }
}
2020-11-12 22:41:54 +01:00
public func withAsync(_ work: @escaping (Any) -> Void, completion: @escaping () -> Void) {
Storage.write(with: { work($0) }, completion: completion)
}
public func getUserPublicKey() -> String? {
2020-11-12 00:41:45 +01:00
return OWSIdentityManager.shared().identityKeyPair()?.publicKey.toHexString()
}
2020-11-12 22:41:54 +01:00
public func getUserKeyPair() -> ECKeyPair? {
return OWSIdentityManager.shared().identityKeyPair()
}
public func getUserDisplayName() -> String? { fatalError() }
}