Path: blob/main/SignalServiceKit/Messages/InvalidKeyMessages/TSInvalidIdentityKeySendingErrorMessage.m
1 views
//1// Copyright 2017 Signal Messenger, LLC2// SPDX-License-Identifier: AGPL-3.0-only3//45#import "TSInvalidIdentityKeySendingErrorMessage.h"6#import "TSOutgoingMessage.h"7#import <SignalServiceKit/SignalServiceKit-Swift.h>89NS_ASSUME_NONNULL_BEGIN1011@interface TSInvalidIdentityKeySendingErrorMessage ()1213@property (nonatomic, readonly) NSData *preKeyBundle;1415@end1617#pragma mark -1819// DEPRECATED - we no longer create new instances of this class (as of mid-2017); However, existing instances may20// exist, so we should keep this class around to honor their old behavior.21#pragma clang diagnostic push22#pragma clang diagnostic ignored "-Wdeprecated-implementations"23@implementation TSInvalidIdentityKeySendingErrorMessage24#pragma clang diagnostic pop2526- (NSUInteger)hash27{28NSUInteger result = [super hash];29result ^= self.messageId.hash;30result ^= self.preKeyBundle.hash;31return result;32}3334- (BOOL)isEqual:(id)other35{36if (![super isEqual:other]) {37return NO;38}39TSInvalidIdentityKeySendingErrorMessage *typedOther = (TSInvalidIdentityKeySendingErrorMessage *)other;40if (![NSObject isObject:self.messageId equalToObject:typedOther.messageId]) {41return NO;42}43if (![NSObject isObject:self.preKeyBundle equalToObject:typedOther.preKeyBundle]) {44return NO;45}46return YES;47}4849// --- CODE GENERATION MARKER5051// This snippet is generated by /Scripts/sds_codegen/sds_generate.py. Do not manually edit it, instead run52// `sds_codegen.sh`.5354// clang-format off5556- (instancetype)initWithGrdbId:(int64_t)grdbId57uniqueId:(NSString *)uniqueId58receivedAtTimestamp:(uint64_t)receivedAtTimestamp59sortId:(uint64_t)sortId60timestamp:(uint64_t)timestamp61uniqueThreadId:(NSString *)uniqueThreadId62body:(nullable NSString *)body63bodyRanges:(nullable MessageBodyRanges *)bodyRanges64contactShare:(nullable OWSContact *)contactShare65deprecated_attachmentIds:(nullable NSArray<NSString *> *)deprecated_attachmentIds66editState:(TSEditState)editState67expireStartedAt:(uint64_t)expireStartedAt68expireTimerVersion:(nullable NSNumber *)expireTimerVersion69expiresAt:(uint64_t)expiresAt70expiresInSeconds:(unsigned int)expiresInSeconds71giftBadge:(nullable OWSGiftBadge *)giftBadge72isGroupStoryReply:(BOOL)isGroupStoryReply73isPoll:(BOOL)isPoll74isSmsMessageRestoredFromBackup:(BOOL)isSmsMessageRestoredFromBackup75isViewOnceComplete:(BOOL)isViewOnceComplete76isViewOnceMessage:(BOOL)isViewOnceMessage77linkPreview:(nullable OWSLinkPreview *)linkPreview78messageSticker:(nullable MessageSticker *)messageSticker79quotedMessage:(nullable TSQuotedMessage *)quotedMessage80storedShouldStartExpireTimer:(BOOL)storedShouldStartExpireTimer81storyAuthorUuidString:(nullable NSString *)storyAuthorUuidString82storyReactionEmoji:(nullable NSString *)storyReactionEmoji83storyTimestamp:(nullable NSNumber *)storyTimestamp84wasRemotelyDeleted:(BOOL)wasRemotelyDeleted85errorType:(TSErrorMessageType)errorType86read:(BOOL)read87recipientAddress:(nullable SignalServiceAddress *)recipientAddress88sender:(nullable SignalServiceAddress *)sender89wasIdentityVerified:(BOOL)wasIdentityVerified90messageId:(NSString *)messageId91preKeyBundle:(NSData *)preKeyBundle92{93self = [super initWithGrdbId:grdbId94uniqueId:uniqueId95receivedAtTimestamp:receivedAtTimestamp96sortId:sortId97timestamp:timestamp98uniqueThreadId:uniqueThreadId99body:body100bodyRanges:bodyRanges101contactShare:contactShare102deprecated_attachmentIds:deprecated_attachmentIds103editState:editState104expireStartedAt:expireStartedAt105expireTimerVersion:expireTimerVersion106expiresAt:expiresAt107expiresInSeconds:expiresInSeconds108giftBadge:giftBadge109isGroupStoryReply:isGroupStoryReply110isPoll:isPoll111isSmsMessageRestoredFromBackup:isSmsMessageRestoredFromBackup112isViewOnceComplete:isViewOnceComplete113isViewOnceMessage:isViewOnceMessage114linkPreview:linkPreview115messageSticker:messageSticker116quotedMessage:quotedMessage117storedShouldStartExpireTimer:storedShouldStartExpireTimer118storyAuthorUuidString:storyAuthorUuidString119storyReactionEmoji:storyReactionEmoji120storyTimestamp:storyTimestamp121wasRemotelyDeleted:wasRemotelyDeleted122errorType:errorType123read:read124recipientAddress:recipientAddress125sender:sender126wasIdentityVerified:wasIdentityVerified];127128if (!self) {129return self;130}131132_messageId = messageId;133_preKeyBundle = preKeyBundle;134135return self;136}137138// clang-format on139140// --- CODE GENERATION MARKER141142- (SignalServiceAddress *)theirSignalAddress143{144OWSAssertDebug(self.recipientAddress != nil);145146return self.recipientAddress;147}148149@end150151NS_ASSUME_NONNULL_END152153154