Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Threema/SharedTests/Mocks/   (Social Medium ©)  Datei vom 26.9.2026 mit Größe 4 kB image not shown  

Quelle  MyIdentityStoreMock.swift   Sprache: JAVA

 

import Foundation
import ThreemaFramework
import ThreemaMacros

final class MyIdentityStoreMock: NSObject, MyIdentityStoreProtocol {

    // MARK: - Call Tracking

    /// How often the profile properties were set, sets to `nil` included
    private(set) var pushFromNameSetCount = 0
    private(set) var firstNameSetCount = 0
    private(set) var lastNameSetCount = 0
    private(set) var csiSetCount = 0
    private(set) var jobTitleSetCount = 0
    private(set) var departmentSetCount = 0
    private(set) var categorySetCount = 0
    private(set) var createIDEmailSetCount = 0
    private(set) var createIDPhoneSetCount = 0

    // MARK: - MyIdentityStoreProtocol

    var linkMobileNoVerificationID: String?
    
    var linkMobileNoStartDate: Date?
    
    var privateIdentityInfoLastUpdate: Date?
    
    var lastWorkUpdateRequestHash: Data?
    
    var lastWorkUpdateDate: Date?
    
    var companyName: String?
    
    var directoryCategories: NSMutableDictionary?
    
    var department: String? {
        didSet { departmentSetCount += 1 }
    }

    var jobTitle: String? {
        didSet { jobTitleSetCount += 1 }
    }

    var csi: String? {
        didSet { csiSetCount += 1 }
    }

    var category: String? {
        didSet { categorySetCount += 1 }
    }

    var licenseLogoLightURL: String?

    var licenseLogoDarkURL: String?

    var firstName: String? {
        didSet { firstNameSetCount += 1 }
    }

    var lastName: String? {
        didSet { lastNameSetCount += 1 }
    }

    var isDefaultProfilePicture: Bool
    
    func displayName() -> String {
        if let name = ContactUtil.name(fromFirstname: firstName, lastname: lastName) {
            return name as String
        }

        if let pushFromName, !pushFromName.isEmpty, pushFromName != identity {
            return pushFromName
        }

        return "\(identity) (\(#localize("me")))"
    }

    var pushFromName: String? {
        didSet { pushFromNameSetCount += 1 }
    }

    var linkEmailPending = false

    var createIDEmail: String? {
        didSet { createIDEmailSetCount += 1 }
    }

    var linkedEmail: String?

    var linkMobileNoPending = false

    var createIDPhone: String? {
        didSet { createIDPhoneSetCount += 1 }
    }

    var linkedMobileNo: String?

    var profilePicture: NSMutableDictionary?

    func encryptData(_ data: Data, withNonce nonce: Data, publicKey: Data) -> Data? {
        NaClCrypto.shared()?.encryptData(data, withPublicKey: publicKey, signKey: clientKey, nonce: nonce)
    }

    func decryptData(_ data: Data, withNonce nonce: Data, publicKey _publicKey: Data) -> Data? {
        NaClCrypto.shared()?.decryptData(data, withSecretKey: clientKey, signKey: _publicKey, nonce: nonce)
    }

    func sharedSecret(withPublicKey publicKey: Data) -> Data? {
        NaClCrypto.shared().sharedSecret(forPublicKey: publicKey, secretKey: clientKey)
    }
    
    func mySharedSecret() -> Data? {
        NaClCrypto.shared().sharedSecret(forPublicKey: publicKey, secretKey: clientKey)
    }

    var publicKey: Data!
    var clientKey: Data?

    init(identity: String, secretKey: Data) {
        self.identity = identity
        self.publicKey = NaClCrypto.shared().derivePublicKey(fromSecretKey: secretKey)
        self.clientKey = secretKey
        self.resolvedProfilePicture = UIImage(systemName: "person.circle")!
        self.resolvedGroupCallProfilePicture = UIImage(systemName: "person.crop.circle")!
        self.isDefaultProfilePicture = false
    }

    override convenience init() {
        self.init(identity: "TESTERID", secretKey: Data(base64Encoded: "WAXm465d3CNnP1pf84RF0mYRgV/Umqwe/8Hun9ntTdQ=")!)
    }

    var identity: String!

    var isValidIdentity: Bool {
        false
    }

    var licenseSupportURL: String? = ""

    var serverGroup: String?

    func backupIdentity(withPassword password: String) -> String? {
        ""
    }

    var revocationPasswordSetDate: Date?

    var revocationPasswordLastCheck: Date?
    
    var resolvedProfilePicture: UIImage
    
    var resolvedGroupCallProfilePicture: UIImage
    
    var idColor: UIColor = .red
    
    func sendUpdateWorkInfoStatus() -> Bool {
        false
    }

    func restore(
        fromBackup myIdentity: String,
        withSecretKey mySecretKey: Data,
        onCompletion: @escaping () -> Void,
        onError: @escaping (any Error) -> Void
    ) {
        onCompletion()
    }
}

Messung
CHZG
829610092

¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet am  2026-11-04) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover


Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.