Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Threema/ThreemaFramework/Business/   (Threema ©)  Datei vom 26.9.2026 mit Größe 1 kB image not shown  

Quelle  RevocationKeyManager.swift   Sprache: JAVA

 

import Foundation
import ThreemaMacros

public final class RevocationKeyManager {
    
    public static let shared = RevocationKeyManager()
    
    let businessInjector: BusinessInjectorProtocol
    let connector = ServerAPIConnector()

    // MARK: - Lifecycle

    private init(businessInjector: BusinessInjectorProtocol = BusinessInjector()) {
        self.businessInjector = businessInjector
    }
    
    // MARK: - Public func

    public func setPassword(_ password: String) {
        let myIdentityStore = businessInjector.myIdentityStore
        
        connector.setRevocationPassword(password, for: myIdentityStore) {
            myIdentityStore.revocationPasswordLastCheck = nil
            NotificationPresenterWrapper.shared.present(type: .revocationPasswordSuccess)
            NotificationCenter.default.post(name: NSNotification.Name(kRevocationPasswordUIRefresh), object: nil)
        } onError: { _ in
            NotificationPresenterWrapper.shared.present(type: .revocationPasswordError)
            NotificationCenter.default.post(name: NSNotification.Name(kRevocationPasswordUIRefresh), object: nil)
        }
    }
    
    public func checkPasswordSetDate(completion: @escaping () -> Void) {
        let myIdentityStore = businessInjector.myIdentityStore
        
        guard myIdentityStore.revocationPasswordLastCheck == nil else {
            return
        }
        
        connector.checkRevocationPassword(for: myIdentityStore) { _, onDate in
            if let onDate {
                myIdentityStore.revocationPasswordLastCheck = Date.now
                myIdentityStore.revocationPasswordSetDate = onDate
            }
            else {
                myIdentityStore.revocationPasswordLastCheck = nil
                myIdentityStore.revocationPasswordSetDate = nil
            }
            completion()
        } onError: { _ in
            myIdentityStore.revocationPasswordLastCheck = nil
            myIdentityStore.revocationPasswordSetDate = nil
            completion()
        }
    }
}

Messung
CHZG
82909187

¤ Dauer der Verarbeitung: 0.2 Sekunden  (vorverarbeitet am  2026-11-24) ¤

*© Formatika GbR, Deutschland