Files
wt 7db327c588
iOS CI / Build and Test SwiftUI App (push) Canceled after 0s
Build Unsigned iOS and macOS Apps / Build Unsigned iOS IPA (push) Canceled after 0s
Build Unsigned iOS and macOS Apps / Build macOS ZIP (push) Canceled after 0s
added omemo2
2026-08-30 05:40:44 +07:00

55 lines
1.8 KiB
Swift

//
// SignalError.swift
//
// TigaseSwift OMEMO
// Copyright (C) 2019 "Tigase, Inc." <office@tigase.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. Look for COPYING file in the top folder.
// If not, see https://www.gnu.org/licenses/.
//
import Foundation
public enum SignalError: Int, Error {
// custom error code, not from libsignal but required for internal use to mark that message was not encrypted
case notEncrypted = -100000;
case noDestination = -100001;
case noMemory = -12;
case invalidArgument = -22;
case unknown = -1000;
case duplicateMessage = -1001;
case invalidKey = -1002;
case invalidKeyId = -1003;
case invalidMac = -1004;
case invalidMessage = -1005;
case invalidVersion = -1006;
case legacyMessage = -1007;
case noSession = -1008;
case staleKeyExchange = -1009;
case unstrustedIdentity = -1010;
case signatureVerificationFailed = -1011;
case invalidProtoBuf = -1100;
case fpInvalidVersion = -1200;
case fpIdentityMismatch = -1201;
public static func from(code: Int32) -> SignalError? {
guard code < 0 else {
return nil;
}
return SignalError(rawValue: Int(code)) ?? .unknown;
}
}