// swiftformat:disable acronyms
import Foundation
import ThreemaMacros
@objc public enum ThreemaProtocolError: Int, Error, CustomStringConvertible {
public typealias RawValue = Int
case badMessage = 667
case blockUnknownContact = 666
case doNotProcessOfferMessageInNotificationExtension = 680
case generalError = 100
case messageAlreadyProcessed = 671
case messageBlobDecryptionFailed = 673
case messageNonceReuse = 674
case messageProcessingFailed = 669
case messageSenderMismatch = 679
case messageToDeleteNotFound = 678
case messageToEditNotFound = 677
case notConnectedToMediator = 676
case notLoggedIn = 675
case safePasswordEmpty = 672
case unknownMessageType = 668
public var description: String {
let rawError = "ThreemaProtocolError(rawValue: \(rawValue))"
switch self {
case .badMessage:
return "\(rawError) 'Invalid message format or decryption failure'"
case .blockUnknownContact:
return "\(rawError) 'Unknown contact is blocked'"
case .doNotProcessOfferMessageInNotificationExtension:
return "\(rawError) 'Threema Call message Offer must not be processed in the Notification Extension'"
case .generalError:
return "\(rawError) 'General error'"
case .messageAlreadyProcessed:
return "\(rawError) 'Message already processed'"
case .messageBlobDecryptionFailed:
return "\(rawError) 'Blob decryption failure'"
case .messageNonceReuse:
return "\(rawError) 'Reuse of message nonce'"
case .messageProcessingFailed:
return "\(rawError) 'Processing of message failed'"
case .messageSenderMismatch:
return "\(rawError) 'Message sender mismatch'"
case .messageToDeleteNotFound:
return "\(rawError) 'Message to delete not found'"
case .messageToEditNotFound:
return "\(rawError) 'Message to edit not found'"
case .notConnectedToMediator:
return "\(rawError) 'Not connected to mediator'"
case .notLoggedIn:
return "\(rawError) 'Not logged in'"
case .safePasswordEmpty:
return "\(rawError) 'Threema Safe password is missing'"
case .unknownMessageType:
return "\(rawError) 'Unknown message type'"
}
}
}
// MARK: - ForwardSecurityMode + CustomStringConvertible
extension ForwardSecurityMode: CustomStringConvertible {
public var description: String {
switch self {
case .none:
return "none"
case .twoDH:
return "2DH"
case .fourDH:
return "4DH"
case .outgoingGroupNone:
return "outgoing group: none"
case .outgoingGroupPartial:
return "outgoing group: partial"
case .outgoingGroupFull:
return "outgoing group: full"
@unknown default:
return "unknown"
}
}
public var localizedLabel: String {
switch self {
case .none, .outgoingGroupNone:
return #localize("forward_security_none")
case .twoDH:
return #localize("forward_security_2dh")
case .fourDH:
return #localize("forward_security_4dh")
case .outgoingGroupPartial:
return #localize("forward_security_outgoing_group_partial")
case .outgoingGroupFull:
return #localize("forward_security_outgoing_group_full")
@unknown default:
return #localize("forward_security_none")
}
}
}
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet am 2026-11-04)
¤
*© Formatika GbR, Deutschland