Fix build breakage from SMK.
This commit is contained in:
parent
8ae200ac21
commit
3738155c81
|
@ -405,11 +405,6 @@ class MessageContext(BaseContext):
|
|||
|
||||
writer.push_context(self.proto_name, self.swift_name)
|
||||
|
||||
if self.args.add_log_tag:
|
||||
writer.add('fileprivate static let logTag = "%s"' % self.swift_name)
|
||||
writer.add('fileprivate let logTag = "%s"' % self.swift_name)
|
||||
writer.newline()
|
||||
|
||||
for child in self.enums:
|
||||
child.generate(writer)
|
||||
|
||||
|
@ -670,6 +665,11 @@ public func serializedData() throws -> Data {
|
|||
writer.add('// MARK: - %s' % self.swift_builder_name)
|
||||
writer.newline()
|
||||
|
||||
# Convenience accessor.
|
||||
with writer.braced('@objc public class func builder() -> %s' % self.swift_builder_name) as writer:
|
||||
writer.add('return %s()' % (self.swift_builder_name, ))
|
||||
writer.newline()
|
||||
|
||||
writer.add('@objc public class %s: NSObject {' % self.swift_builder_name)
|
||||
writer.newline()
|
||||
|
||||
|
|
|
@ -16,6 +16,10 @@ public enum WebRTCProtoError: Error {
|
|||
|
||||
// MARK: - WebRTCProtoConnectedBuilder
|
||||
|
||||
@objc public class func builder() -> WebRTCProtoConnectedBuilder {
|
||||
return WebRTCProtoConnectedBuilder()
|
||||
}
|
||||
|
||||
@objc public class WebRTCProtoConnectedBuilder: NSObject {
|
||||
|
||||
private var proto = WebRTCProtos_Connected()
|
||||
|
@ -100,6 +104,10 @@ extension WebRTCProtoConnected.WebRTCProtoConnectedBuilder {
|
|||
|
||||
// MARK: - WebRTCProtoHangupBuilder
|
||||
|
||||
@objc public class func builder() -> WebRTCProtoHangupBuilder {
|
||||
return WebRTCProtoHangupBuilder()
|
||||
}
|
||||
|
||||
@objc public class WebRTCProtoHangupBuilder: NSObject {
|
||||
|
||||
private var proto = WebRTCProtos_Hangup()
|
||||
|
@ -184,6 +192,10 @@ extension WebRTCProtoHangup.WebRTCProtoHangupBuilder {
|
|||
|
||||
// MARK: - WebRTCProtoVideoStreamingStatusBuilder
|
||||
|
||||
@objc public class func builder() -> WebRTCProtoVideoStreamingStatusBuilder {
|
||||
return WebRTCProtoVideoStreamingStatusBuilder()
|
||||
}
|
||||
|
||||
@objc public class WebRTCProtoVideoStreamingStatusBuilder: NSObject {
|
||||
|
||||
private var proto = WebRTCProtos_VideoStreamingStatus()
|
||||
|
@ -279,6 +291,10 @@ extension WebRTCProtoVideoStreamingStatus.WebRTCProtoVideoStreamingStatusBuilder
|
|||
|
||||
// MARK: - WebRTCProtoDataBuilder
|
||||
|
||||
@objc public class func builder() -> WebRTCProtoDataBuilder {
|
||||
return WebRTCProtoDataBuilder()
|
||||
}
|
||||
|
||||
@objc public class WebRTCProtoDataBuilder: NSObject {
|
||||
|
||||
private var proto = WebRTCProtos_Data()
|
||||
|
@ -335,17 +351,17 @@ extension WebRTCProtoVideoStreamingStatus.WebRTCProtoVideoStreamingStatusBuilder
|
|||
}
|
||||
|
||||
fileprivate class func parseProto(_ proto: WebRTCProtos_Data) throws -> WebRTCProtoData {
|
||||
var connected: WebRTCProtoConnected? = nil
|
||||
var connected: WebRTCProtoConnected?
|
||||
if proto.hasConnected {
|
||||
connected = try WebRTCProtoConnected.parseProto(proto.connected)
|
||||
}
|
||||
|
||||
var hangup: WebRTCProtoHangup? = nil
|
||||
var hangup: WebRTCProtoHangup?
|
||||
if proto.hasHangup {
|
||||
hangup = try WebRTCProtoHangup.parseProto(proto.hangup)
|
||||
}
|
||||
|
||||
var videoStreamingStatus: WebRTCProtoVideoStreamingStatus? = nil
|
||||
var videoStreamingStatus: WebRTCProtoVideoStreamingStatus?
|
||||
if proto.hasVideoStreamingStatus {
|
||||
videoStreamingStatus = try WebRTCProtoVideoStreamingStatus.parseProto(proto.videoStreamingStatus)
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#import <AxolotlKit/NSData+keyVersionByte.h>
|
||||
#import <PureLayout/PureLayout.h>
|
||||
#import <Reachability/Reachability.h>
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
#import <SignalCoreKit/NSData+OWS.h>
|
||||
#import <SignalCoreKit/NSDate+OWS.h>
|
||||
#import <SignalCoreKit/NSString+SSK.h>
|
||||
|
@ -76,7 +77,6 @@
|
|||
#import <SignalServiceKit/AppVersion.h>
|
||||
#import <SignalServiceKit/Contact.h>
|
||||
#import <SignalServiceKit/ContactsUpdater.h>
|
||||
#import <SignalServiceKit/Cryptography.h>
|
||||
#import <SignalServiceKit/DataSource.h>
|
||||
#import <SignalServiceKit/MIMETypeUtil.h>
|
||||
#import <SignalServiceKit/NSData+Image.h>
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
//
|
||||
|
||||
#import "OWSLinkDeviceViewController.h"
|
||||
#import "Cryptography.h"
|
||||
#import "OWSDeviceProvisioningURLParser.h"
|
||||
#import "OWSLinkedDevicesTableViewController.h"
|
||||
#import "Signal-Swift.h"
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
#import <SignalMessaging/OWSProfileManager.h>
|
||||
#import <SignalServiceKit/OWSDevice.h>
|
||||
#import <SignalServiceKit/OWSDeviceProvisioner.h>
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
#import "OWSTableViewController.h"
|
||||
#import "SignalApp.h"
|
||||
#import "ThreadUtil.h"
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
#import <SignalCoreKit/NSDate+OWS.h>
|
||||
#import <SignalCoreKit/Randomness.h>
|
||||
#import <SignalMessaging/Environment.h>
|
||||
#import <SignalServiceKit/Cryptography.h>
|
||||
#import <SignalServiceKit/OWSDynamicOutgoingMessage.h>
|
||||
#import <SignalServiceKit/OWSPrimaryStorage.h>
|
||||
#import <SignalServiceKit/SignalServiceKit-Swift.h>
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UIColor+OWS.h"
|
||||
#import "OWSMath.h"
|
||||
#import "Theme.h"
|
||||
#import <SignalServiceKit/Cryptography.h>
|
||||
#import "UIColor+OWS.h"
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
#import "OWSProfileManager.h"
|
||||
#import "Environment.h"
|
||||
#import "OWSUserProfile.h"
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
#import <SignalCoreKit/NSData+OWS.h>
|
||||
#import <SignalCoreKit/NSDate+OWS.h>
|
||||
#import <SignalCoreKit/NSString+SSK.h>
|
||||
#import <SignalMessaging/SignalMessaging-Swift.h>
|
||||
#import <SignalServiceKit/AppContext.h>
|
||||
#import <SignalServiceKit/Cryptography.h>
|
||||
#import <SignalServiceKit/MIMETypeUtil.h>
|
||||
#import <SignalServiceKit/NSData+Image.h>
|
||||
#import <SignalServiceKit/NSNotificationCenter+OWS.h>
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
//
|
||||
|
||||
#import "OWSUserProfile.h"
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
#import <SignalCoreKit/NSData+OWS.h>
|
||||
#import <SignalCoreKit/NSString+SSK.h>
|
||||
#import <SignalServiceKit/AppContext.h>
|
||||
#import <SignalServiceKit/Cryptography.h>
|
||||
#import <SignalServiceKit/NSNotificationCenter+OWS.h>
|
||||
#import <SignalServiceKit/OWSFileSystem.h>
|
||||
#import <SignalServiceKit/OWSPrimaryStorage.h>
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
//
|
||||
|
||||
#import "CDSSigningCertificate.h"
|
||||
#import "Cryptography.h"
|
||||
#import <CommonCrypto/CommonCrypto.h>
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
#import <SignalCoreKit/NSData+OWS.h>
|
||||
#import <openssl/x509.h>
|
||||
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
//
|
||||
|
||||
#import "Contact.h"
|
||||
#import "Cryptography.h"
|
||||
#import "OWSPrimaryStorage.h"
|
||||
#import "PhoneNumber.h"
|
||||
#import "SSKEnvironment.h"
|
||||
#import "SignalRecipient.h"
|
||||
#import "TSAccountManager.h"
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
#import <SignalCoreKit/NSString+SSK.h>
|
||||
|
||||
@import Contacts;
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
#import "ContactDiscoveryService.h"
|
||||
#import "CDSQuote.h"
|
||||
#import "CDSSigningCertificate.h"
|
||||
#import "Cryptography.h"
|
||||
#import "OWSError.h"
|
||||
#import "OWSRequestFactory.h"
|
||||
#import "TSNetworkManager.h"
|
||||
#import <Curve25519Kit/Curve25519.h>
|
||||
#import <HKDFKit/HKDFKit.h>
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
#import <SignalCoreKit/NSData+OWS.h>
|
||||
#import <SignalCoreKit/NSDate+OWS.h>
|
||||
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
//
|
||||
|
||||
#import "ContactsUpdater.h"
|
||||
#import "Cryptography.h"
|
||||
#import "OWSError.h"
|
||||
#import "OWSPrimaryStorage.h"
|
||||
#import "OWSRequestFactory.h"
|
||||
#import "PhoneNumber.h"
|
||||
#import "SSKEnvironment.h"
|
||||
#import "TSNetworkManager.h"
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
#import <SignalCoreKit/Threading.h>
|
||||
#import <SignalServiceKit/SignalServiceKit-Swift.h>
|
||||
#import <YapDatabase/YapDatabase.h>
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
//
|
||||
|
||||
#import "TSThread.h"
|
||||
#import "Cryptography.h"
|
||||
#import "OWSDisappearingMessagesConfiguration.h"
|
||||
#import "OWSPrimaryStorage.h"
|
||||
#import "OWSReadTracking.h"
|
||||
|
@ -13,6 +12,7 @@
|
|||
#import "TSInteraction.h"
|
||||
#import "TSInvalidIdentityKeyReceivingErrorMessage.h"
|
||||
#import "TSOutgoingMessage.h"
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
#import <SignalCoreKit/NSDate+OWS.h>
|
||||
#import <SignalCoreKit/NSString+SSK.h>
|
||||
#import <YapDatabase/YapDatabase.h>
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#import "OWSContactsOutputStream.h"
|
||||
#import "Contact.h"
|
||||
#import "ContactsManagerProtocol.h"
|
||||
#import "Cryptography.h"
|
||||
#import "MIMETypeUtil.h"
|
||||
#import "NSData+keyVersionByte.h"
|
||||
#import "OWSBlockingManager.h"
|
||||
|
@ -13,6 +12,7 @@
|
|||
#import "OWSRecipientIdentity.h"
|
||||
#import "SignalAccount.h"
|
||||
#import "TSContactThread.h"
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
#import <SignalCoreKit/NSData+OWS.h>
|
||||
#import <SignalServiceKit/SignalServiceKit-Swift.h>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#import <CommonCrypto/CommonCrypto.h>
|
||||
#import <Curve25519Kit/Curve25519.h>
|
||||
#import <HKDFKit/HKDFKit.h>
|
||||
#import <SignalServiceKit/Cryptography.h>
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
//
|
||||
|
||||
#import "OWSVerificationStateSyncMessage.h"
|
||||
#import "Cryptography.h"
|
||||
#import "OWSIdentityManager.h"
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
#import <SignalServiceKit/SignalServiceKit-Swift.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
#import "OWSAttachmentsProcessor.h"
|
||||
#import "AppContext.h"
|
||||
#import "Cryptography.h"
|
||||
#import "MIMETypeUtil.h"
|
||||
#import "NSNotificationCenter+OWS.h"
|
||||
#import "OWSBackgroundTask.h"
|
||||
|
@ -21,6 +20,7 @@
|
|||
#import "TSMessage.h"
|
||||
#import "TSNetworkManager.h"
|
||||
#import "TSThread.h"
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
#import <SignalServiceKit/SignalServiceKit-Swift.h>
|
||||
#import <YapDatabase/YapDatabaseConnection.h>
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
//
|
||||
|
||||
#import "OWSOutgoingSyncMessage.h"
|
||||
#import "Cryptography.h"
|
||||
#import "ProtoUtils.h"
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
#import <SignalCoreKit/NSDate+OWS.h>
|
||||
#import <SignalServiceKit/SignalServiceKit-Swift.h>
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#import "AppContext.h"
|
||||
#import "AppReadiness.h"
|
||||
#import "ContactsManagerProtocol.h"
|
||||
#import "Cryptography.h"
|
||||
#import "MimeTypeUtil.h"
|
||||
#import "NotificationsProtocol.h"
|
||||
#import "OWSAttachmentsProcessor.h"
|
||||
|
@ -45,6 +44,7 @@
|
|||
#import "TSNetworkManager.h"
|
||||
#import "TSOutgoingMessage.h"
|
||||
#import "TSQuotedMessage.h"
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
#import <SignalCoreKit/NSDate+OWS.h>
|
||||
#import <SignalCoreKit/NSString+SSK.h>
|
||||
#import <SignalServiceKit/SignalServiceKit-Swift.h>
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
//
|
||||
|
||||
#import "OWSOutgoingNullMessage.h"
|
||||
#import "Cryptography.h"
|
||||
#import "OWSVerificationStateSyncMessage.h"
|
||||
#import "TSContactThread.h"
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
#import <SignalCoreKit/NSDate+OWS.h>
|
||||
#import <SignalServiceKit/SignalServiceKit-Swift.h>
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
//
|
||||
|
||||
#import "OWSUploadOperation.h"
|
||||
#import "Cryptography.h"
|
||||
#import "MIMETypeUtil.h"
|
||||
#import "NSError+MessageSending.h"
|
||||
#import "NSNotificationCenter+OWS.h"
|
||||
|
@ -14,6 +13,7 @@
|
|||
#import "SSKEnvironment.h"
|
||||
#import "TSAttachmentStream.h"
|
||||
#import "TSNetworkManager.h"
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
#import <YapDatabase/YapDatabaseConnection.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#import "TSSocketManager.h"
|
||||
#import "AppContext.h"
|
||||
#import "AppReadiness.h"
|
||||
#import "Cryptography.h"
|
||||
#import "NSNotificationCenter+OWS.h"
|
||||
#import "NSTimer+OWS.h"
|
||||
#import "NotificationsProtocol.h"
|
||||
|
@ -21,6 +20,7 @@
|
|||
#import "TSConstants.h"
|
||||
#import "TSErrorMessage.h"
|
||||
#import "TSRequest.h"
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
#import <SignalCoreKit/Threading.h>
|
||||
#import <SignalServiceKit/SignalServiceKit-Swift.h>
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
//
|
||||
|
||||
#import "ProtoUtils.h"
|
||||
#import "Cryptography.h"
|
||||
#import "ProfileManagerProtocol.h"
|
||||
#import "SSKEnvironment.h"
|
||||
#import "TSThread.h"
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
#import <SignalServiceKit/SignalServiceKit-Swift.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
|
|
@ -16,6 +16,10 @@ public enum FingerprintProtoError: Error {
|
|||
|
||||
// MARK: - FingerprintProtoLogicalFingerprintBuilder
|
||||
|
||||
@objc public class func builder() -> FingerprintProtoLogicalFingerprintBuilder {
|
||||
return FingerprintProtoLogicalFingerprintBuilder()
|
||||
}
|
||||
|
||||
@objc public class FingerprintProtoLogicalFingerprintBuilder: NSObject {
|
||||
|
||||
private var proto = FingerprintProtos_LogicalFingerprint()
|
||||
|
@ -100,6 +104,10 @@ extension FingerprintProtoLogicalFingerprint.FingerprintProtoLogicalFingerprintB
|
|||
|
||||
// MARK: - FingerprintProtoLogicalFingerprintsBuilder
|
||||
|
||||
@objc public class func builder() -> FingerprintProtoLogicalFingerprintsBuilder {
|
||||
return FingerprintProtoLogicalFingerprintsBuilder()
|
||||
}
|
||||
|
||||
@objc public class FingerprintProtoLogicalFingerprintsBuilder: NSObject {
|
||||
|
||||
private var proto = FingerprintProtos_LogicalFingerprints()
|
||||
|
|
|
@ -16,6 +16,10 @@ public enum ProvisioningProtoError: Error {
|
|||
|
||||
// MARK: - ProvisioningProtoProvisionEnvelopeBuilder
|
||||
|
||||
@objc public class func builder() -> ProvisioningProtoProvisionEnvelopeBuilder {
|
||||
return ProvisioningProtoProvisionEnvelopeBuilder()
|
||||
}
|
||||
|
||||
@objc public class ProvisioningProtoProvisionEnvelopeBuilder: NSObject {
|
||||
|
||||
private var proto = ProvisioningProtos_ProvisionEnvelope()
|
||||
|
@ -115,6 +119,10 @@ extension ProvisioningProtoProvisionEnvelope.ProvisioningProtoProvisionEnvelopeB
|
|||
|
||||
// MARK: - ProvisioningProtoProvisionMessageBuilder
|
||||
|
||||
@objc public class func builder() -> ProvisioningProtoProvisionMessageBuilder {
|
||||
return ProvisioningProtoProvisionMessageBuilder()
|
||||
}
|
||||
|
||||
@objc public class ProvisioningProtoProvisionMessageBuilder: NSObject {
|
||||
|
||||
private var proto = ProvisioningProtos_ProvisionMessage()
|
||||
|
|
|
@ -46,6 +46,10 @@ public enum SSKProtoError: Error {
|
|||
|
||||
// MARK: - SSKProtoEnvelopeBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoEnvelopeBuilder {
|
||||
return SSKProtoEnvelopeBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoEnvelopeBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_Envelope()
|
||||
|
@ -217,6 +221,10 @@ extension SSKProtoEnvelope.SSKProtoEnvelopeBuilder {
|
|||
|
||||
// MARK: - SSKProtoContentBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoContentBuilder {
|
||||
return SSKProtoContentBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoContentBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_Content()
|
||||
|
@ -289,27 +297,27 @@ extension SSKProtoEnvelope.SSKProtoEnvelopeBuilder {
|
|||
}
|
||||
|
||||
fileprivate class func parseProto(_ proto: SignalServiceProtos_Content) throws -> SSKProtoContent {
|
||||
var dataMessage: SSKProtoDataMessage? = nil
|
||||
var dataMessage: SSKProtoDataMessage?
|
||||
if proto.hasDataMessage {
|
||||
dataMessage = try SSKProtoDataMessage.parseProto(proto.dataMessage)
|
||||
}
|
||||
|
||||
var syncMessage: SSKProtoSyncMessage? = nil
|
||||
var syncMessage: SSKProtoSyncMessage?
|
||||
if proto.hasSyncMessage {
|
||||
syncMessage = try SSKProtoSyncMessage.parseProto(proto.syncMessage)
|
||||
}
|
||||
|
||||
var callMessage: SSKProtoCallMessage? = nil
|
||||
var callMessage: SSKProtoCallMessage?
|
||||
if proto.hasCallMessage {
|
||||
callMessage = try SSKProtoCallMessage.parseProto(proto.callMessage)
|
||||
}
|
||||
|
||||
var nullMessage: SSKProtoNullMessage? = nil
|
||||
var nullMessage: SSKProtoNullMessage?
|
||||
if proto.hasNullMessage {
|
||||
nullMessage = try SSKProtoNullMessage.parseProto(proto.nullMessage)
|
||||
}
|
||||
|
||||
var receiptMessage: SSKProtoReceiptMessage? = nil
|
||||
var receiptMessage: SSKProtoReceiptMessage?
|
||||
if proto.hasReceiptMessage {
|
||||
receiptMessage = try SSKProtoReceiptMessage.parseProto(proto.receiptMessage)
|
||||
}
|
||||
|
@ -350,6 +358,10 @@ extension SSKProtoContent.SSKProtoContentBuilder {
|
|||
|
||||
// MARK: - SSKProtoCallMessageOfferBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoCallMessageOfferBuilder {
|
||||
return SSKProtoCallMessageOfferBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoCallMessageOfferBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_CallMessage.Offer()
|
||||
|
@ -449,6 +461,10 @@ extension SSKProtoCallMessageOffer.SSKProtoCallMessageOfferBuilder {
|
|||
|
||||
// MARK: - SSKProtoCallMessageAnswerBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoCallMessageAnswerBuilder {
|
||||
return SSKProtoCallMessageAnswerBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoCallMessageAnswerBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_CallMessage.Answer()
|
||||
|
@ -548,6 +564,10 @@ extension SSKProtoCallMessageAnswer.SSKProtoCallMessageAnswerBuilder {
|
|||
|
||||
// MARK: - SSKProtoCallMessageIceUpdateBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoCallMessageIceUpdateBuilder {
|
||||
return SSKProtoCallMessageIceUpdateBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoCallMessageIceUpdateBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_CallMessage.IceUpdate()
|
||||
|
@ -677,6 +697,10 @@ extension SSKProtoCallMessageIceUpdate.SSKProtoCallMessageIceUpdateBuilder {
|
|||
|
||||
// MARK: - SSKProtoCallMessageBusyBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoCallMessageBusyBuilder {
|
||||
return SSKProtoCallMessageBusyBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoCallMessageBusyBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_CallMessage.Busy()
|
||||
|
@ -761,6 +785,10 @@ extension SSKProtoCallMessageBusy.SSKProtoCallMessageBusyBuilder {
|
|||
|
||||
// MARK: - SSKProtoCallMessageHangupBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoCallMessageHangupBuilder {
|
||||
return SSKProtoCallMessageHangupBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoCallMessageHangupBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_CallMessage.Hangup()
|
||||
|
@ -845,6 +873,10 @@ extension SSKProtoCallMessageHangup.SSKProtoCallMessageHangupBuilder {
|
|||
|
||||
// MARK: - SSKProtoCallMessageBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoCallMessageBuilder {
|
||||
return SSKProtoCallMessageBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoCallMessageBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_CallMessage()
|
||||
|
@ -937,12 +969,12 @@ extension SSKProtoCallMessageHangup.SSKProtoCallMessageHangupBuilder {
|
|||
}
|
||||
|
||||
fileprivate class func parseProto(_ proto: SignalServiceProtos_CallMessage) throws -> SSKProtoCallMessage {
|
||||
var offer: SSKProtoCallMessageOffer? = nil
|
||||
var offer: SSKProtoCallMessageOffer?
|
||||
if proto.hasOffer {
|
||||
offer = try SSKProtoCallMessageOffer.parseProto(proto.offer)
|
||||
}
|
||||
|
||||
var answer: SSKProtoCallMessageAnswer? = nil
|
||||
var answer: SSKProtoCallMessageAnswer?
|
||||
if proto.hasAnswer {
|
||||
answer = try SSKProtoCallMessageAnswer.parseProto(proto.answer)
|
||||
}
|
||||
|
@ -950,12 +982,12 @@ extension SSKProtoCallMessageHangup.SSKProtoCallMessageHangupBuilder {
|
|||
var iceUpdate: [SSKProtoCallMessageIceUpdate] = []
|
||||
iceUpdate = try proto.iceUpdate.map { try SSKProtoCallMessageIceUpdate.parseProto($0) }
|
||||
|
||||
var hangup: SSKProtoCallMessageHangup? = nil
|
||||
var hangup: SSKProtoCallMessageHangup?
|
||||
if proto.hasHangup {
|
||||
hangup = try SSKProtoCallMessageHangup.parseProto(proto.hangup)
|
||||
}
|
||||
|
||||
var busy: SSKProtoCallMessageBusy? = nil
|
||||
var busy: SSKProtoCallMessageBusy?
|
||||
if proto.hasBusy {
|
||||
busy = try SSKProtoCallMessageBusy.parseProto(proto.busy)
|
||||
}
|
||||
|
@ -1014,6 +1046,10 @@ extension SSKProtoCallMessage.SSKProtoCallMessageBuilder {
|
|||
|
||||
// MARK: - SSKProtoDataMessageQuoteQuotedAttachmentBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoDataMessageQuoteQuotedAttachmentBuilder {
|
||||
return SSKProtoDataMessageQuoteQuotedAttachmentBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoDataMessageQuoteQuotedAttachmentBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_DataMessage.Quote.QuotedAttachment()
|
||||
|
@ -1093,7 +1129,7 @@ extension SSKProtoCallMessage.SSKProtoCallMessageBuilder {
|
|||
}
|
||||
|
||||
fileprivate class func parseProto(_ proto: SignalServiceProtos_DataMessage.Quote.QuotedAttachment) throws -> SSKProtoDataMessageQuoteQuotedAttachment {
|
||||
var thumbnail: SSKProtoAttachmentPointer? = nil
|
||||
var thumbnail: SSKProtoAttachmentPointer?
|
||||
if proto.hasThumbnail {
|
||||
thumbnail = try SSKProtoAttachmentPointer.parseProto(proto.thumbnail)
|
||||
}
|
||||
|
@ -1130,6 +1166,10 @@ extension SSKProtoDataMessageQuoteQuotedAttachment.SSKProtoDataMessageQuoteQuote
|
|||
|
||||
// MARK: - SSKProtoDataMessageQuoteBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoDataMessageQuoteBuilder {
|
||||
return SSKProtoDataMessageQuoteBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoDataMessageQuoteBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_DataMessage.Quote()
|
||||
|
@ -1261,6 +1301,10 @@ extension SSKProtoDataMessageQuote.SSKProtoDataMessageQuoteBuilder {
|
|||
|
||||
// MARK: - SSKProtoDataMessageContactNameBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoDataMessageContactNameBuilder {
|
||||
return SSKProtoDataMessageContactNameBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoDataMessageContactNameBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_DataMessage.Contact.Name()
|
||||
|
@ -1435,6 +1479,10 @@ extension SSKProtoDataMessageContactName.SSKProtoDataMessageContactNameBuilder {
|
|||
|
||||
// MARK: - SSKProtoDataMessageContactPhoneBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoDataMessageContactPhoneBuilder {
|
||||
return SSKProtoDataMessageContactPhoneBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoDataMessageContactPhoneBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_DataMessage.Contact.Phone()
|
||||
|
@ -1564,6 +1612,10 @@ extension SSKProtoDataMessageContactPhone.SSKProtoDataMessageContactPhoneBuilder
|
|||
|
||||
// MARK: - SSKProtoDataMessageContactEmailBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoDataMessageContactEmailBuilder {
|
||||
return SSKProtoDataMessageContactEmailBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoDataMessageContactEmailBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_DataMessage.Contact.Email()
|
||||
|
@ -1690,6 +1742,10 @@ extension SSKProtoDataMessageContactEmail.SSKProtoDataMessageContactEmailBuilder
|
|||
|
||||
// MARK: - SSKProtoDataMessageContactPostalAddressBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoDataMessageContactPostalAddressBuilder {
|
||||
return SSKProtoDataMessageContactPostalAddressBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoDataMessageContactPostalAddressBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_DataMessage.Contact.PostalAddress()
|
||||
|
@ -1876,6 +1932,10 @@ extension SSKProtoDataMessageContactPostalAddress.SSKProtoDataMessageContactPost
|
|||
|
||||
// MARK: - SSKProtoDataMessageContactAvatarBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoDataMessageContactAvatarBuilder {
|
||||
return SSKProtoDataMessageContactAvatarBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoDataMessageContactAvatarBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_DataMessage.Contact.Avatar()
|
||||
|
@ -1927,7 +1987,7 @@ extension SSKProtoDataMessageContactPostalAddress.SSKProtoDataMessageContactPost
|
|||
}
|
||||
|
||||
fileprivate class func parseProto(_ proto: SignalServiceProtos_DataMessage.Contact.Avatar) throws -> SSKProtoDataMessageContactAvatar {
|
||||
var avatar: SSKProtoAttachmentPointer? = nil
|
||||
var avatar: SSKProtoAttachmentPointer?
|
||||
if proto.hasAvatar {
|
||||
avatar = try SSKProtoAttachmentPointer.parseProto(proto.avatar)
|
||||
}
|
||||
|
@ -1964,6 +2024,10 @@ extension SSKProtoDataMessageContactAvatar.SSKProtoDataMessageContactAvatarBuild
|
|||
|
||||
// MARK: - SSKProtoDataMessageContactBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoDataMessageContactBuilder {
|
||||
return SSKProtoDataMessageContactBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoDataMessageContactBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_DataMessage.Contact()
|
||||
|
@ -2068,7 +2132,7 @@ extension SSKProtoDataMessageContactAvatar.SSKProtoDataMessageContactAvatarBuild
|
|||
}
|
||||
|
||||
fileprivate class func parseProto(_ proto: SignalServiceProtos_DataMessage.Contact) throws -> SSKProtoDataMessageContact {
|
||||
var name: SSKProtoDataMessageContactName? = nil
|
||||
var name: SSKProtoDataMessageContactName?
|
||||
if proto.hasName {
|
||||
name = try SSKProtoDataMessageContactName.parseProto(proto.name)
|
||||
}
|
||||
|
@ -2082,7 +2146,7 @@ extension SSKProtoDataMessageContactAvatar.SSKProtoDataMessageContactAvatarBuild
|
|||
var address: [SSKProtoDataMessageContactPostalAddress] = []
|
||||
address = try proto.address.map { try SSKProtoDataMessageContactPostalAddress.parseProto($0) }
|
||||
|
||||
var avatar: SSKProtoDataMessageContactAvatar? = nil
|
||||
var avatar: SSKProtoDataMessageContactAvatar?
|
||||
if proto.hasAvatar {
|
||||
avatar = try SSKProtoDataMessageContactAvatar.parseProto(proto.avatar)
|
||||
}
|
||||
|
@ -2147,6 +2211,10 @@ extension SSKProtoDataMessageContact.SSKProtoDataMessageContactBuilder {
|
|||
|
||||
// MARK: - SSKProtoDataMessageBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoDataMessageBuilder {
|
||||
return SSKProtoDataMessageBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoDataMessageBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_DataMessage()
|
||||
|
@ -2287,12 +2355,12 @@ extension SSKProtoDataMessageContact.SSKProtoDataMessageContactBuilder {
|
|||
var attachments: [SSKProtoAttachmentPointer] = []
|
||||
attachments = try proto.attachments.map { try SSKProtoAttachmentPointer.parseProto($0) }
|
||||
|
||||
var group: SSKProtoGroupContext? = nil
|
||||
var group: SSKProtoGroupContext?
|
||||
if proto.hasGroup {
|
||||
group = try SSKProtoGroupContext.parseProto(proto.group)
|
||||
}
|
||||
|
||||
var quote: SSKProtoDataMessageQuote? = nil
|
||||
var quote: SSKProtoDataMessageQuote?
|
||||
if proto.hasQuote {
|
||||
quote = try SSKProtoDataMessageQuote.parseProto(proto.quote)
|
||||
}
|
||||
|
@ -2335,6 +2403,10 @@ extension SSKProtoDataMessage.SSKProtoDataMessageBuilder {
|
|||
|
||||
// MARK: - SSKProtoNullMessageBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoNullMessageBuilder {
|
||||
return SSKProtoNullMessageBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoNullMessageBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_NullMessage()
|
||||
|
@ -2433,6 +2505,10 @@ extension SSKProtoNullMessage.SSKProtoNullMessageBuilder {
|
|||
|
||||
// MARK: - SSKProtoReceiptMessageBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoReceiptMessageBuilder {
|
||||
return SSKProtoReceiptMessageBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoReceiptMessageBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_ReceiptMessage()
|
||||
|
@ -2555,6 +2631,10 @@ extension SSKProtoReceiptMessage.SSKProtoReceiptMessageBuilder {
|
|||
|
||||
// MARK: - SSKProtoVerifiedBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoVerifiedBuilder {
|
||||
return SSKProtoVerifiedBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoVerifiedBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_Verified()
|
||||
|
@ -2678,6 +2758,10 @@ extension SSKProtoVerified.SSKProtoVerifiedBuilder {
|
|||
|
||||
// MARK: - SSKProtoSyncMessageSentBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoSyncMessageSentBuilder {
|
||||
return SSKProtoSyncMessageSentBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoSyncMessageSentBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_SyncMessage.Sent()
|
||||
|
@ -2754,7 +2838,7 @@ extension SSKProtoVerified.SSKProtoVerifiedBuilder {
|
|||
}
|
||||
|
||||
fileprivate class func parseProto(_ proto: SignalServiceProtos_SyncMessage.Sent) throws -> SSKProtoSyncMessageSent {
|
||||
var message: SSKProtoDataMessage? = nil
|
||||
var message: SSKProtoDataMessage?
|
||||
if proto.hasMessage {
|
||||
message = try SSKProtoDataMessage.parseProto(proto.message)
|
||||
}
|
||||
|
@ -2791,6 +2875,10 @@ extension SSKProtoSyncMessageSent.SSKProtoSyncMessageSentBuilder {
|
|||
|
||||
// MARK: - SSKProtoSyncMessageContactsBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoSyncMessageContactsBuilder {
|
||||
return SSKProtoSyncMessageContactsBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoSyncMessageContactsBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_SyncMessage.Contacts()
|
||||
|
@ -2886,6 +2974,10 @@ extension SSKProtoSyncMessageContacts.SSKProtoSyncMessageContactsBuilder {
|
|||
|
||||
// MARK: - SSKProtoSyncMessageGroupsBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoSyncMessageGroupsBuilder {
|
||||
return SSKProtoSyncMessageGroupsBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoSyncMessageGroupsBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_SyncMessage.Groups()
|
||||
|
@ -2926,7 +3018,7 @@ extension SSKProtoSyncMessageContacts.SSKProtoSyncMessageContactsBuilder {
|
|||
}
|
||||
|
||||
fileprivate class func parseProto(_ proto: SignalServiceProtos_SyncMessage.Groups) throws -> SSKProtoSyncMessageGroups {
|
||||
var blob: SSKProtoAttachmentPointer? = nil
|
||||
var blob: SSKProtoAttachmentPointer?
|
||||
if proto.hasBlob {
|
||||
blob = try SSKProtoAttachmentPointer.parseProto(proto.blob)
|
||||
}
|
||||
|
@ -2963,6 +3055,10 @@ extension SSKProtoSyncMessageGroups.SSKProtoSyncMessageGroupsBuilder {
|
|||
|
||||
// MARK: - SSKProtoSyncMessageBlockedBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoSyncMessageBlockedBuilder {
|
||||
return SSKProtoSyncMessageBlockedBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoSyncMessageBlockedBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_SyncMessage.Blocked()
|
||||
|
@ -3084,6 +3180,10 @@ extension SSKProtoSyncMessageBlocked.SSKProtoSyncMessageBlockedBuilder {
|
|||
|
||||
// MARK: - SSKProtoSyncMessageRequestBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoSyncMessageRequestBuilder {
|
||||
return SSKProtoSyncMessageRequestBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoSyncMessageRequestBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_SyncMessage.Request()
|
||||
|
@ -3168,6 +3268,10 @@ extension SSKProtoSyncMessageRequest.SSKProtoSyncMessageRequestBuilder {
|
|||
|
||||
// MARK: - SSKProtoSyncMessageReadBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoSyncMessageReadBuilder {
|
||||
return SSKProtoSyncMessageReadBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoSyncMessageReadBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_SyncMessage.Read()
|
||||
|
@ -3267,6 +3371,10 @@ extension SSKProtoSyncMessageRead.SSKProtoSyncMessageReadBuilder {
|
|||
|
||||
// MARK: - SSKProtoSyncMessageConfigurationBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoSyncMessageConfigurationBuilder {
|
||||
return SSKProtoSyncMessageConfigurationBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoSyncMessageConfigurationBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_SyncMessage.Configuration()
|
||||
|
@ -3341,6 +3449,10 @@ extension SSKProtoSyncMessageConfiguration.SSKProtoSyncMessageConfigurationBuild
|
|||
|
||||
// MARK: - SSKProtoSyncMessageBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoSyncMessageBuilder {
|
||||
return SSKProtoSyncMessageBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoSyncMessageBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_SyncMessage()
|
||||
|
@ -3457,22 +3569,22 @@ extension SSKProtoSyncMessageConfiguration.SSKProtoSyncMessageConfigurationBuild
|
|||
}
|
||||
|
||||
fileprivate class func parseProto(_ proto: SignalServiceProtos_SyncMessage) throws -> SSKProtoSyncMessage {
|
||||
var sent: SSKProtoSyncMessageSent? = nil
|
||||
var sent: SSKProtoSyncMessageSent?
|
||||
if proto.hasSent {
|
||||
sent = try SSKProtoSyncMessageSent.parseProto(proto.sent)
|
||||
}
|
||||
|
||||
var contacts: SSKProtoSyncMessageContacts? = nil
|
||||
var contacts: SSKProtoSyncMessageContacts?
|
||||
if proto.hasContacts {
|
||||
contacts = try SSKProtoSyncMessageContacts.parseProto(proto.contacts)
|
||||
}
|
||||
|
||||
var groups: SSKProtoSyncMessageGroups? = nil
|
||||
var groups: SSKProtoSyncMessageGroups?
|
||||
if proto.hasGroups {
|
||||
groups = try SSKProtoSyncMessageGroups.parseProto(proto.groups)
|
||||
}
|
||||
|
||||
var request: SSKProtoSyncMessageRequest? = nil
|
||||
var request: SSKProtoSyncMessageRequest?
|
||||
if proto.hasRequest {
|
||||
request = try SSKProtoSyncMessageRequest.parseProto(proto.request)
|
||||
}
|
||||
|
@ -3480,17 +3592,17 @@ extension SSKProtoSyncMessageConfiguration.SSKProtoSyncMessageConfigurationBuild
|
|||
var read: [SSKProtoSyncMessageRead] = []
|
||||
read = try proto.read.map { try SSKProtoSyncMessageRead.parseProto($0) }
|
||||
|
||||
var blocked: SSKProtoSyncMessageBlocked? = nil
|
||||
var blocked: SSKProtoSyncMessageBlocked?
|
||||
if proto.hasBlocked {
|
||||
blocked = try SSKProtoSyncMessageBlocked.parseProto(proto.blocked)
|
||||
}
|
||||
|
||||
var verified: SSKProtoVerified? = nil
|
||||
var verified: SSKProtoVerified?
|
||||
if proto.hasVerified {
|
||||
verified = try SSKProtoVerified.parseProto(proto.verified)
|
||||
}
|
||||
|
||||
var configuration: SSKProtoSyncMessageConfiguration? = nil
|
||||
var configuration: SSKProtoSyncMessageConfiguration?
|
||||
if proto.hasConfiguration {
|
||||
configuration = try SSKProtoSyncMessageConfiguration.parseProto(proto.configuration)
|
||||
}
|
||||
|
@ -3552,6 +3664,10 @@ extension SSKProtoSyncMessage.SSKProtoSyncMessageBuilder {
|
|||
|
||||
// MARK: - SSKProtoAttachmentPointerBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoAttachmentPointerBuilder {
|
||||
return SSKProtoAttachmentPointerBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoAttachmentPointerBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_AttachmentPointer()
|
||||
|
@ -3780,6 +3896,10 @@ extension SSKProtoAttachmentPointer.SSKProtoAttachmentPointerBuilder {
|
|||
|
||||
// MARK: - SSKProtoGroupContextBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoGroupContextBuilder {
|
||||
return SSKProtoGroupContextBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoGroupContextBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_GroupContext()
|
||||
|
@ -3882,7 +4002,7 @@ extension SSKProtoAttachmentPointer.SSKProtoAttachmentPointerBuilder {
|
|||
}
|
||||
let type = SSKProtoGroupContextTypeWrap(proto.type)
|
||||
|
||||
var avatar: SSKProtoAttachmentPointer? = nil
|
||||
var avatar: SSKProtoAttachmentPointer?
|
||||
if proto.hasAvatar {
|
||||
avatar = try SSKProtoAttachmentPointer.parseProto(proto.avatar)
|
||||
}
|
||||
|
@ -3921,6 +4041,10 @@ extension SSKProtoGroupContext.SSKProtoGroupContextBuilder {
|
|||
|
||||
// MARK: - SSKProtoContactDetailsAvatarBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoContactDetailsAvatarBuilder {
|
||||
return SSKProtoContactDetailsAvatarBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoContactDetailsAvatarBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_ContactDetails.Avatar()
|
||||
|
@ -4009,6 +4133,10 @@ extension SSKProtoContactDetailsAvatar.SSKProtoContactDetailsAvatarBuilder {
|
|||
|
||||
// MARK: - SSKProtoContactDetailsBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoContactDetailsBuilder {
|
||||
return SSKProtoContactDetailsBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoContactDetailsBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_ContactDetails()
|
||||
|
@ -4141,12 +4269,12 @@ extension SSKProtoContactDetailsAvatar.SSKProtoContactDetailsAvatarBuilder {
|
|||
}
|
||||
let number = proto.number
|
||||
|
||||
var avatar: SSKProtoContactDetailsAvatar? = nil
|
||||
var avatar: SSKProtoContactDetailsAvatar?
|
||||
if proto.hasAvatar {
|
||||
avatar = try SSKProtoContactDetailsAvatar.parseProto(proto.avatar)
|
||||
}
|
||||
|
||||
var verified: SSKProtoVerified? = nil
|
||||
var verified: SSKProtoVerified?
|
||||
if proto.hasVerified {
|
||||
verified = try SSKProtoVerified.parseProto(proto.verified)
|
||||
}
|
||||
|
@ -4185,6 +4313,10 @@ extension SSKProtoContactDetails.SSKProtoContactDetailsBuilder {
|
|||
|
||||
// MARK: - SSKProtoGroupDetailsAvatarBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoGroupDetailsAvatarBuilder {
|
||||
return SSKProtoGroupDetailsAvatarBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoGroupDetailsAvatarBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_GroupDetails.Avatar()
|
||||
|
@ -4273,6 +4405,10 @@ extension SSKProtoGroupDetailsAvatar.SSKProtoGroupDetailsAvatarBuilder {
|
|||
|
||||
// MARK: - SSKProtoGroupDetailsBuilder
|
||||
|
||||
@objc public class func builder() -> SSKProtoGroupDetailsBuilder {
|
||||
return SSKProtoGroupDetailsBuilder()
|
||||
}
|
||||
|
||||
@objc public class SSKProtoGroupDetailsBuilder: NSObject {
|
||||
|
||||
private var proto = SignalServiceProtos_GroupDetails()
|
||||
|
@ -4408,7 +4544,7 @@ extension SSKProtoGroupDetailsAvatar.SSKProtoGroupDetailsAvatarBuilder {
|
|||
}
|
||||
let id = proto.id
|
||||
|
||||
var avatar: SSKProtoGroupDetailsAvatar? = nil
|
||||
var avatar: SSKProtoGroupDetailsAvatar?
|
||||
if proto.hasAvatar {
|
||||
avatar = try SSKProtoGroupDetailsAvatar.parseProto(proto.avatar)
|
||||
}
|
||||
|
|
|
@ -46,6 +46,10 @@ public enum SignalIOSProtoError: Error {
|
|||
|
||||
// MARK: - SignalIOSProtoBackupSnapshotBackupEntityBuilder
|
||||
|
||||
@objc public class func builder() -> SignalIOSProtoBackupSnapshotBackupEntityBuilder {
|
||||
return SignalIOSProtoBackupSnapshotBackupEntityBuilder()
|
||||
}
|
||||
|
||||
@objc public class SignalIOSProtoBackupSnapshotBackupEntityBuilder: NSObject {
|
||||
|
||||
private var proto = IOSProtos_BackupSnapshot.BackupEntity()
|
||||
|
@ -145,6 +149,10 @@ extension SignalIOSProtoBackupSnapshotBackupEntity.SignalIOSProtoBackupSnapshotB
|
|||
|
||||
// MARK: - SignalIOSProtoBackupSnapshotBuilder
|
||||
|
||||
@objc public class func builder() -> SignalIOSProtoBackupSnapshotBuilder {
|
||||
return SignalIOSProtoBackupSnapshotBuilder()
|
||||
}
|
||||
|
||||
@objc public class SignalIOSProtoBackupSnapshotBuilder: NSObject {
|
||||
|
||||
private var proto = IOSProtos_BackupSnapshot()
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
// DO NOT EDIT.
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: SignalService.proto
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
// For information on using the generated types, please see the documenation:
|
||||
// https://github.com/apple/swift-protobuf/
|
||||
|
||||
//*
|
||||
// Copyright (C) 2014-2016 Open Whisper Systems
|
||||
|
@ -22,7 +18,7 @@ import SwiftProtobuf
|
|||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that your are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
@ -140,15 +136,23 @@ struct SignalServiceProtos_Envelope {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _type: SignalServiceProtos_Envelope.TypeEnum? = nil
|
||||
fileprivate var _source: String? = nil
|
||||
fileprivate var _sourceDevice: UInt32? = nil
|
||||
fileprivate var _relay: String? = nil
|
||||
fileprivate var _timestamp: UInt64? = nil
|
||||
fileprivate var _legacyMessage: Data? = nil
|
||||
fileprivate var _content: Data? = nil
|
||||
fileprivate var _type: SignalServiceProtos_Envelope.TypeEnum?
|
||||
fileprivate var _source: String?
|
||||
fileprivate var _sourceDevice: UInt32?
|
||||
fileprivate var _relay: String?
|
||||
fileprivate var _timestamp: UInt64?
|
||||
fileprivate var _legacyMessage: Data?
|
||||
fileprivate var _content: Data?
|
||||
}
|
||||
|
||||
#if swift(>=4.2)
|
||||
|
||||
extension SignalServiceProtos_Envelope.TypeEnum: CaseIterable {
|
||||
// Support synthesized by the compiler.
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
|
||||
struct SignalServiceProtos_Content {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
|
@ -296,8 +300,8 @@ struct SignalServiceProtos_CallMessage {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _id: UInt64? = nil
|
||||
fileprivate var _sessionDescription: String? = nil
|
||||
fileprivate var _id: UInt64?
|
||||
fileprivate var _sessionDescription: String?
|
||||
}
|
||||
|
||||
struct Answer {
|
||||
|
@ -331,8 +335,8 @@ struct SignalServiceProtos_CallMessage {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _id: UInt64? = nil
|
||||
fileprivate var _sessionDescription: String? = nil
|
||||
fileprivate var _id: UInt64?
|
||||
fileprivate var _sessionDescription: String?
|
||||
}
|
||||
|
||||
struct IceUpdate {
|
||||
|
@ -384,10 +388,10 @@ struct SignalServiceProtos_CallMessage {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _id: UInt64? = nil
|
||||
fileprivate var _sdpMid: String? = nil
|
||||
fileprivate var _sdpMlineIndex: UInt32? = nil
|
||||
fileprivate var _sdp: String? = nil
|
||||
fileprivate var _id: UInt64?
|
||||
fileprivate var _sdpMid: String?
|
||||
fileprivate var _sdpMlineIndex: UInt32?
|
||||
fileprivate var _sdp: String?
|
||||
}
|
||||
|
||||
struct Busy {
|
||||
|
@ -409,7 +413,7 @@ struct SignalServiceProtos_CallMessage {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _id: UInt64? = nil
|
||||
fileprivate var _id: UInt64?
|
||||
}
|
||||
|
||||
struct Hangup {
|
||||
|
@ -431,7 +435,7 @@ struct SignalServiceProtos_CallMessage {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _id: UInt64? = nil
|
||||
fileprivate var _id: UInt64?
|
||||
}
|
||||
|
||||
init() {}
|
||||
|
@ -659,9 +663,9 @@ struct SignalServiceProtos_DataMessage {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _id: UInt64? = nil
|
||||
fileprivate var _author: String? = nil
|
||||
fileprivate var _text: String? = nil
|
||||
fileprivate var _id: UInt64?
|
||||
fileprivate var _author: String?
|
||||
fileprivate var _text: String?
|
||||
}
|
||||
|
||||
struct Contact {
|
||||
|
@ -776,12 +780,12 @@ struct SignalServiceProtos_DataMessage {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _givenName: String? = nil
|
||||
fileprivate var _familyName: String? = nil
|
||||
fileprivate var _prefix: String? = nil
|
||||
fileprivate var _suffix: String? = nil
|
||||
fileprivate var _middleName: String? = nil
|
||||
fileprivate var _displayName: String? = nil
|
||||
fileprivate var _givenName: String?
|
||||
fileprivate var _familyName: String?
|
||||
fileprivate var _prefix: String?
|
||||
fileprivate var _suffix: String?
|
||||
fileprivate var _middleName: String?
|
||||
fileprivate var _displayName: String?
|
||||
}
|
||||
|
||||
struct Phone {
|
||||
|
@ -852,9 +856,9 @@ struct SignalServiceProtos_DataMessage {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _value: String? = nil
|
||||
fileprivate var _type: SignalServiceProtos_DataMessage.Contact.Phone.TypeEnum? = nil
|
||||
fileprivate var _label: String? = nil
|
||||
fileprivate var _value: String?
|
||||
fileprivate var _type: SignalServiceProtos_DataMessage.Contact.Phone.TypeEnum?
|
||||
fileprivate var _label: String?
|
||||
}
|
||||
|
||||
struct Email {
|
||||
|
@ -925,9 +929,9 @@ struct SignalServiceProtos_DataMessage {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _value: String? = nil
|
||||
fileprivate var _type: SignalServiceProtos_DataMessage.Contact.Email.TypeEnum? = nil
|
||||
fileprivate var _label: String? = nil
|
||||
fileprivate var _value: String?
|
||||
fileprivate var _type: SignalServiceProtos_DataMessage.Contact.Email.TypeEnum?
|
||||
fileprivate var _label: String?
|
||||
}
|
||||
|
||||
struct PostalAddress {
|
||||
|
@ -1049,15 +1053,15 @@ struct SignalServiceProtos_DataMessage {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _type: SignalServiceProtos_DataMessage.Contact.PostalAddress.TypeEnum? = nil
|
||||
fileprivate var _label: String? = nil
|
||||
fileprivate var _street: String? = nil
|
||||
fileprivate var _pobox: String? = nil
|
||||
fileprivate var _neighborhood: String? = nil
|
||||
fileprivate var _city: String? = nil
|
||||
fileprivate var _region: String? = nil
|
||||
fileprivate var _postcode: String? = nil
|
||||
fileprivate var _country: String? = nil
|
||||
fileprivate var _type: SignalServiceProtos_DataMessage.Contact.PostalAddress.TypeEnum?
|
||||
fileprivate var _label: String?
|
||||
fileprivate var _street: String?
|
||||
fileprivate var _pobox: String?
|
||||
fileprivate var _neighborhood: String?
|
||||
fileprivate var _city: String?
|
||||
fileprivate var _region: String?
|
||||
fileprivate var _postcode: String?
|
||||
fileprivate var _country: String?
|
||||
}
|
||||
|
||||
struct Avatar {
|
||||
|
@ -1100,6 +1104,14 @@ struct SignalServiceProtos_DataMessage {
|
|||
fileprivate var _storage = _StorageClass.defaultInstance
|
||||
}
|
||||
|
||||
#if swift(>=4.2)
|
||||
|
||||
extension SignalServiceProtos_DataMessage.Flags: CaseIterable {
|
||||
// Support synthesized by the compiler.
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
|
||||
struct SignalServiceProtos_NullMessage {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
|
@ -1118,7 +1130,7 @@ struct SignalServiceProtos_NullMessage {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _padding: Data? = nil
|
||||
fileprivate var _padding: Data?
|
||||
}
|
||||
|
||||
struct SignalServiceProtos_ReceiptMessage {
|
||||
|
@ -1168,9 +1180,17 @@ struct SignalServiceProtos_ReceiptMessage {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _type: SignalServiceProtos_ReceiptMessage.TypeEnum? = nil
|
||||
fileprivate var _type: SignalServiceProtos_ReceiptMessage.TypeEnum?
|
||||
}
|
||||
|
||||
#if swift(>=4.2)
|
||||
|
||||
extension SignalServiceProtos_ReceiptMessage.TypeEnum: CaseIterable {
|
||||
// Support synthesized by the compiler.
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
|
||||
struct SignalServiceProtos_Verified {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
|
@ -1246,12 +1266,20 @@ struct SignalServiceProtos_Verified {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _destination: String? = nil
|
||||
fileprivate var _identityKey: Data? = nil
|
||||
fileprivate var _state: SignalServiceProtos_Verified.State? = nil
|
||||
fileprivate var _nullMessage: Data? = nil
|
||||
fileprivate var _destination: String?
|
||||
fileprivate var _identityKey: Data?
|
||||
fileprivate var _state: SignalServiceProtos_Verified.State?
|
||||
fileprivate var _nullMessage: Data?
|
||||
}
|
||||
|
||||
#if swift(>=4.2)
|
||||
|
||||
extension SignalServiceProtos_Verified.State: CaseIterable {
|
||||
// Support synthesized by the compiler.
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
|
||||
struct SignalServiceProtos_SyncMessage {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
|
@ -1505,7 +1533,7 @@ struct SignalServiceProtos_SyncMessage {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _type: SignalServiceProtos_SyncMessage.Request.TypeEnum? = nil
|
||||
fileprivate var _type: SignalServiceProtos_SyncMessage.Request.TypeEnum?
|
||||
}
|
||||
|
||||
struct Read {
|
||||
|
@ -1537,8 +1565,8 @@ struct SignalServiceProtos_SyncMessage {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _sender: String? = nil
|
||||
fileprivate var _timestamp: UInt64? = nil
|
||||
fileprivate var _sender: String?
|
||||
fileprivate var _timestamp: UInt64?
|
||||
}
|
||||
|
||||
struct Configuration {
|
||||
|
@ -1559,7 +1587,7 @@ struct SignalServiceProtos_SyncMessage {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _readReceipts: Bool? = nil
|
||||
fileprivate var _readReceipts: Bool?
|
||||
}
|
||||
|
||||
init() {}
|
||||
|
@ -1690,18 +1718,26 @@ struct SignalServiceProtos_AttachmentPointer {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _id: UInt64? = nil
|
||||
fileprivate var _contentType: String? = nil
|
||||
fileprivate var _key: Data? = nil
|
||||
fileprivate var _size: UInt32? = nil
|
||||
fileprivate var _thumbnail: Data? = nil
|
||||
fileprivate var _digest: Data? = nil
|
||||
fileprivate var _fileName: String? = nil
|
||||
fileprivate var _flags: UInt32? = nil
|
||||
fileprivate var _width: UInt32? = nil
|
||||
fileprivate var _height: UInt32? = nil
|
||||
fileprivate var _id: UInt64?
|
||||
fileprivate var _contentType: String?
|
||||
fileprivate var _key: Data?
|
||||
fileprivate var _size: UInt32?
|
||||
fileprivate var _thumbnail: Data?
|
||||
fileprivate var _digest: Data?
|
||||
fileprivate var _fileName: String?
|
||||
fileprivate var _flags: UInt32?
|
||||
fileprivate var _width: UInt32?
|
||||
fileprivate var _height: UInt32?
|
||||
}
|
||||
|
||||
#if swift(>=4.2)
|
||||
|
||||
extension SignalServiceProtos_AttachmentPointer.Flags: CaseIterable {
|
||||
// Support synthesized by the compiler.
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
|
||||
struct SignalServiceProtos_GroupContext {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
|
@ -1792,6 +1828,14 @@ struct SignalServiceProtos_GroupContext {
|
|||
fileprivate var _storage = _StorageClass.defaultInstance
|
||||
}
|
||||
|
||||
#if swift(>=4.2)
|
||||
|
||||
extension SignalServiceProtos_GroupContext.TypeEnum: CaseIterable {
|
||||
// Support synthesized by the compiler.
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
|
||||
struct SignalServiceProtos_ContactDetails {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
|
@ -1899,8 +1943,8 @@ struct SignalServiceProtos_ContactDetails {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _contentType: String? = nil
|
||||
fileprivate var _length: UInt32? = nil
|
||||
fileprivate var _contentType: String?
|
||||
fileprivate var _length: UInt32?
|
||||
}
|
||||
|
||||
init() {}
|
||||
|
@ -2011,8 +2055,8 @@ struct SignalServiceProtos_GroupDetails {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _contentType: String? = nil
|
||||
fileprivate var _length: UInt32? = nil
|
||||
fileprivate var _contentType: String?
|
||||
fileprivate var _length: UInt32?
|
||||
}
|
||||
|
||||
init() {}
|
||||
|
@ -2022,7 +2066,7 @@ struct SignalServiceProtos_GroupDetails {
|
|||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "SignalServiceProtos"
|
||||
private let _protobuf_package = "SignalServiceProtos"
|
||||
|
||||
extension SignalServiceProtos_Envelope: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".Envelope"
|
||||
|
@ -2033,7 +2077,7 @@ extension SignalServiceProtos_Envelope: SwiftProtobuf.Message, SwiftProtobuf._Me
|
|||
3: .same(proto: "relay"),
|
||||
5: .same(proto: "timestamp"),
|
||||
6: .same(proto: "legacyMessage"),
|
||||
8: .same(proto: "content"),
|
||||
8: .same(proto: "content")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
@ -2095,7 +2139,7 @@ extension SignalServiceProtos_Envelope.TypeEnum: SwiftProtobuf._ProtoNameProvidi
|
|||
1: .same(proto: "CIPHERTEXT"),
|
||||
2: .same(proto: "KEY_EXCHANGE"),
|
||||
3: .same(proto: "PREKEY_BUNDLE"),
|
||||
5: .same(proto: "RECEIPT"),
|
||||
5: .same(proto: "RECEIPT")
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -2106,15 +2150,15 @@ extension SignalServiceProtos_Content: SwiftProtobuf.Message, SwiftProtobuf._Mes
|
|||
2: .same(proto: "syncMessage"),
|
||||
3: .same(proto: "callMessage"),
|
||||
4: .same(proto: "nullMessage"),
|
||||
5: .same(proto: "receiptMessage"),
|
||||
5: .same(proto: "receiptMessage")
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
var _dataMessage: SignalServiceProtos_DataMessage? = nil
|
||||
var _syncMessage: SignalServiceProtos_SyncMessage? = nil
|
||||
var _callMessage: SignalServiceProtos_CallMessage? = nil
|
||||
var _nullMessage: SignalServiceProtos_NullMessage? = nil
|
||||
var _receiptMessage: SignalServiceProtos_ReceiptMessage? = nil
|
||||
var _dataMessage: SignalServiceProtos_DataMessage?
|
||||
var _syncMessage: SignalServiceProtos_SyncMessage?
|
||||
var _callMessage: SignalServiceProtos_CallMessage?
|
||||
var _nullMessage: SignalServiceProtos_NullMessage?
|
||||
var _receiptMessage: SignalServiceProtos_ReceiptMessage?
|
||||
|
||||
static let defaultInstance = _StorageClass()
|
||||
|
||||
|
@ -2200,16 +2244,16 @@ extension SignalServiceProtos_CallMessage: SwiftProtobuf.Message, SwiftProtobuf.
|
|||
3: .same(proto: "iceUpdate"),
|
||||
4: .same(proto: "hangup"),
|
||||
5: .same(proto: "busy"),
|
||||
6: .same(proto: "profileKey"),
|
||||
6: .same(proto: "profileKey")
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
var _offer: SignalServiceProtos_CallMessage.Offer? = nil
|
||||
var _answer: SignalServiceProtos_CallMessage.Answer? = nil
|
||||
var _offer: SignalServiceProtos_CallMessage.Offer?
|
||||
var _answer: SignalServiceProtos_CallMessage.Answer?
|
||||
var _iceUpdate: [SignalServiceProtos_CallMessage.IceUpdate] = []
|
||||
var _hangup: SignalServiceProtos_CallMessage.Hangup? = nil
|
||||
var _busy: SignalServiceProtos_CallMessage.Busy? = nil
|
||||
var _profileKey: Data? = nil
|
||||
var _hangup: SignalServiceProtos_CallMessage.Hangup?
|
||||
var _busy: SignalServiceProtos_CallMessage.Busy?
|
||||
var _profileKey: Data?
|
||||
|
||||
static let defaultInstance = _StorageClass()
|
||||
|
||||
|
@ -2297,7 +2341,7 @@ extension SignalServiceProtos_CallMessage.Offer: SwiftProtobuf.Message, SwiftPro
|
|||
static let protoMessageName: String = SignalServiceProtos_CallMessage.protoMessageName + ".Offer"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "id"),
|
||||
2: .same(proto: "sessionDescription"),
|
||||
2: .same(proto: "sessionDescription")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
@ -2332,7 +2376,7 @@ extension SignalServiceProtos_CallMessage.Answer: SwiftProtobuf.Message, SwiftPr
|
|||
static let protoMessageName: String = SignalServiceProtos_CallMessage.protoMessageName + ".Answer"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "id"),
|
||||
2: .same(proto: "sessionDescription"),
|
||||
2: .same(proto: "sessionDescription")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
@ -2369,7 +2413,7 @@ extension SignalServiceProtos_CallMessage.IceUpdate: SwiftProtobuf.Message, Swif
|
|||
1: .same(proto: "id"),
|
||||
2: .same(proto: "sdpMid"),
|
||||
3: .same(proto: "sdpMLineIndex"),
|
||||
4: .same(proto: "sdp"),
|
||||
4: .same(proto: "sdp")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
@ -2413,7 +2457,7 @@ extension SignalServiceProtos_CallMessage.IceUpdate: SwiftProtobuf.Message, Swif
|
|||
extension SignalServiceProtos_CallMessage.Busy: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = SignalServiceProtos_CallMessage.protoMessageName + ".Busy"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "id"),
|
||||
1: .same(proto: "id")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
@ -2442,7 +2486,7 @@ extension SignalServiceProtos_CallMessage.Busy: SwiftProtobuf.Message, SwiftProt
|
|||
extension SignalServiceProtos_CallMessage.Hangup: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = SignalServiceProtos_CallMessage.protoMessageName + ".Hangup"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "id"),
|
||||
1: .same(proto: "id")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
@ -2479,18 +2523,18 @@ extension SignalServiceProtos_DataMessage: SwiftProtobuf.Message, SwiftProtobuf.
|
|||
6: .same(proto: "profileKey"),
|
||||
7: .same(proto: "timestamp"),
|
||||
8: .same(proto: "quote"),
|
||||
9: .same(proto: "contact"),
|
||||
9: .same(proto: "contact")
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
var _body: String? = nil
|
||||
var _body: String?
|
||||
var _attachments: [SignalServiceProtos_AttachmentPointer] = []
|
||||
var _group: SignalServiceProtos_GroupContext? = nil
|
||||
var _flags: UInt32? = nil
|
||||
var _expireTimer: UInt32? = nil
|
||||
var _profileKey: Data? = nil
|
||||
var _timestamp: UInt64? = nil
|
||||
var _quote: SignalServiceProtos_DataMessage.Quote? = nil
|
||||
var _group: SignalServiceProtos_GroupContext?
|
||||
var _flags: UInt32?
|
||||
var _expireTimer: UInt32?
|
||||
var _profileKey: Data?
|
||||
var _timestamp: UInt64?
|
||||
var _quote: SignalServiceProtos_DataMessage.Quote?
|
||||
var _contact: [SignalServiceProtos_DataMessage.Contact] = []
|
||||
|
||||
static let defaultInstance = _StorageClass()
|
||||
|
@ -2597,7 +2641,7 @@ extension SignalServiceProtos_DataMessage.Flags: SwiftProtobuf._ProtoNameProvidi
|
|||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "END_SESSION"),
|
||||
2: .same(proto: "EXPIRATION_TIMER_UPDATE"),
|
||||
4: .same(proto: "PROFILE_KEY_UPDATE"),
|
||||
4: .same(proto: "PROFILE_KEY_UPDATE")
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -2607,7 +2651,7 @@ extension SignalServiceProtos_DataMessage.Quote: SwiftProtobuf.Message, SwiftPro
|
|||
1: .same(proto: "id"),
|
||||
2: .same(proto: "author"),
|
||||
3: .same(proto: "text"),
|
||||
4: .same(proto: "attachments"),
|
||||
4: .same(proto: "attachments")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
@ -2654,14 +2698,14 @@ extension SignalServiceProtos_DataMessage.Quote.QuotedAttachment: SwiftProtobuf.
|
|||
1: .same(proto: "contentType"),
|
||||
2: .same(proto: "fileName"),
|
||||
3: .same(proto: "thumbnail"),
|
||||
4: .same(proto: "flags"),
|
||||
4: .same(proto: "flags")
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
var _contentType: String? = nil
|
||||
var _fileName: String? = nil
|
||||
var _thumbnail: SignalServiceProtos_AttachmentPointer? = nil
|
||||
var _flags: UInt32? = nil
|
||||
var _contentType: String?
|
||||
var _fileName: String?
|
||||
var _thumbnail: SignalServiceProtos_AttachmentPointer?
|
||||
var _flags: UInt32?
|
||||
|
||||
static let defaultInstance = _StorageClass()
|
||||
|
||||
|
@ -2735,7 +2779,7 @@ extension SignalServiceProtos_DataMessage.Quote.QuotedAttachment: SwiftProtobuf.
|
|||
|
||||
extension SignalServiceProtos_DataMessage.Quote.QuotedAttachment.Flags: SwiftProtobuf._ProtoNameProviding {
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "VOICE_MESSAGE"),
|
||||
1: .same(proto: "VOICE_MESSAGE")
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -2747,16 +2791,16 @@ extension SignalServiceProtos_DataMessage.Contact: SwiftProtobuf.Message, SwiftP
|
|||
4: .same(proto: "email"),
|
||||
5: .same(proto: "address"),
|
||||
6: .same(proto: "avatar"),
|
||||
7: .same(proto: "organization"),
|
||||
7: .same(proto: "organization")
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
var _name: SignalServiceProtos_DataMessage.Contact.Name? = nil
|
||||
var _name: SignalServiceProtos_DataMessage.Contact.Name?
|
||||
var _number: [SignalServiceProtos_DataMessage.Contact.Phone] = []
|
||||
var _email: [SignalServiceProtos_DataMessage.Contact.Email] = []
|
||||
var _address: [SignalServiceProtos_DataMessage.Contact.PostalAddress] = []
|
||||
var _avatar: SignalServiceProtos_DataMessage.Contact.Avatar? = nil
|
||||
var _organization: String? = nil
|
||||
var _avatar: SignalServiceProtos_DataMessage.Contact.Avatar?
|
||||
var _organization: String?
|
||||
|
||||
static let defaultInstance = _StorageClass()
|
||||
|
||||
|
@ -2848,7 +2892,7 @@ extension SignalServiceProtos_DataMessage.Contact.Name: SwiftProtobuf.Message, S
|
|||
3: .same(proto: "prefix"),
|
||||
4: .same(proto: "suffix"),
|
||||
5: .same(proto: "middleName"),
|
||||
6: .same(proto: "displayName"),
|
||||
6: .same(proto: "displayName")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
@ -2904,7 +2948,7 @@ extension SignalServiceProtos_DataMessage.Contact.Phone: SwiftProtobuf.Message,
|
|||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "value"),
|
||||
2: .same(proto: "type"),
|
||||
3: .same(proto: "label"),
|
||||
3: .same(proto: "label")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
@ -2945,7 +2989,7 @@ extension SignalServiceProtos_DataMessage.Contact.Phone.TypeEnum: SwiftProtobuf.
|
|||
1: .same(proto: "HOME"),
|
||||
2: .same(proto: "MOBILE"),
|
||||
3: .same(proto: "WORK"),
|
||||
4: .same(proto: "CUSTOM"),
|
||||
4: .same(proto: "CUSTOM")
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -2954,7 +2998,7 @@ extension SignalServiceProtos_DataMessage.Contact.Email: SwiftProtobuf.Message,
|
|||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "value"),
|
||||
2: .same(proto: "type"),
|
||||
3: .same(proto: "label"),
|
||||
3: .same(proto: "label")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
@ -2995,7 +3039,7 @@ extension SignalServiceProtos_DataMessage.Contact.Email.TypeEnum: SwiftProtobuf.
|
|||
1: .same(proto: "HOME"),
|
||||
2: .same(proto: "MOBILE"),
|
||||
3: .same(proto: "WORK"),
|
||||
4: .same(proto: "CUSTOM"),
|
||||
4: .same(proto: "CUSTOM")
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -3010,7 +3054,7 @@ extension SignalServiceProtos_DataMessage.Contact.PostalAddress: SwiftProtobuf.M
|
|||
6: .same(proto: "city"),
|
||||
7: .same(proto: "region"),
|
||||
8: .same(proto: "postcode"),
|
||||
9: .same(proto: "country"),
|
||||
9: .same(proto: "country")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
@ -3080,7 +3124,7 @@ extension SignalServiceProtos_DataMessage.Contact.PostalAddress.TypeEnum: SwiftP
|
|||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "HOME"),
|
||||
2: .same(proto: "WORK"),
|
||||
3: .same(proto: "CUSTOM"),
|
||||
3: .same(proto: "CUSTOM")
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -3088,12 +3132,12 @@ extension SignalServiceProtos_DataMessage.Contact.Avatar: SwiftProtobuf.Message,
|
|||
static let protoMessageName: String = SignalServiceProtos_DataMessage.Contact.protoMessageName + ".Avatar"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "avatar"),
|
||||
2: .same(proto: "isProfile"),
|
||||
2: .same(proto: "isProfile")
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
var _avatar: SignalServiceProtos_AttachmentPointer? = nil
|
||||
var _isProfile: Bool? = nil
|
||||
var _avatar: SignalServiceProtos_AttachmentPointer?
|
||||
var _isProfile: Bool?
|
||||
|
||||
static let defaultInstance = _StorageClass()
|
||||
|
||||
|
@ -3156,7 +3200,7 @@ extension SignalServiceProtos_DataMessage.Contact.Avatar: SwiftProtobuf.Message,
|
|||
extension SignalServiceProtos_NullMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".NullMessage"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "padding"),
|
||||
1: .same(proto: "padding")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
@ -3186,7 +3230,7 @@ extension SignalServiceProtos_ReceiptMessage: SwiftProtobuf.Message, SwiftProtob
|
|||
static let protoMessageName: String = _protobuf_package + ".ReceiptMessage"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "type"),
|
||||
2: .same(proto: "timestamp"),
|
||||
2: .same(proto: "timestamp")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
@ -3220,7 +3264,7 @@ extension SignalServiceProtos_ReceiptMessage: SwiftProtobuf.Message, SwiftProtob
|
|||
extension SignalServiceProtos_ReceiptMessage.TypeEnum: SwiftProtobuf._ProtoNameProviding {
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
0: .same(proto: "DELIVERY"),
|
||||
1: .same(proto: "READ"),
|
||||
1: .same(proto: "READ")
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -3230,7 +3274,7 @@ extension SignalServiceProtos_Verified: SwiftProtobuf.Message, SwiftProtobuf._Me
|
|||
1: .same(proto: "destination"),
|
||||
2: .same(proto: "identityKey"),
|
||||
3: .same(proto: "state"),
|
||||
4: .same(proto: "nullMessage"),
|
||||
4: .same(proto: "nullMessage")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
@ -3275,7 +3319,7 @@ extension SignalServiceProtos_Verified.State: SwiftProtobuf._ProtoNameProviding
|
|||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
0: .same(proto: "DEFAULT"),
|
||||
1: .same(proto: "VERIFIED"),
|
||||
2: .same(proto: "UNVERIFIED"),
|
||||
2: .same(proto: "UNVERIFIED")
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -3290,19 +3334,19 @@ extension SignalServiceProtos_SyncMessage: SwiftProtobuf.Message, SwiftProtobuf.
|
|||
6: .same(proto: "blocked"),
|
||||
7: .same(proto: "verified"),
|
||||
9: .same(proto: "configuration"),
|
||||
8: .same(proto: "padding"),
|
||||
8: .same(proto: "padding")
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
var _sent: SignalServiceProtos_SyncMessage.Sent? = nil
|
||||
var _contacts: SignalServiceProtos_SyncMessage.Contacts? = nil
|
||||
var _groups: SignalServiceProtos_SyncMessage.Groups? = nil
|
||||
var _request: SignalServiceProtos_SyncMessage.Request? = nil
|
||||
var _sent: SignalServiceProtos_SyncMessage.Sent?
|
||||
var _contacts: SignalServiceProtos_SyncMessage.Contacts?
|
||||
var _groups: SignalServiceProtos_SyncMessage.Groups?
|
||||
var _request: SignalServiceProtos_SyncMessage.Request?
|
||||
var _read: [SignalServiceProtos_SyncMessage.Read] = []
|
||||
var _blocked: SignalServiceProtos_SyncMessage.Blocked? = nil
|
||||
var _verified: SignalServiceProtos_Verified? = nil
|
||||
var _configuration: SignalServiceProtos_SyncMessage.Configuration? = nil
|
||||
var _padding: Data? = nil
|
||||
var _blocked: SignalServiceProtos_SyncMessage.Blocked?
|
||||
var _verified: SignalServiceProtos_Verified?
|
||||
var _configuration: SignalServiceProtos_SyncMessage.Configuration?
|
||||
var _padding: Data?
|
||||
|
||||
static let defaultInstance = _StorageClass()
|
||||
|
||||
|
@ -3410,14 +3454,14 @@ extension SignalServiceProtos_SyncMessage.Sent: SwiftProtobuf.Message, SwiftProt
|
|||
1: .same(proto: "destination"),
|
||||
2: .same(proto: "timestamp"),
|
||||
3: .same(proto: "message"),
|
||||
4: .same(proto: "expirationStartTimestamp"),
|
||||
4: .same(proto: "expirationStartTimestamp")
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
var _destination: String? = nil
|
||||
var _timestamp: UInt64? = nil
|
||||
var _message: SignalServiceProtos_DataMessage? = nil
|
||||
var _expirationStartTimestamp: UInt64? = nil
|
||||
var _destination: String?
|
||||
var _timestamp: UInt64?
|
||||
var _message: SignalServiceProtos_DataMessage?
|
||||
var _expirationStartTimestamp: UInt64?
|
||||
|
||||
static let defaultInstance = _StorageClass()
|
||||
|
||||
|
@ -3493,12 +3537,12 @@ extension SignalServiceProtos_SyncMessage.Contacts: SwiftProtobuf.Message, Swift
|
|||
static let protoMessageName: String = SignalServiceProtos_SyncMessage.protoMessageName + ".Contacts"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "blob"),
|
||||
2: .same(proto: "isComplete"),
|
||||
2: .same(proto: "isComplete")
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
var _blob: SignalServiceProtos_AttachmentPointer? = nil
|
||||
var _isComplete: Bool? = nil
|
||||
var _blob: SignalServiceProtos_AttachmentPointer?
|
||||
var _isComplete: Bool?
|
||||
|
||||
static let defaultInstance = _StorageClass()
|
||||
|
||||
|
@ -3561,11 +3605,11 @@ extension SignalServiceProtos_SyncMessage.Contacts: SwiftProtobuf.Message, Swift
|
|||
extension SignalServiceProtos_SyncMessage.Groups: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = SignalServiceProtos_SyncMessage.protoMessageName + ".Groups"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "blob"),
|
||||
1: .same(proto: "blob")
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
var _blob: SignalServiceProtos_AttachmentPointer? = nil
|
||||
var _blob: SignalServiceProtos_AttachmentPointer?
|
||||
|
||||
static let defaultInstance = _StorageClass()
|
||||
|
||||
|
@ -3623,7 +3667,7 @@ extension SignalServiceProtos_SyncMessage.Blocked: SwiftProtobuf.Message, SwiftP
|
|||
static let protoMessageName: String = SignalServiceProtos_SyncMessage.protoMessageName + ".Blocked"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "numbers"),
|
||||
2: .same(proto: "groupIds"),
|
||||
2: .same(proto: "groupIds")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
@ -3657,7 +3701,7 @@ extension SignalServiceProtos_SyncMessage.Blocked: SwiftProtobuf.Message, SwiftP
|
|||
extension SignalServiceProtos_SyncMessage.Request: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = SignalServiceProtos_SyncMessage.protoMessageName + ".Request"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "type"),
|
||||
1: .same(proto: "type")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
@ -3689,7 +3733,7 @@ extension SignalServiceProtos_SyncMessage.Request.TypeEnum: SwiftProtobuf._Proto
|
|||
1: .same(proto: "CONTACTS"),
|
||||
2: .same(proto: "GROUPS"),
|
||||
3: .same(proto: "BLOCKED"),
|
||||
4: .same(proto: "CONFIGURATION"),
|
||||
4: .same(proto: "CONFIGURATION")
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -3697,7 +3741,7 @@ extension SignalServiceProtos_SyncMessage.Read: SwiftProtobuf.Message, SwiftProt
|
|||
static let protoMessageName: String = SignalServiceProtos_SyncMessage.protoMessageName + ".Read"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "sender"),
|
||||
2: .same(proto: "timestamp"),
|
||||
2: .same(proto: "timestamp")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
@ -3731,7 +3775,7 @@ extension SignalServiceProtos_SyncMessage.Read: SwiftProtobuf.Message, SwiftProt
|
|||
extension SignalServiceProtos_SyncMessage.Configuration: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = SignalServiceProtos_SyncMessage.protoMessageName + ".Configuration"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "readReceipts"),
|
||||
1: .same(proto: "readReceipts")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
@ -3769,7 +3813,7 @@ extension SignalServiceProtos_AttachmentPointer: SwiftProtobuf.Message, SwiftPro
|
|||
7: .same(proto: "fileName"),
|
||||
8: .same(proto: "flags"),
|
||||
9: .same(proto: "width"),
|
||||
10: .same(proto: "height"),
|
||||
10: .same(proto: "height")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
@ -3842,7 +3886,7 @@ extension SignalServiceProtos_AttachmentPointer: SwiftProtobuf.Message, SwiftPro
|
|||
|
||||
extension SignalServiceProtos_AttachmentPointer.Flags: SwiftProtobuf._ProtoNameProviding {
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "VOICE_MESSAGE"),
|
||||
1: .same(proto: "VOICE_MESSAGE")
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -3853,15 +3897,15 @@ extension SignalServiceProtos_GroupContext: SwiftProtobuf.Message, SwiftProtobuf
|
|||
2: .same(proto: "type"),
|
||||
3: .same(proto: "name"),
|
||||
4: .same(proto: "members"),
|
||||
5: .same(proto: "avatar"),
|
||||
5: .same(proto: "avatar")
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
var _id: Data? = nil
|
||||
var _type: SignalServiceProtos_GroupContext.TypeEnum? = nil
|
||||
var _name: String? = nil
|
||||
var _id: Data?
|
||||
var _type: SignalServiceProtos_GroupContext.TypeEnum?
|
||||
var _name: String?
|
||||
var _members: [String] = []
|
||||
var _avatar: SignalServiceProtos_AttachmentPointer? = nil
|
||||
var _avatar: SignalServiceProtos_AttachmentPointer?
|
||||
|
||||
static let defaultInstance = _StorageClass()
|
||||
|
||||
|
@ -3945,7 +3989,7 @@ extension SignalServiceProtos_GroupContext.TypeEnum: SwiftProtobuf._ProtoNamePro
|
|||
1: .same(proto: "UPDATE"),
|
||||
2: .same(proto: "DELIVER"),
|
||||
3: .same(proto: "QUIT"),
|
||||
4: .same(proto: "REQUEST_INFO"),
|
||||
4: .same(proto: "REQUEST_INFO")
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -3959,18 +4003,18 @@ extension SignalServiceProtos_ContactDetails: SwiftProtobuf.Message, SwiftProtob
|
|||
5: .same(proto: "verified"),
|
||||
6: .same(proto: "profileKey"),
|
||||
7: .same(proto: "blocked"),
|
||||
8: .same(proto: "expireTimer"),
|
||||
8: .same(proto: "expireTimer")
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
var _number: String? = nil
|
||||
var _name: String? = nil
|
||||
var _avatar: SignalServiceProtos_ContactDetails.Avatar? = nil
|
||||
var _color: String? = nil
|
||||
var _verified: SignalServiceProtos_Verified? = nil
|
||||
var _profileKey: Data? = nil
|
||||
var _blocked: Bool? = nil
|
||||
var _expireTimer: UInt32? = nil
|
||||
var _number: String?
|
||||
var _name: String?
|
||||
var _avatar: SignalServiceProtos_ContactDetails.Avatar?
|
||||
var _color: String?
|
||||
var _verified: SignalServiceProtos_Verified?
|
||||
var _profileKey: Data?
|
||||
var _blocked: Bool?
|
||||
var _expireTimer: UInt32?
|
||||
|
||||
static let defaultInstance = _StorageClass()
|
||||
|
||||
|
@ -4070,7 +4114,7 @@ extension SignalServiceProtos_ContactDetails.Avatar: SwiftProtobuf.Message, Swif
|
|||
static let protoMessageName: String = SignalServiceProtos_ContactDetails.protoMessageName + ".Avatar"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "contentType"),
|
||||
2: .same(proto: "length"),
|
||||
2: .same(proto: "length")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
@ -4111,18 +4155,18 @@ extension SignalServiceProtos_GroupDetails: SwiftProtobuf.Message, SwiftProtobuf
|
|||
5: .same(proto: "active"),
|
||||
6: .same(proto: "expireTimer"),
|
||||
7: .same(proto: "color"),
|
||||
8: .same(proto: "blocked"),
|
||||
8: .same(proto: "blocked")
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
var _id: Data? = nil
|
||||
var _name: String? = nil
|
||||
var _id: Data?
|
||||
var _name: String?
|
||||
var _members: [String] = []
|
||||
var _avatar: SignalServiceProtos_GroupDetails.Avatar? = nil
|
||||
var _active: Bool? = nil
|
||||
var _expireTimer: UInt32? = nil
|
||||
var _color: String? = nil
|
||||
var _blocked: Bool? = nil
|
||||
var _avatar: SignalServiceProtos_GroupDetails.Avatar?
|
||||
var _active: Bool?
|
||||
var _expireTimer: UInt32?
|
||||
var _color: String?
|
||||
var _blocked: Bool?
|
||||
|
||||
static let defaultInstance = _StorageClass()
|
||||
|
||||
|
@ -4222,7 +4266,7 @@ extension SignalServiceProtos_GroupDetails.Avatar: SwiftProtobuf.Message, SwiftP
|
|||
static let protoMessageName: String = SignalServiceProtos_GroupDetails.protoMessageName + ".Avatar"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "contentType"),
|
||||
2: .same(proto: "length"),
|
||||
2: .same(proto: "length")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
|
|
@ -16,6 +16,10 @@ public enum WebSocketProtoError: Error {
|
|||
|
||||
// MARK: - WebSocketProtoWebSocketRequestMessageBuilder
|
||||
|
||||
@objc public class func builder() -> WebSocketProtoWebSocketRequestMessageBuilder {
|
||||
return WebSocketProtoWebSocketRequestMessageBuilder()
|
||||
}
|
||||
|
||||
@objc public class WebSocketProtoWebSocketRequestMessageBuilder: NSObject {
|
||||
|
||||
private var proto = WebSocketProtos_WebSocketRequestMessage()
|
||||
|
@ -158,6 +162,10 @@ extension WebSocketProtoWebSocketRequestMessage.WebSocketProtoWebSocketRequestMe
|
|||
|
||||
// MARK: - WebSocketProtoWebSocketResponseMessageBuilder
|
||||
|
||||
@objc public class func builder() -> WebSocketProtoWebSocketResponseMessageBuilder {
|
||||
return WebSocketProtoWebSocketResponseMessageBuilder()
|
||||
}
|
||||
|
||||
@objc public class WebSocketProtoWebSocketResponseMessageBuilder: NSObject {
|
||||
|
||||
private var proto = WebSocketProtos_WebSocketResponseMessage()
|
||||
|
@ -323,6 +331,10 @@ extension WebSocketProtoWebSocketResponseMessage.WebSocketProtoWebSocketResponse
|
|||
|
||||
// MARK: - WebSocketProtoWebSocketMessageBuilder
|
||||
|
||||
@objc public class func builder() -> WebSocketProtoWebSocketMessageBuilder {
|
||||
return WebSocketProtoWebSocketMessageBuilder()
|
||||
}
|
||||
|
||||
@objc public class WebSocketProtoWebSocketMessageBuilder: NSObject {
|
||||
|
||||
private var proto = WebSocketProtos_WebSocketMessage()
|
||||
|
@ -391,12 +403,12 @@ extension WebSocketProtoWebSocketResponseMessage.WebSocketProtoWebSocketResponse
|
|||
}
|
||||
let type = WebSocketProtoWebSocketMessageTypeWrap(proto.type)
|
||||
|
||||
var request: WebSocketProtoWebSocketRequestMessage? = nil
|
||||
var request: WebSocketProtoWebSocketRequestMessage?
|
||||
if proto.hasRequest {
|
||||
request = try WebSocketProtoWebSocketRequestMessage.parseProto(proto.request)
|
||||
}
|
||||
|
||||
var response: WebSocketProtoWebSocketResponseMessage? = nil
|
||||
var response: WebSocketProtoWebSocketResponseMessage?
|
||||
if proto.hasResponse {
|
||||
response = try WebSocketProtoWebSocketResponseMessage.parseProto(proto.response)
|
||||
}
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
// DO NOT EDIT.
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: WebSocketResources.proto
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
// For information on using the generated types, please see the documenation:
|
||||
// https://github.com/apple/swift-protobuf/
|
||||
|
||||
//*
|
||||
// Copyright (C) 2014-2016 Open Whisper Systems
|
||||
|
@ -22,7 +18,7 @@ import SwiftProtobuf
|
|||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that your are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
@ -77,10 +73,10 @@ struct WebSocketProtos_WebSocketRequestMessage {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _verb: String? = nil
|
||||
fileprivate var _path: String? = nil
|
||||
fileprivate var _body: Data? = nil
|
||||
fileprivate var _requestID: UInt64? = nil
|
||||
fileprivate var _verb: String?
|
||||
fileprivate var _path: String?
|
||||
fileprivate var _body: Data?
|
||||
fileprivate var _requestID: UInt64?
|
||||
}
|
||||
|
||||
struct WebSocketProtos_WebSocketResponseMessage {
|
||||
|
@ -132,10 +128,10 @@ struct WebSocketProtos_WebSocketResponseMessage {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _requestID: UInt64? = nil
|
||||
fileprivate var _status: UInt32? = nil
|
||||
fileprivate var _message: String? = nil
|
||||
fileprivate var _body: Data? = nil
|
||||
fileprivate var _requestID: UInt64?
|
||||
fileprivate var _status: UInt32?
|
||||
fileprivate var _message: String?
|
||||
fileprivate var _body: Data?
|
||||
}
|
||||
|
||||
struct WebSocketProtos_WebSocketMessage {
|
||||
|
@ -207,9 +203,17 @@ struct WebSocketProtos_WebSocketMessage {
|
|||
fileprivate var _storage = _StorageClass.defaultInstance
|
||||
}
|
||||
|
||||
#if swift(>=4.2)
|
||||
|
||||
extension WebSocketProtos_WebSocketMessage.TypeEnum: CaseIterable {
|
||||
// Support synthesized by the compiler.
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "WebSocketProtos"
|
||||
private let _protobuf_package = "WebSocketProtos"
|
||||
|
||||
extension WebSocketProtos_WebSocketRequestMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".WebSocketRequestMessage"
|
||||
|
@ -218,7 +222,7 @@ extension WebSocketProtos_WebSocketRequestMessage: SwiftProtobuf.Message, SwiftP
|
|||
2: .same(proto: "path"),
|
||||
3: .same(proto: "body"),
|
||||
5: .same(proto: "headers"),
|
||||
4: .same(proto: "requestId"),
|
||||
4: .same(proto: "requestId")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
@ -271,7 +275,7 @@ extension WebSocketProtos_WebSocketResponseMessage: SwiftProtobuf.Message, Swift
|
|||
2: .same(proto: "status"),
|
||||
3: .same(proto: "message"),
|
||||
5: .same(proto: "headers"),
|
||||
4: .same(proto: "body"),
|
||||
4: .same(proto: "body")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
@ -322,13 +326,13 @@ extension WebSocketProtos_WebSocketMessage: SwiftProtobuf.Message, SwiftProtobuf
|
|||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "type"),
|
||||
2: .same(proto: "request"),
|
||||
3: .same(proto: "response"),
|
||||
3: .same(proto: "response")
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
var _type: WebSocketProtos_WebSocketMessage.TypeEnum? = nil
|
||||
var _request: WebSocketProtos_WebSocketRequestMessage? = nil
|
||||
var _response: WebSocketProtos_WebSocketResponseMessage? = nil
|
||||
var _type: WebSocketProtos_WebSocketMessage.TypeEnum?
|
||||
var _request: WebSocketProtos_WebSocketRequestMessage?
|
||||
var _response: WebSocketProtos_WebSocketResponseMessage?
|
||||
|
||||
static let defaultInstance = _StorageClass()
|
||||
|
||||
|
@ -398,6 +402,6 @@ extension WebSocketProtos_WebSocketMessage.TypeEnum: SwiftProtobuf._ProtoNamePro
|
|||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
0: .same(proto: "UNKNOWN"),
|
||||
1: .same(proto: "REQUEST"),
|
||||
2: .same(proto: "RESPONSE"),
|
||||
2: .same(proto: "RESPONSE")
|
||||
]
|
||||
}
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
//
|
||||
|
||||
#import "OWSRecipientIdentity.h"
|
||||
#import "Cryptography.h"
|
||||
#import "OWSIdentityManager.h"
|
||||
#import "OWSPrimaryStorage+SessionStore.h"
|
||||
#import "OWSPrimaryStorage.h"
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
#import <SignalServiceKit/SignalServiceKit-Swift.h>
|
||||
#import <YapDatabase/YapDatabase.h>
|
||||
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
//
|
||||
|
||||
#import "OWSPrimaryStorage+PreKeyStore.h"
|
||||
#import "Cryptography.h"
|
||||
#import "OWSPrimaryStorage+keyFromIntLong.h"
|
||||
#import "TSStorageKeys.h"
|
||||
#import "YapDatabaseConnection+OWS.h"
|
||||
#import <AxolotlKit/AxolotlExceptions.h>
|
||||
#import <AxolotlKit/SessionBuilder.h>
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
|
||||
#define OWSPrimaryStoragePreKeyStoreCollection @"TSStorageManagerPreKeyStoreCollection"
|
||||
#define TSNextPrekeyIdKey @"TSStorageInternalSettingsNextPreKeyId"
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
//
|
||||
|
||||
#import "OWSFakeProfileManager.h"
|
||||
#import "Cryptography.h"
|
||||
#import "TSThread.h"
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
|
|
@ -1,104 +0,0 @@
|
|||
//
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
extern const NSUInteger kAES256_KeyByteLength;
|
||||
|
||||
/// Key appropriate for use in AES256-GCM
|
||||
@interface OWSAES256Key : NSObject <NSSecureCoding>
|
||||
|
||||
/// Generates new secure random key
|
||||
- (instancetype)init;
|
||||
+ (instancetype)generateRandomKey;
|
||||
|
||||
/**
|
||||
* @param data representing the raw key bytes
|
||||
*
|
||||
* @returns a new instance if key is of appropriate length for AES256-GCM
|
||||
* else returns nil.
|
||||
*/
|
||||
+ (nullable instancetype)keyWithData:(NSData *)data;
|
||||
|
||||
/// The raw key material
|
||||
@property (nonatomic, readonly) NSData *keyData;
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@interface AES25GCMEncryptionResult : NSObject
|
||||
|
||||
@property (nonatomic, readonly) NSData *ciphertext;
|
||||
@property (nonatomic, readonly) NSData *initializationVector;
|
||||
@property (nonatomic, readonly) NSData *authTag;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
- (nullable instancetype)initWithCipherText:(NSData *)cipherText
|
||||
initializationVector:(NSData *)initializationVector
|
||||
authTag:(NSData *)authTag NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@interface Cryptography : NSObject
|
||||
|
||||
typedef NS_ENUM(NSInteger, TSMACType) {
|
||||
TSHMACSHA256Truncated10Bytes = 2,
|
||||
TSHMACSHA256AttachementType = 3
|
||||
};
|
||||
|
||||
+ (NSData *)generateRandomBytes:(NSUInteger)numberBytes;
|
||||
|
||||
+ (uint32_t)randomUInt32;
|
||||
+ (uint64_t)randomUInt64;
|
||||
+ (unsigned)randomUnsigned;
|
||||
|
||||
#pragma mark - SHA and HMAC methods
|
||||
|
||||
// Full length SHA256 digest for `data`
|
||||
+ (nullable NSData *)computeSHA256Digest:(NSData *)data;
|
||||
|
||||
// Truncated SHA256 digest for `data`
|
||||
+ (nullable NSData *)computeSHA256Digest:(NSData *)data truncatedToBytes:(NSUInteger)truncatedBytes;
|
||||
|
||||
+ (nullable NSString *)truncatedSHA1Base64EncodedWithoutPadding:(NSString *)string;
|
||||
|
||||
+ (nullable NSData *)decryptAppleMessagePayload:(NSData *)payload withSignalingKey:(NSString *)signalingKeyString;
|
||||
|
||||
+ (nullable NSData *)computeSHA256HMAC:(NSData *)data withHMACKey:(NSData *)HMACKey;
|
||||
|
||||
#pragma mark encrypt and decrypt attachment data
|
||||
|
||||
// Though digest can and will be nil for legacy clients, we now reject attachments lacking a digest.
|
||||
+ (nullable NSData *)decryptAttachment:(NSData *)dataToDecrypt
|
||||
withKey:(NSData *)key
|
||||
digest:(nullable NSData *)digest
|
||||
unpaddedSize:(UInt32)unpaddedSize
|
||||
error:(NSError **)error;
|
||||
|
||||
+ (nullable NSData *)encryptAttachmentData:(NSData *)attachmentData
|
||||
outKey:(NSData *_Nonnull *_Nullable)outKey
|
||||
outDigest:(NSData *_Nonnull *_Nullable)outDigest;
|
||||
|
||||
+ (nullable AES25GCMEncryptionResult *)encryptAESGCMWithData:(NSData *)plaintext
|
||||
additionalAuthenticatedData:(nullable NSData *)additionalAuthenticatedData
|
||||
key:(OWSAES256Key *)key
|
||||
NS_SWIFT_NAME(encryptAESGCM(plainTextData:additionalAuthenticatedData:key:));
|
||||
|
||||
+ (nullable NSData *)decryptAESGCMWithInitializationVector:(NSData *)initializationVector
|
||||
ciphertext:(NSData *)ciphertext
|
||||
additionalAuthenticatedData:(nullable NSData *)additionalAuthenticatedData
|
||||
authTag:(NSData *)authTagFromEncrypt
|
||||
key:(OWSAES256Key *)key;
|
||||
|
||||
+ (nullable NSData *)encryptAESGCMWithProfileData:(NSData *)plaintextData key:(OWSAES256Key *)key;
|
||||
+ (nullable NSData *)decryptAESGCMWithProfileData:(NSData *)encryptedData key:(OWSAES256Key *)key;
|
||||
|
||||
+ (void)seedRandom;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -1,840 +0,0 @@
|
|||
//
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Cryptography.h"
|
||||
#import "OWSError.h"
|
||||
#import <CommonCrypto/CommonCryptor.h>
|
||||
#import <CommonCrypto/CommonHMAC.h>
|
||||
#import <SignalCoreKit/NSData+OWS.h>
|
||||
#import <SignalCoreKit/Randomness.h>
|
||||
#import <openssl/evp.h>
|
||||
|
||||
#define HMAC256_KEY_LENGTH 32
|
||||
#define HMAC256_OUTPUT_LENGTH 32
|
||||
#define AES_CBC_IV_LENGTH 16
|
||||
#define AES_KEY_SIZE 32
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
// Returned by many OpenSSL functions - indicating success
|
||||
const int kOpenSSLSuccess = 1;
|
||||
|
||||
// length of initialization nonce for AES256-GCM
|
||||
static const NSUInteger kAESGCM256_IVLength = 12;
|
||||
|
||||
// length of authentication tag for AES256-GCM
|
||||
static const NSUInteger kAESGCM256_TagLength = 16;
|
||||
|
||||
// length of key used for websocket envelope authentication
|
||||
static const NSUInteger kHMAC256_EnvelopeKeyLength = 20;
|
||||
|
||||
const NSUInteger kAES256_KeyByteLength = 32;
|
||||
|
||||
@implementation OWSAES256Key
|
||||
|
||||
+ (nullable instancetype)keyWithData:(NSData *)data
|
||||
{
|
||||
if (data.length != kAES256_KeyByteLength) {
|
||||
OWSFailDebug(@"Invalid key length: %lu", (unsigned long)data.length);
|
||||
return nil;
|
||||
}
|
||||
|
||||
return [[self alloc] initWithData:data];
|
||||
}
|
||||
|
||||
+ (instancetype)generateRandomKey
|
||||
{
|
||||
return [self new];
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
return [self initWithData:[Cryptography generateRandomBytes:kAES256_KeyByteLength]];
|
||||
}
|
||||
|
||||
- (instancetype)initWithData:(NSData *)data
|
||||
{
|
||||
self = [super init];
|
||||
if (!self) {
|
||||
return self;
|
||||
}
|
||||
|
||||
_keyData = data;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - SecureCoding
|
||||
|
||||
+ (BOOL)supportsSecureCoding
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder
|
||||
{
|
||||
self = [super init];
|
||||
if (!self) {
|
||||
return self;
|
||||
}
|
||||
|
||||
NSData *keyData = [aDecoder decodeObjectOfClass:[NSData class] forKey:@"keyData"];
|
||||
if (keyData.length != kAES256_KeyByteLength) {
|
||||
OWSFailDebug(@"Invalid key length: %lu", (unsigned long)keyData.length);
|
||||
return nil;
|
||||
}
|
||||
|
||||
_keyData = keyData;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(NSCoder *)aCoder
|
||||
{
|
||||
[aCoder encodeObject:_keyData forKey:@"keyData"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@implementation AES25GCMEncryptionResult
|
||||
|
||||
- (nullable instancetype)initWithCipherText:(NSData *)cipherText
|
||||
initializationVector:(NSData *)initializationVector
|
||||
authTag:(NSData *)authTag
|
||||
{
|
||||
self = [super init];
|
||||
if (!self) {
|
||||
return self;
|
||||
}
|
||||
|
||||
_ciphertext = [cipherText copy];
|
||||
_initializationVector = [initializationVector copy];
|
||||
_authTag = [authTag copy];
|
||||
|
||||
if (_ciphertext == nil || _initializationVector.length != kAESGCM256_IVLength
|
||||
|| _authTag.length != kAESGCM256_TagLength) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@implementation Cryptography
|
||||
|
||||
#pragma mark - random bytes methods
|
||||
|
||||
+ (NSData *)generateRandomBytes:(NSUInteger)numberBytes
|
||||
{
|
||||
return [Randomness generateRandomBytes:(int)numberBytes];
|
||||
}
|
||||
|
||||
+ (uint32_t)randomUInt32
|
||||
{
|
||||
size_t size = sizeof(uint32_t);
|
||||
NSData *data = [self generateRandomBytes:size];
|
||||
uint32_t result = 0;
|
||||
[data getBytes:&result range:NSMakeRange(0, size)];
|
||||
return result;
|
||||
}
|
||||
|
||||
+ (uint64_t)randomUInt64
|
||||
{
|
||||
size_t size = sizeof(uint64_t);
|
||||
NSData *data = [self generateRandomBytes:size];
|
||||
uint64_t result = 0;
|
||||
[data getBytes:&result range:NSMakeRange(0, size)];
|
||||
return result;
|
||||
}
|
||||
|
||||
+ (unsigned)randomUnsigned
|
||||
{
|
||||
size_t size = sizeof(unsigned);
|
||||
NSData *data = [self generateRandomBytes:size];
|
||||
unsigned result = 0;
|
||||
[data getBytes:&result range:NSMakeRange(0, size)];
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma mark - SHA1
|
||||
|
||||
// Used by TSContactManager to send hashed/truncated contact list to server.
|
||||
+ (nullable NSString *)truncatedSHA1Base64EncodedWithoutPadding:(NSString *)string
|
||||
{
|
||||
NSData *_Nullable stringData = [string dataUsingEncoding:NSUTF8StringEncoding];
|
||||
if (!stringData) {
|
||||
OWSFailDebug(@"could not convert string to utf-8.");
|
||||
return nil;
|
||||
}
|
||||
if (stringData.length >= UINT32_MAX) {
|
||||
OWSFailDebug(@"string data is too long.");
|
||||
return nil;
|
||||
}
|
||||
uint32_t dataLength = (uint32_t)stringData.length;
|
||||
|
||||
NSMutableData *_Nullable hashData = [NSMutableData dataWithLength:20];
|
||||
if (!hashData) {
|
||||
OWSFail(@"Could not allocate buffer.");
|
||||
}
|
||||
CC_SHA1(stringData.bytes, dataLength, hashData.mutableBytes);
|
||||
|
||||
NSData *truncatedData = [hashData subdataWithRange:NSMakeRange(0, 10)];
|
||||
return [[truncatedData base64EncodedString] stringByReplacingOccurrencesOfString:@"=" withString:@""];
|
||||
}
|
||||
|
||||
#pragma mark - SHA256 Digest
|
||||
|
||||
+ (nullable NSData *)computeSHA256Digest:(NSData *)data
|
||||
{
|
||||
return [self computeSHA256Digest:data truncatedToBytes:CC_SHA256_DIGEST_LENGTH];
|
||||
}
|
||||
|
||||
+ (nullable NSData *)computeSHA256Digest:(NSData *)data truncatedToBytes:(NSUInteger)truncatedBytes
|
||||
{
|
||||
if (data.length >= UINT32_MAX) {
|
||||
OWSFailDebug(@"data is too long.");
|
||||
return nil;
|
||||
}
|
||||
uint32_t dataLength = (uint32_t)data.length;
|
||||
|
||||
NSMutableData *_Nullable digestData = [[NSMutableData alloc] initWithLength:CC_SHA256_DIGEST_LENGTH];
|
||||
if (!digestData) {
|
||||
OWSFailDebug(@"could not allocate buffer.");
|
||||
return nil;
|
||||
}
|
||||
CC_SHA256(data.bytes, dataLength, digestData.mutableBytes);
|
||||
return [digestData subdataWithRange:NSMakeRange(0, truncatedBytes)];
|
||||
}
|
||||
|
||||
#pragma mark - HMAC/SHA256
|
||||
|
||||
+ (nullable NSData *)computeSHA256HMAC:(NSData *)data withHMACKey:(NSData *)HMACKey
|
||||
{
|
||||
if (data.length >= SIZE_MAX) {
|
||||
OWSFailDebug(@"data is too long.");
|
||||
return nil;
|
||||
}
|
||||
size_t dataLength = (size_t)data.length;
|
||||
if (HMACKey.length >= SIZE_MAX) {
|
||||
OWSFailDebug(@"HMAC key is too long.");
|
||||
return nil;
|
||||
}
|
||||
size_t hmacKeyLength = (size_t)HMACKey.length;
|
||||
|
||||
NSMutableData *_Nullable ourHmacData = [[NSMutableData alloc] initWithLength:CC_SHA256_DIGEST_LENGTH];
|
||||
if (!ourHmacData) {
|
||||
OWSFailDebug(@"could not allocate buffer.");
|
||||
return nil;
|
||||
}
|
||||
CCHmac(kCCHmacAlgSHA256, [HMACKey bytes], hmacKeyLength, [data bytes], dataLength, ourHmacData.mutableBytes);
|
||||
return [ourHmacData copy];
|
||||
}
|
||||
|
||||
+ (nullable NSData *)truncatedSHA256HMAC:(NSData *)dataToHMAC
|
||||
withHMACKey:(NSData *)HMACKey
|
||||
truncation:(NSUInteger)truncation
|
||||
{
|
||||
OWSAssert(truncation <= CC_SHA256_DIGEST_LENGTH);
|
||||
OWSAssert(dataToHMAC);
|
||||
OWSAssert(HMACKey);
|
||||
|
||||
return
|
||||
[[Cryptography computeSHA256HMAC:dataToHMAC withHMACKey:HMACKey] subdataWithRange:NSMakeRange(0, truncation)];
|
||||
}
|
||||
|
||||
#pragma mark - AES CBC Mode
|
||||
|
||||
/**
|
||||
* AES256 CBC encrypt then mac. Used to decrypt both signal messages and attachment blobs
|
||||
*
|
||||
* @return decrypted data or nil if hmac invalid/decryption fails
|
||||
*/
|
||||
+ (nullable NSData *)decryptCBCMode:(NSData *)dataToDecrypt
|
||||
key:(NSData *)key
|
||||
IV:(NSData *)iv
|
||||
version:(nullable NSData *)version
|
||||
HMACKey:(NSData *)hmacKey
|
||||
HMACType:(TSMACType)hmacType
|
||||
matchingHMAC:(NSData *)hmac
|
||||
digest:(nullable NSData *)digest
|
||||
{
|
||||
OWSAssert(dataToDecrypt);
|
||||
OWSAssert(key);
|
||||
if (key.length != kCCKeySizeAES256) {
|
||||
OWSFailDebug(@"key had wrong size.");
|
||||
return nil;
|
||||
}
|
||||
OWSAssert(iv);
|
||||
if (iv.length != kCCBlockSizeAES128) {
|
||||
OWSFailDebug(@"iv had wrong size.");
|
||||
return nil;
|
||||
}
|
||||
OWSAssert(hmacKey);
|
||||
OWSAssert(hmac);
|
||||
|
||||
size_t bufferSize;
|
||||
BOOL didOverflow = __builtin_add_overflow(dataToDecrypt.length, kCCBlockSizeAES128, &bufferSize);
|
||||
if (didOverflow) {
|
||||
OWSFailDebug(@"bufferSize was too large.");
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Verify hmac of: version? || iv || encrypted data
|
||||
|
||||
NSUInteger dataToAuthLength = 0;
|
||||
if (__builtin_add_overflow(dataToDecrypt.length, iv.length, &dataToAuthLength)) {
|
||||
OWSFailDebug(@"dataToAuth was too large.");
|
||||
return nil;
|
||||
}
|
||||
if (version != nil && __builtin_add_overflow(dataToAuthLength, version.length, &dataToAuthLength)) {
|
||||
OWSFailDebug(@"dataToAuth was too large.");
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSMutableData *dataToAuth = [NSMutableData data];
|
||||
if (version != nil) {
|
||||
[dataToAuth appendData:version];
|
||||
}
|
||||
[dataToAuth appendData:iv];
|
||||
[dataToAuth appendData:dataToDecrypt];
|
||||
|
||||
NSData *_Nullable ourHmacData;
|
||||
|
||||
if (hmacType == TSHMACSHA256Truncated10Bytes) {
|
||||
// used to authenticate envelope from websocket
|
||||
OWSAssert(hmacKey.length == kHMAC256_EnvelopeKeyLength);
|
||||
ourHmacData = [Cryptography truncatedSHA256HMAC:dataToAuth withHMACKey:hmacKey truncation:10];
|
||||
OWSAssert(ourHmacData.length == 10);
|
||||
} else if (hmacType == TSHMACSHA256AttachementType) {
|
||||
OWSAssert(hmacKey.length == HMAC256_KEY_LENGTH);
|
||||
ourHmacData =
|
||||
[Cryptography truncatedSHA256HMAC:dataToAuth withHMACKey:hmacKey truncation:HMAC256_OUTPUT_LENGTH];
|
||||
OWSAssert(ourHmacData.length == HMAC256_OUTPUT_LENGTH);
|
||||
} else {
|
||||
OWSFail(@"unknown HMAC scheme: %ld", (long)hmacType);
|
||||
}
|
||||
|
||||
if (hmac == nil || ![ourHmacData ows_constantTimeIsEqualToData:hmac]) {
|
||||
OWSLogError(@"Bad HMAC on decrypting payload.");
|
||||
// Don't log HMAC in prod
|
||||
OWSLogDebug(@"Bad HMAC on decrypting payload. Their MAC: %@, our MAC: %@", hmac, ourHmacData);
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Optionally verify digest of: version? || iv || encrypted data || hmac
|
||||
if (digest) {
|
||||
OWSLogDebug(@"verifying their digest");
|
||||
[dataToAuth appendData:ourHmacData];
|
||||
NSData *_Nullable ourDigest = [Cryptography computeSHA256Digest:dataToAuth];
|
||||
if (!ourDigest || ![ourDigest ows_constantTimeIsEqualToData:digest]) {
|
||||
OWSLogWarn(@"Bad digest on decrypting payload");
|
||||
// Don't log digest in prod
|
||||
OWSLogDebug(@"Bad digest on decrypting payload. Their digest: %@, our digest: %@", digest, ourDigest);
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
// decrypt
|
||||
NSMutableData *_Nullable bufferData = [NSMutableData dataWithLength:bufferSize];
|
||||
if (!bufferData) {
|
||||
OWSLogError(@"Failed to allocate buffer.");
|
||||
return nil;
|
||||
}
|
||||
|
||||
size_t bytesDecrypted = 0;
|
||||
CCCryptorStatus cryptStatus = CCCrypt(kCCDecrypt,
|
||||
kCCAlgorithmAES128,
|
||||
kCCOptionPKCS7Padding,
|
||||
[key bytes],
|
||||
[key length],
|
||||
[iv bytes],
|
||||
[dataToDecrypt bytes],
|
||||
[dataToDecrypt length],
|
||||
bufferData.mutableBytes,
|
||||
bufferSize,
|
||||
&bytesDecrypted);
|
||||
if (cryptStatus == kCCSuccess) {
|
||||
return [bufferData subdataWithRange:NSMakeRange(0, bytesDecrypted)];
|
||||
} else {
|
||||
OWSLogError(@"Failed CBC decryption");
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark - methods which use AES CBC
|
||||
|
||||
+ (nullable NSData *)decryptAppleMessagePayload:(NSData *)payload withSignalingKey:(NSString *)signalingKeyString
|
||||
{
|
||||
OWSAssertDebug(payload);
|
||||
OWSAssertDebug(signalingKeyString);
|
||||
|
||||
size_t versionLength = 1;
|
||||
size_t ivLength = 16;
|
||||
size_t macLength = 10;
|
||||
size_t nonCiphertextLength = versionLength + ivLength + macLength;
|
||||
|
||||
size_t ciphertextLength;
|
||||
ows_sub_overflow(payload.length, nonCiphertextLength, &ciphertextLength);
|
||||
|
||||
if (payload.length < nonCiphertextLength) {
|
||||
OWSFailDebug(@"Invalid payload");
|
||||
return nil;
|
||||
}
|
||||
if (payload.length >= MIN(SIZE_MAX, NSUIntegerMax) - nonCiphertextLength) {
|
||||
OWSFailDebug(@"Invalid payload");
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSUInteger cursor = 0;
|
||||
NSData *versionData = [payload subdataWithRange:NSMakeRange(cursor, versionLength)];
|
||||
cursor += versionLength;
|
||||
NSData *ivData = [payload subdataWithRange:NSMakeRange(cursor, ivLength)];
|
||||
cursor += ivLength;
|
||||
NSData *ciphertextData = [payload subdataWithRange:NSMakeRange(cursor, ciphertextLength)];
|
||||
ows_add_overflow(cursor, ciphertextLength, &cursor);
|
||||
NSData *macData = [payload subdataWithRange:NSMakeRange(cursor, macLength)];
|
||||
|
||||
NSData *signalingKey = [NSData dataFromBase64String:signalingKeyString];
|
||||
NSData *signalingKeyAESKeyMaterial = [signalingKey subdataWithRange:NSMakeRange(0, 32)];
|
||||
NSData *signalingKeyHMACKeyMaterial = [signalingKey subdataWithRange:NSMakeRange(32, kHMAC256_EnvelopeKeyLength)];
|
||||
return [Cryptography decryptCBCMode:ciphertextData
|
||||
key:signalingKeyAESKeyMaterial
|
||||
IV:ivData
|
||||
version:versionData
|
||||
HMACKey:signalingKeyHMACKeyMaterial
|
||||
HMACType:TSHMACSHA256Truncated10Bytes
|
||||
matchingHMAC:macData
|
||||
digest:nil];
|
||||
}
|
||||
|
||||
+ (nullable NSData *)decryptAttachment:(NSData *)dataToDecrypt
|
||||
withKey:(NSData *)key
|
||||
digest:(nullable NSData *)digest
|
||||
unpaddedSize:(UInt32)unpaddedSize
|
||||
error:(NSError **)error
|
||||
{
|
||||
if (digest.length <= 0) {
|
||||
// This *could* happen with sufficiently outdated clients.
|
||||
OWSLogError(@"Refusing to decrypt attachment without a digest.");
|
||||
*error = OWSErrorWithCodeDescription(OWSErrorCodeFailedToDecryptMessage,
|
||||
NSLocalizedString(@"ERROR_MESSAGE_ATTACHMENT_FROM_OLD_CLIENT",
|
||||
@"Error message when unable to receive an attachment because the sending client is too old."));
|
||||
return nil;
|
||||
}
|
||||
|
||||
if (([dataToDecrypt length] < AES_CBC_IV_LENGTH + HMAC256_OUTPUT_LENGTH) ||
|
||||
([key length] < AES_KEY_SIZE + HMAC256_KEY_LENGTH)) {
|
||||
OWSLogError(@"Message shorter than crypto overhead!");
|
||||
*error = OWSErrorWithCodeDescription(
|
||||
OWSErrorCodeFailedToDecryptMessage, NSLocalizedString(@"ERROR_MESSAGE_INVALID_MESSAGE", @""));
|
||||
return nil;
|
||||
}
|
||||
|
||||
// key: 32 byte AES key || 32 byte Hmac-SHA256 key.
|
||||
NSData *encryptionKey = [key subdataWithRange:NSMakeRange(0, AES_KEY_SIZE)];
|
||||
NSData *hmacKey = [key subdataWithRange:NSMakeRange(AES_KEY_SIZE, HMAC256_KEY_LENGTH)];
|
||||
|
||||
// dataToDecrypt: IV || Ciphertext || truncated MAC(IV||Ciphertext)
|
||||
NSData *iv = [dataToDecrypt subdataWithRange:NSMakeRange(0, AES_CBC_IV_LENGTH)];
|
||||
|
||||
NSUInteger cipherTextLength;
|
||||
ows_sub_overflow(dataToDecrypt.length, (AES_CBC_IV_LENGTH + HMAC256_OUTPUT_LENGTH), &cipherTextLength);
|
||||
NSData *encryptedAttachment = [dataToDecrypt subdataWithRange:NSMakeRange(AES_CBC_IV_LENGTH, cipherTextLength)];
|
||||
|
||||
NSUInteger hmacOffset;
|
||||
ows_sub_overflow(dataToDecrypt.length, HMAC256_OUTPUT_LENGTH, &hmacOffset);
|
||||
NSData *hmac = [dataToDecrypt subdataWithRange:NSMakeRange(hmacOffset, HMAC256_OUTPUT_LENGTH)];
|
||||
|
||||
NSData *_Nullable paddedPlainText = [Cryptography decryptCBCMode:encryptedAttachment
|
||||
key:encryptionKey
|
||||
IV:iv
|
||||
version:nil
|
||||
HMACKey:hmacKey
|
||||
HMACType:TSHMACSHA256AttachementType
|
||||
matchingHMAC:hmac
|
||||
digest:digest];
|
||||
if (!paddedPlainText) {
|
||||
OWSFailDebug(@"couldn't decrypt attachment.");
|
||||
*error = OWSErrorWithCodeDescription(
|
||||
OWSErrorCodeFailedToDecryptMessage, NSLocalizedString(@"ERROR_MESSAGE_INVALID_MESSAGE", @""));
|
||||
return nil;
|
||||
} else if (unpaddedSize == 0) {
|
||||
// Work around for legacy iOS client's which weren't setting padding size.
|
||||
// Since we know those clients pre-date attachment padding we return the entire data.
|
||||
OWSLogWarn(@"Decrypted attachment with unspecified size.");
|
||||
return paddedPlainText;
|
||||
} else {
|
||||
if (unpaddedSize > paddedPlainText.length) {
|
||||
*error = OWSErrorWithCodeDescription(
|
||||
OWSErrorCodeFailedToDecryptMessage, NSLocalizedString(@"ERROR_MESSAGE_INVALID_MESSAGE", @""));
|
||||
return nil;
|
||||
}
|
||||
|
||||
if (unpaddedSize == paddedPlainText.length) {
|
||||
OWSLogInfo(@"decrypted unpadded attachment.");
|
||||
return [paddedPlainText copy];
|
||||
} else {
|
||||
unsigned long paddingSize;
|
||||
ows_sub_overflow(paddedPlainText.length, unpaddedSize, &paddingSize);
|
||||
|
||||
OWSLogInfo(@"decrypted padded attachment with unpaddedSize: %lu, paddingSize: %lu",
|
||||
(unsigned long)unpaddedSize,
|
||||
paddingSize);
|
||||
return [paddedPlainText subdataWithRange:NSMakeRange(0, unpaddedSize)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+ (unsigned long)paddedSize:(unsigned long)unpaddedSize
|
||||
{
|
||||
// Don't enable this until clients are sufficiently rolled out.
|
||||
BOOL shouldPad = NO;
|
||||
if (shouldPad) {
|
||||
// Note: This just rounds up to the nearsest power of two,
|
||||
// but the actual padding scheme is TBD
|
||||
return pow(2, ceil( log2( unpaddedSize )));
|
||||
} else {
|
||||
return unpaddedSize;
|
||||
}
|
||||
}
|
||||
|
||||
+ (nullable NSData *)encryptAttachmentData:(NSData *)attachmentData
|
||||
outKey:(NSData *_Nonnull *_Nullable)outKey
|
||||
outDigest:(NSData *_Nonnull *_Nullable)outDigest
|
||||
{
|
||||
// Due to paddedSize, we need to divide by two.
|
||||
if (attachmentData.length >= SIZE_MAX / 2) {
|
||||
OWSLogError(@"data is too long.");
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSData *iv = [Cryptography generateRandomBytes:AES_CBC_IV_LENGTH];
|
||||
NSData *encryptionKey = [Cryptography generateRandomBytes:AES_KEY_SIZE];
|
||||
NSData *hmacKey = [Cryptography generateRandomBytes:HMAC256_KEY_LENGTH];
|
||||
|
||||
// The concatenated key for storage
|
||||
NSMutableData *attachmentKey = [NSMutableData data];
|
||||
[attachmentKey appendData:encryptionKey];
|
||||
[attachmentKey appendData:hmacKey];
|
||||
*outKey = [attachmentKey copy];
|
||||
|
||||
// Apply any padding
|
||||
unsigned long desiredSize = [self paddedSize:attachmentData.length];
|
||||
NSMutableData *paddedAttachmentData = [attachmentData mutableCopy];
|
||||
paddedAttachmentData.length = desiredSize;
|
||||
|
||||
// Encrypt
|
||||
size_t bufferSize;
|
||||
ows_add_overflow(paddedAttachmentData.length, kCCBlockSizeAES128, &bufferSize);
|
||||
NSMutableData *_Nullable bufferData = [NSMutableData dataWithLength:bufferSize];
|
||||
if (!bufferData) {
|
||||
OWSFail(@"Failed to allocate buffer.");
|
||||
}
|
||||
|
||||
size_t bytesEncrypted = 0;
|
||||
CCCryptorStatus cryptStatus = CCCrypt(kCCEncrypt,
|
||||
kCCAlgorithmAES128,
|
||||
kCCOptionPKCS7Padding,
|
||||
[encryptionKey bytes],
|
||||
[encryptionKey length],
|
||||
[iv bytes],
|
||||
[paddedAttachmentData bytes],
|
||||
[paddedAttachmentData length],
|
||||
bufferData.mutableBytes,
|
||||
bufferSize,
|
||||
&bytesEncrypted);
|
||||
|
||||
if (cryptStatus != kCCSuccess) {
|
||||
OWSLogError(@"CCCrypt failed with status: %d", (int32_t)cryptStatus);
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSData *cipherText = [bufferData subdataWithRange:NSMakeRange(0, bytesEncrypted)];
|
||||
|
||||
NSMutableData *encryptedPaddedData = [NSMutableData data];
|
||||
[encryptedPaddedData appendData:iv];
|
||||
[encryptedPaddedData appendData:cipherText];
|
||||
|
||||
// compute hmac of: iv || encrypted data
|
||||
NSData *_Nullable hmac =
|
||||
[Cryptography truncatedSHA256HMAC:encryptedPaddedData withHMACKey:hmacKey truncation:HMAC256_OUTPUT_LENGTH];
|
||||
if (!hmac) {
|
||||
OWSFailDebug(@"could not compute SHA 256 HMAC.");
|
||||
return nil;
|
||||
}
|
||||
|
||||
[encryptedPaddedData appendData:hmac];
|
||||
|
||||
// compute digest of: iv || encrypted data || hmac
|
||||
NSData *_Nullable digest = [self computeSHA256Digest:encryptedPaddedData];
|
||||
if (!digest) {
|
||||
OWSFailDebug(@"data is too long.");
|
||||
return nil;
|
||||
}
|
||||
*outDigest = digest;
|
||||
|
||||
return [encryptedPaddedData copy];
|
||||
}
|
||||
|
||||
+ (nullable AES25GCMEncryptionResult *)encryptAESGCMWithData:(NSData *)plaintext
|
||||
additionalAuthenticatedData:(nullable NSData *)additionalAuthenticatedData
|
||||
key:(OWSAES256Key *)key
|
||||
{
|
||||
NSData *initializationVector = [Cryptography generateRandomBytes:kAESGCM256_IVLength];
|
||||
NSMutableData *ciphertext = [NSMutableData dataWithLength:plaintext.length];
|
||||
NSMutableData *authTag = [NSMutableData dataWithLength:kAESGCM256_TagLength];
|
||||
|
||||
EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
|
||||
if (!ctx) {
|
||||
OWSFailDebug(@"failed to build context while encrypting");
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Initialise the encryption operation.
|
||||
if (EVP_EncryptInit_ex(ctx, EVP_aes_256_gcm(), NULL, NULL, NULL) != kOpenSSLSuccess) {
|
||||
OWSFailDebug(@"failed to init encryption");
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Set IV length if default 12 bytes (96 bits) is not appropriate
|
||||
if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, (int)initializationVector.length, NULL) != kOpenSSLSuccess) {
|
||||
OWSFailDebug(@"failed to set IV length");
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Initialise key and IV
|
||||
if (EVP_EncryptInit_ex(ctx, NULL, NULL, key.keyData.bytes, initializationVector.bytes) != kOpenSSLSuccess) {
|
||||
OWSFailDebug(@"failed to set key and iv while encrypting");
|
||||
return nil;
|
||||
}
|
||||
|
||||
int bytesEncrypted = 0;
|
||||
|
||||
// Provide any AAD data. This can be called zero or more times as
|
||||
// required
|
||||
if (additionalAuthenticatedData != nil) {
|
||||
if (additionalAuthenticatedData.length >= INT_MAX) {
|
||||
OWSFailDebug(@"additionalAuthenticatedData too large");
|
||||
return nil;
|
||||
}
|
||||
if (EVP_EncryptUpdate(
|
||||
ctx, NULL, &bytesEncrypted, additionalAuthenticatedData.bytes, (int)additionalAuthenticatedData.length)
|
||||
!= kOpenSSLSuccess) {
|
||||
OWSFailDebug(@"encryptUpdate failed");
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
if (plaintext.length >= INT_MAX) {
|
||||
OWSFailDebug(@"plaintext too large");
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Provide the message to be encrypted, and obtain the encrypted output.
|
||||
//
|
||||
// If we wanted to save memory, we could encrypt piece-wise from a plaintext iostream -
|
||||
// feeding each chunk to EVP_EncryptUpdate, which can be called multiple times.
|
||||
// For simplicity, we currently encrypt the entire plaintext in one shot.
|
||||
if (EVP_EncryptUpdate(ctx, ciphertext.mutableBytes, &bytesEncrypted, plaintext.bytes, (int)plaintext.length)
|
||||
!= kOpenSSLSuccess) {
|
||||
OWSFailDebug(@"encryptUpdate failed");
|
||||
return nil;
|
||||
}
|
||||
if (bytesEncrypted != plaintext.length) {
|
||||
OWSFailDebug(@"bytesEncrypted != plainTextData.length");
|
||||
return nil;
|
||||
}
|
||||
|
||||
int finalizedBytes = 0;
|
||||
// Finalize the encryption. Normally ciphertext bytes may be written at
|
||||
// this stage, but this does not occur in GCM mode
|
||||
if (EVP_EncryptFinal_ex(ctx, ciphertext.mutableBytes + bytesEncrypted, &finalizedBytes) != kOpenSSLSuccess) {
|
||||
OWSFailDebug(@"failed to finalize encryption");
|
||||
return nil;
|
||||
}
|
||||
if (finalizedBytes != 0) {
|
||||
OWSFailDebug(@"Unexpected finalized bytes written");
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Get the tag
|
||||
if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, kAESGCM256_TagLength, authTag.mutableBytes) != kOpenSSLSuccess) {
|
||||
OWSFailDebug(@"failed to write tag");
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Clean up
|
||||
EVP_CIPHER_CTX_free(ctx);
|
||||
|
||||
AES25GCMEncryptionResult *_Nullable result =
|
||||
[[AES25GCMEncryptionResult alloc] initWithCipherText:ciphertext
|
||||
initializationVector:initializationVector
|
||||
authTag:authTag];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
+ (nullable NSData *)decryptAESGCMWithInitializationVector:(NSData *)initializationVector
|
||||
ciphertext:(NSData *)ciphertext
|
||||
additionalAuthenticatedData:(nullable NSData *)additionalAuthenticatedData
|
||||
authTag:(NSData *)authTagFromEncrypt
|
||||
key:(OWSAES256Key *)key
|
||||
{
|
||||
OWSAssertDebug(initializationVector.length == kAESGCM256_IVLength);
|
||||
OWSAssertDebug(ciphertext.length > 0);
|
||||
OWSAssertDebug(authTagFromEncrypt.length == kAESGCM256_TagLength);
|
||||
OWSAssertDebug(key);
|
||||
|
||||
NSMutableData *plaintext = [NSMutableData dataWithLength:ciphertext.length];
|
||||
|
||||
// Create and initialise the context
|
||||
EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
|
||||
|
||||
if (!ctx) {
|
||||
OWSFailDebug(@"failed to build context while decrypting");
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Initialise the decryption operation.
|
||||
if (EVP_DecryptInit_ex(ctx, EVP_aes_256_gcm(), NULL, NULL, NULL) != kOpenSSLSuccess) {
|
||||
OWSFailDebug(@"failed to init decryption");
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Set IV length. Not necessary if this is 12 bytes (96 bits)
|
||||
if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, kAESGCM256_IVLength, NULL) != kOpenSSLSuccess) {
|
||||
OWSFailDebug(@"failed to set key and iv while decrypting");
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Initialise key and IV
|
||||
if (EVP_DecryptInit_ex(ctx, NULL, NULL, key.keyData.bytes, initializationVector.bytes) != kOpenSSLSuccess) {
|
||||
OWSFailDebug(@"failed to init decryption");
|
||||
return nil;
|
||||
}
|
||||
|
||||
int decryptedBytes = 0;
|
||||
|
||||
// Provide any AAD data. This can be called zero or more times as
|
||||
// required
|
||||
if (additionalAuthenticatedData) {
|
||||
if (additionalAuthenticatedData.length >= INT_MAX) {
|
||||
OWSFailDebug(@"additionalAuthenticatedData too large");
|
||||
return nil;
|
||||
}
|
||||
if (!EVP_DecryptUpdate(ctx,
|
||||
NULL,
|
||||
&decryptedBytes,
|
||||
additionalAuthenticatedData.bytes,
|
||||
(int)additionalAuthenticatedData.length)) {
|
||||
OWSFailDebug(@"failed during additionalAuthenticatedData");
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
// Provide the message to be decrypted, and obtain the plaintext output.
|
||||
//
|
||||
// If we wanted to save memory, we could decrypt piece-wise from an iostream -
|
||||
// feeding each chunk to EVP_DecryptUpdate, which can be called multiple times.
|
||||
// For simplicity, we currently decrypt the entire ciphertext in one shot.
|
||||
if (ciphertext.length >= INT_MAX) {
|
||||
OWSFailDebug(@"ciphertext too large");
|
||||
return nil;
|
||||
}
|
||||
if (EVP_DecryptUpdate(ctx, plaintext.mutableBytes, &decryptedBytes, ciphertext.bytes, (int)ciphertext.length)
|
||||
!= kOpenSSLSuccess) {
|
||||
OWSFailDebug(@"decryptUpdate failed");
|
||||
return nil;
|
||||
}
|
||||
|
||||
if (decryptedBytes != ciphertext.length) {
|
||||
OWSFailDebug(@"Failed to decrypt entire ciphertext");
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Set expected tag value. Works in OpenSSL 1.0.1d and later
|
||||
if (authTagFromEncrypt.length >= INT_MAX) {
|
||||
OWSFailDebug(@"authTagFromEncrypt too large");
|
||||
return nil;
|
||||
}
|
||||
if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_TAG, (int)authTagFromEncrypt.length, (void *)authTagFromEncrypt.bytes)
|
||||
!= kOpenSSLSuccess) {
|
||||
OWSFailDebug(@"Failed to set auth tag in decrypt.");
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Finalise the decryption. A positive return value indicates success,
|
||||
// anything else is a failure - the plaintext is not trustworthy.
|
||||
int finalBytes = 0;
|
||||
int decryptStatus = EVP_DecryptFinal_ex(ctx, (unsigned char *)(plaintext.bytes + decryptedBytes), &finalBytes);
|
||||
|
||||
// AESGCM doesn't write any final bytes
|
||||
OWSAssertDebug(finalBytes == 0);
|
||||
|
||||
// Clean up
|
||||
EVP_CIPHER_CTX_free(ctx);
|
||||
|
||||
if (decryptStatus > 0) {
|
||||
return [plaintext copy];
|
||||
} else {
|
||||
// This should only happen if the user has changed their profile key, which should only
|
||||
// happen currently if they re-register.
|
||||
OWSLogError(@"Decrypt verification failed");
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
+ (nullable NSData *)encryptAESGCMWithProfileData:(NSData *)plaintext key:(OWSAES256Key *)key
|
||||
{
|
||||
AES25GCMEncryptionResult *result = [self encryptAESGCMWithData:plaintext additionalAuthenticatedData:nil key:key];
|
||||
|
||||
NSMutableData *encryptedData = [result.initializationVector mutableCopy];
|
||||
[encryptedData appendData:result.ciphertext];
|
||||
[encryptedData appendData:result.authTag];
|
||||
|
||||
return [encryptedData copy];
|
||||
}
|
||||
|
||||
+ (nullable NSData *)decryptAESGCMWithProfileData:(NSData *)encryptedData key:(OWSAES256Key *)key
|
||||
{
|
||||
NSUInteger cipherTextLength;
|
||||
BOOL didOverflow
|
||||
= __builtin_sub_overflow(encryptedData.length, (kAESGCM256_IVLength + kAESGCM256_TagLength), &cipherTextLength);
|
||||
if (didOverflow) {
|
||||
OWSFailDebug(@"unexpectedly short encryptedData.length: %lu", (unsigned long)encryptedData.length);
|
||||
return nil;
|
||||
}
|
||||
|
||||
// encryptedData layout: initializationVector || ciphertext || authTag
|
||||
NSData *initializationVector = [encryptedData subdataWithRange:NSMakeRange(0, kAESGCM256_IVLength)];
|
||||
NSData *ciphertext = [encryptedData subdataWithRange:NSMakeRange(kAESGCM256_IVLength, cipherTextLength)];
|
||||
|
||||
NSUInteger tagOffset;
|
||||
ows_add_overflow(kAESGCM256_IVLength, cipherTextLength, &tagOffset);
|
||||
|
||||
NSData *authTag = [encryptedData subdataWithRange:NSMakeRange(tagOffset, kAESGCM256_TagLength)];
|
||||
|
||||
return [self decryptAESGCMWithInitializationVector:initializationVector
|
||||
ciphertext:ciphertext
|
||||
additionalAuthenticatedData:nil
|
||||
authTag:authTag
|
||||
key:key];
|
||||
}
|
||||
|
||||
+ (void)seedRandom
|
||||
{
|
||||
// We should never use rand(), but seed it just in case it's used by 3rd-party code
|
||||
unsigned seed = [Cryptography randomUnsigned];
|
||||
srand(seed);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -4,13 +4,13 @@
|
|||
|
||||
#import "OWSAnalytics.h"
|
||||
#import "AppContext.h"
|
||||
#import "Cryptography.h"
|
||||
#import "OWSBackgroundTask.h"
|
||||
#import "OWSPrimaryStorage.h"
|
||||
#import "OWSQueues.h"
|
||||
#import "YapDatabaseConnection+OWS.h"
|
||||
#import <CocoaLumberjack/CocoaLumberjack.h>
|
||||
#import <Reachability/Reachability.h>
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
#import <YapDatabase/YapDatabase.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#import "SSKBaseTest.h"
|
||||
#import <Curve25519Kit/Curve25519.h>
|
||||
#import <SignalServiceKit/Cryptography.h>
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
#import <SignalServiceKit/OWSProvisioningCipher.h>
|
||||
|
||||
@interface OWSProvisioningCipher(Testing)
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#import "OWSMessageManager.h"
|
||||
#import "ContactsManagerProtocol.h"
|
||||
#import "ContactsUpdater.h"
|
||||
#import "Cryptography.h"
|
||||
#import "MockSSKEnvironment.h"
|
||||
#import "OWSFakeCallMessageHandler.h"
|
||||
#import "OWSFakeContactsManager.h"
|
||||
|
@ -17,6 +16,7 @@
|
|||
#import "SSKBaseTest.h"
|
||||
#import "TSGroupThread.h"
|
||||
#import "TSNetworkManager.h"
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
#import <SignalServiceKit/SignalServiceKit-Swift.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
//
|
||||
|
||||
#import "OWSMessageSender.h"
|
||||
#import "Cryptography.h"
|
||||
#import "NSError+MessageSending.h"
|
||||
#import "OWSDisappearingMessagesConfiguration.h"
|
||||
#import "OWSError.h"
|
||||
|
@ -21,6 +20,7 @@
|
|||
#import "TSRequest.h"
|
||||
#import <AxolotlKit/AxolotlExceptions.h>
|
||||
#import <AxolotlKit/SessionBuilder.h>
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
|
|
@ -1,240 +0,0 @@
|
|||
//
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Cryptography.h"
|
||||
#import "SSKBaseTest.h"
|
||||
#import <SignalCoreKit/NSData+OWS.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface CryptographyTests : SSKBaseTest
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@interface Cryptography (Test)
|
||||
|
||||
+ (NSData *)truncatedSHA256HMAC:(NSData *)dataToHMAC withHMACKey:(NSData *)HMACKey truncation:(int)bytes;
|
||||
+ (NSData *)encryptCBCMode:(NSData *)dataToEncrypt
|
||||
withKey:(NSData *)key
|
||||
withIV:(NSData *)iv
|
||||
withVersion:(NSData *)version
|
||||
withHMACKey:(NSData *)hmacKey
|
||||
withHMACType:(TSMACType)hmacType
|
||||
computedHMAC:(NSData **)hmac;
|
||||
|
||||
+ (NSData *)decryptCBCMode:(NSData *)dataToDecrypt
|
||||
key:(NSData *)key
|
||||
IV:(NSData *)iv
|
||||
version:(NSData *)version
|
||||
HMACKey:(NSData *)hmacKey
|
||||
HMACType:(TSMACType)hmacType
|
||||
matchingHMAC:(NSData *)hmac;
|
||||
|
||||
@end
|
||||
|
||||
@implementation CryptographyTests
|
||||
|
||||
- (void)testEncryptAttachmentData
|
||||
{
|
||||
NSString *plainText = @"SGF3YWlpIGlzIEF3ZXNvbWUh";
|
||||
NSData *plainTextData = [NSData dataFromBase64String:plainText];
|
||||
|
||||
// Sanity
|
||||
XCTAssertNotNil(plainTextData);
|
||||
|
||||
NSData *generatedKey;
|
||||
NSData *generatedDigest;
|
||||
|
||||
NSData *cipherText =
|
||||
[Cryptography encryptAttachmentData:plainTextData outKey:&generatedKey outDigest:&generatedDigest];
|
||||
|
||||
NSError *error;
|
||||
NSData *decryptedData = [Cryptography decryptAttachment:cipherText
|
||||
withKey:generatedKey
|
||||
digest:generatedDigest
|
||||
unpaddedSize:(UInt32)plainTextData.length
|
||||
error:&error];
|
||||
XCTAssertNil(error);
|
||||
|
||||
XCTAssertEqualObjects(plainTextData, decryptedData);
|
||||
}
|
||||
|
||||
- (void)testEncryptAttachmentDataWithBadUnpaddedSize
|
||||
{
|
||||
|
||||
NSString *plainText = @"SGF3YWlpIGlzIEF3ZXNvbWUh";
|
||||
NSData *plainTextData = [NSData dataFromBase64String:plainText];
|
||||
|
||||
// Sanity
|
||||
XCTAssertNotNil(plainTextData);
|
||||
|
||||
NSData *generatedKey;
|
||||
NSData *generatedDigest;
|
||||
|
||||
NSData *cipherText =
|
||||
[Cryptography encryptAttachmentData:plainTextData outKey:&generatedKey outDigest:&generatedDigest];
|
||||
|
||||
|
||||
NSError *error;
|
||||
NSData *decryptedData = [Cryptography decryptAttachment:cipherText
|
||||
withKey:generatedKey
|
||||
digest:generatedDigest
|
||||
unpaddedSize:(UInt32)cipherText.length + 1
|
||||
error:&error];
|
||||
XCTAssertNotNil(error);
|
||||
XCTAssertNil(decryptedData);
|
||||
}
|
||||
|
||||
- (void)testDecryptAttachmentWithBadKey
|
||||
{
|
||||
NSString *plainText = @"SGF3YWlpIGlzIEF3ZXNvbWUh";
|
||||
NSData *plainTextData = [NSData dataFromBase64String:plainText];
|
||||
|
||||
// Sanity
|
||||
XCTAssertNotNil(plainTextData);
|
||||
|
||||
NSData *generatedKey;
|
||||
NSData *generatedDigest;
|
||||
|
||||
NSData *cipherText =
|
||||
[Cryptography encryptAttachmentData:plainTextData outKey:&generatedKey outDigest:&generatedDigest];
|
||||
|
||||
NSData *badKey = [Cryptography generateRandomBytes:64];
|
||||
|
||||
NSError *error;
|
||||
XCTAssertThrows([Cryptography decryptAttachment:cipherText
|
||||
withKey:badKey
|
||||
digest:generatedDigest
|
||||
unpaddedSize:(UInt32)plainTextData.length
|
||||
error:&error]);
|
||||
}
|
||||
|
||||
- (void)testDecryptAttachmentWithBadDigest
|
||||
{
|
||||
NSString *plainText = @"SGF3YWlpIGlzIEF3ZXNvbWUh";
|
||||
NSData *plainTextData = [NSData dataFromBase64String:plainText];
|
||||
|
||||
// Sanity
|
||||
XCTAssertNotNil(plainTextData);
|
||||
|
||||
NSData *generatedKey;
|
||||
NSData *generatedDigest;
|
||||
|
||||
NSData *cipherText =
|
||||
[Cryptography encryptAttachmentData:plainTextData outKey:&generatedKey outDigest:&generatedDigest];
|
||||
|
||||
NSData *badDigest = [Cryptography generateRandomBytes:32];
|
||||
|
||||
NSError *error;
|
||||
XCTAssertThrows([Cryptography decryptAttachment:cipherText
|
||||
withKey:generatedKey
|
||||
digest:badDigest
|
||||
unpaddedSize:(UInt32)plainTextData.length
|
||||
error:&error]);
|
||||
}
|
||||
|
||||
- (void)testComputeSHA256Digest
|
||||
{
|
||||
NSString *plainText = @"SGF3YWlpIGlzIEF3ZXNvbWUh";
|
||||
NSData *plainTextData = [NSData dataFromBase64String:plainText];
|
||||
NSData *digest = [Cryptography computeSHA256Digest:plainTextData];
|
||||
|
||||
const uint8_t expectedBytes[] = {
|
||||
0xba, 0x5f, 0xf1, 0x26,
|
||||
0x82, 0xbb, 0xb2, 0x51,
|
||||
0x8b, 0xe6, 0x06, 0x48,
|
||||
0xc5, 0x53, 0xd0, 0xa2,
|
||||
0xbf, 0x71, 0xf1, 0xec,
|
||||
0xb4, 0xdb, 0x02, 0x12,
|
||||
0x5f, 0x80, 0xea, 0x34,
|
||||
0xc9, 0x8d, 0xee, 0x1f
|
||||
};
|
||||
|
||||
NSData *expectedDigest = [NSData dataWithBytes:expectedBytes length:32];
|
||||
XCTAssertEqualObjects(expectedDigest, digest);
|
||||
|
||||
NSData *expectedTruncatedDigest = [NSData dataWithBytes:expectedBytes length:10];
|
||||
NSData *truncatedDigest = [Cryptography computeSHA256Digest:plainTextData truncatedToBytes:10];
|
||||
XCTAssertEqualObjects(expectedTruncatedDigest, truncatedDigest);
|
||||
}
|
||||
|
||||
- (void)testGCMRoundTrip
|
||||
{
|
||||
NSData *plainTextData = [@"Super🔥secret🔥test🔥data🏁🏁" dataUsingEncoding:NSUTF8StringEncoding];
|
||||
// Sanity Check
|
||||
XCTAssertEqual(39, plainTextData.length);
|
||||
|
||||
OWSAES256Key *key = [OWSAES256Key new];
|
||||
NSData *_Nullable encryptedData = [Cryptography encryptAESGCMWithProfileData:plainTextData key:key];
|
||||
|
||||
const NSUInteger ivLength = 12;
|
||||
const NSUInteger tagLength = 16;
|
||||
|
||||
XCTAssertEqual(ivLength + plainTextData.length + tagLength, encryptedData.length);
|
||||
|
||||
NSData *_Nullable decryptedData = [Cryptography decryptAESGCMWithProfileData:encryptedData key:key];
|
||||
XCTAssert(decryptedData != nil);
|
||||
XCTAssertEqual(39, decryptedData.length);
|
||||
XCTAssertEqualObjects(plainTextData, decryptedData);
|
||||
XCTAssertEqualObjects(@"Super🔥secret🔥test🔥data🏁🏁", [[NSString alloc] initWithData:decryptedData encoding:NSUTF8StringEncoding]);
|
||||
}
|
||||
|
||||
- (void)testGCMWithBadTag
|
||||
{
|
||||
NSData *plainTextData = [@"Super🔥secret🔥test🔥data🏁🏁" dataUsingEncoding:NSUTF8StringEncoding];
|
||||
// Sanity Check
|
||||
XCTAssertEqual(39, plainTextData.length);
|
||||
|
||||
OWSAES256Key *key = [OWSAES256Key new];
|
||||
NSData *_Nullable encryptedData = [Cryptography encryptAESGCMWithProfileData:plainTextData key:key];
|
||||
|
||||
const NSUInteger ivLength = 12;
|
||||
const NSUInteger tagLength = 16;
|
||||
|
||||
XCTAssertEqual(ivLength + plainTextData.length + tagLength, encryptedData.length);
|
||||
|
||||
// Logic to slice up encryptedData copied from `[Cryptography decryptAESGCMWithData:key:]`
|
||||
|
||||
// encryptedData layout: initializationVector || cipherText || authTag
|
||||
NSUInteger cipherTextLength = encryptedData.length - ivLength - tagLength;
|
||||
|
||||
NSData *initializationVector = [encryptedData subdataWithRange:NSMakeRange(0, ivLength)];
|
||||
NSData *cipherText = [encryptedData subdataWithRange:NSMakeRange(ivLength, cipherTextLength)];
|
||||
NSData *authTag = [encryptedData subdataWithRange:NSMakeRange(ivLength + cipherTextLength, tagLength)];
|
||||
|
||||
NSData *_Nullable decryptedData = [Cryptography decryptAESGCMWithInitializationVector:initializationVector
|
||||
ciphertext:cipherText
|
||||
additionalAuthenticatedData:nil
|
||||
authTag:authTag
|
||||
key:key];
|
||||
|
||||
// Before we corrupt the tag, make sure we can decrypt the text as a sanity check to ensure we divided up the
|
||||
// encryptedData correctly.
|
||||
XCTAssert(decryptedData != nil);
|
||||
XCTAssertEqualObjects(
|
||||
@"Super🔥secret🔥test🔥data🏁🏁", [[NSString alloc] initWithData:decryptedData encoding:NSUTF8StringEncoding]);
|
||||
|
||||
// Now that we know it decrypts, try again with a bogus authTag
|
||||
NSMutableData *bogusAuthTag = [authTag mutableCopy];
|
||||
|
||||
// Corrupt one byte in the bogusAuthTag
|
||||
uint8_t flippedByte;
|
||||
[bogusAuthTag getBytes:&flippedByte length:1];
|
||||
flippedByte = flippedByte ^ 0xff;
|
||||
[bogusAuthTag replaceBytesInRange:NSMakeRange(0, 1) withBytes:&flippedByte];
|
||||
|
||||
decryptedData = [Cryptography decryptAESGCMWithInitializationVector:initializationVector
|
||||
ciphertext:cipherText
|
||||
additionalAuthenticatedData:nil
|
||||
authTag:bogusAuthTag
|
||||
key:key];
|
||||
|
||||
XCTAssertNil(decryptedData, @"Should have failed to decrypt");
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -2,9 +2,9 @@
|
|||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Cryptography.h"
|
||||
#import "NSData+messagePadding.h"
|
||||
#import "SSKBaseTest.h"
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
|
||||
@interface MessagePaddingTests : SSKBaseTest
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Cryptography.h"
|
||||
#import "OWSPrimaryStorage.h"
|
||||
#import "SSKBaseTest.h"
|
||||
#import "TSContactThread.h"
|
||||
|
@ -12,6 +11,7 @@
|
|||
#import "TSOutgoingMessage.h"
|
||||
#import "TSThread.h"
|
||||
#import "YapDatabaseConnection+OWS.h"
|
||||
#import <SignalCoreKit/Cryptography.h>
|
||||
|
||||
@interface TSMessageStorageTests : SSKBaseTest
|
||||
|
||||
|
|
Loading…
Reference in New Issue