Path: blob/main/SignalServiceKit/Messages/Interactions/TSErrorMessage.h
1 views
//1// Copyright 2018 Signal Messenger, LLC2// SPDX-License-Identifier: AGPL-3.0-only3//45#import <SignalServiceKit/OWSReadTracking.h>6#import <SignalServiceKit/TSMessage.h>78NS_ASSUME_NONNULL_BEGIN910@class AciObjC;11@class SSKProtoEnvelope;12@class SignalServiceAddress;13@class TSErrorMessageBuilder;1415typedef NS_CLOSED_ENUM(int32_t, TSErrorMessageType) {16/// - Note This case is deprecated, but may be persisted in legacy messages.17TSErrorMessageNoSession,18/// - Note This case is deprecated, but may be persisted in legacy messages.19TSErrorMessageWrongTrustedIdentityKey,20/// - Note This case is deprecated, but may be persisted in legacy messages.21TSErrorMessageInvalidKeyException,22/// - Note This case is deprecated, but may be persisted in legacy messages.23TSErrorMessageMissingKeyId,24/// - Note This case is deprecated, but may be persisted in legacy messages.25TSErrorMessageInvalidMessage,26/// - Note This case is deprecated, but may be persisted in legacy messages.27TSErrorMessageDuplicateMessage,28/// - Note This case is deprecated, but may be persisted in legacy messages.29TSErrorMessageInvalidVersion,30/// Represents a "safety number change"; i.e, we learned that another user's31/// identity key has changed.32TSErrorMessageNonBlockingIdentityChange,33/// - Note This case is deprecated, but may be persisted in legacy messages.34TSErrorMessageUnknownContactBlockOffer,35/// - Note This case is deprecated, but may be persisted in legacy messages.36TSErrorMessageGroupCreationFailed,37/// Represents that we performed a legacy session-reset with another user38/// because a message from them failed to decrypt and the automatic retry39/// system is disabled.40/// - Important41/// The automatic "request resend of message that failed to decrypt" system42/// should mean that these are never used. However, since that system can43/// be disabled via remote config these messages remain relevant.44TSErrorMessageSessionRefresh,45/// Represents a message that has permanently failed to decrypt. For46/// example, this may represent a message for which we requested a resend47/// but didn't receive one in time.48TSErrorMessageDecryptionFailure,49};5051extern NSUInteger TSErrorMessageSchemaVersion;5253#pragma mark -5455@interface TSErrorMessage : TSMessage <OWSReadTracking, OWSPreviewText>5657- (instancetype)initMessageWithBuilder:(TSMessageBuilder *)messageBuilder NS_UNAVAILABLE;5859- (instancetype)initWithGrdbId:(int64_t)grdbId60uniqueId:(NSString *)uniqueId61receivedAtTimestamp:(uint64_t)receivedAtTimestamp62sortId:(uint64_t)sortId63timestamp:(uint64_t)timestamp64uniqueThreadId:(NSString *)uniqueThreadId65body:(nullable NSString *)body66bodyRanges:(nullable MessageBodyRanges *)bodyRanges67contactShare:(nullable OWSContact *)contactShare68deprecated_attachmentIds:(nullable NSArray<NSString *> *)deprecated_attachmentIds69editState:(TSEditState)editState70expireStartedAt:(uint64_t)expireStartedAt71expireTimerVersion:(nullable NSNumber *)expireTimerVersion72expiresAt:(uint64_t)expiresAt73expiresInSeconds:(unsigned int)expiresInSeconds74giftBadge:(nullable OWSGiftBadge *)giftBadge75isGroupStoryReply:(BOOL)isGroupStoryReply76isPoll:(BOOL)isPoll77isSmsMessageRestoredFromBackup:(BOOL)isSmsMessageRestoredFromBackup78isViewOnceComplete:(BOOL)isViewOnceComplete79isViewOnceMessage:(BOOL)isViewOnceMessage80linkPreview:(nullable OWSLinkPreview *)linkPreview81messageSticker:(nullable MessageSticker *)messageSticker82quotedMessage:(nullable TSQuotedMessage *)quotedMessage83storedShouldStartExpireTimer:(BOOL)storedShouldStartExpireTimer84storyAuthorUuidString:(nullable NSString *)storyAuthorUuidString85storyReactionEmoji:(nullable NSString *)storyReactionEmoji86storyTimestamp:(nullable NSNumber *)storyTimestamp87wasRemotelyDeleted:(BOOL)wasRemotelyDeleted NS_UNAVAILABLE;8889- (instancetype)initErrorMessageWithBuilder:(TSErrorMessageBuilder *)errorMessageBuilder NS_DESIGNATED_INITIALIZER90NS_SWIFT_NAME(init(errorMessageWithBuilder:));9192- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_UNAVAILABLE;9394// --- CODE GENERATION MARKER9596// This snippet is generated by /Scripts/sds_codegen/sds_generate.py. Do not manually edit it, instead run97// `sds_codegen.sh`.9899// clang-format off100101- (instancetype)initWithGrdbId:(int64_t)grdbId102uniqueId:(NSString *)uniqueId103receivedAtTimestamp:(uint64_t)receivedAtTimestamp104sortId:(uint64_t)sortId105timestamp:(uint64_t)timestamp106uniqueThreadId:(NSString *)uniqueThreadId107body:(nullable NSString *)body108bodyRanges:(nullable MessageBodyRanges *)bodyRanges109contactShare:(nullable OWSContact *)contactShare110deprecated_attachmentIds:(nullable NSArray<NSString *> *)deprecated_attachmentIds111editState:(TSEditState)editState112expireStartedAt:(uint64_t)expireStartedAt113expireTimerVersion:(nullable NSNumber *)expireTimerVersion114expiresAt:(uint64_t)expiresAt115expiresInSeconds:(unsigned int)expiresInSeconds116giftBadge:(nullable OWSGiftBadge *)giftBadge117isGroupStoryReply:(BOOL)isGroupStoryReply118isPoll:(BOOL)isPoll119isSmsMessageRestoredFromBackup:(BOOL)isSmsMessageRestoredFromBackup120isViewOnceComplete:(BOOL)isViewOnceComplete121isViewOnceMessage:(BOOL)isViewOnceMessage122linkPreview:(nullable OWSLinkPreview *)linkPreview123messageSticker:(nullable MessageSticker *)messageSticker124quotedMessage:(nullable TSQuotedMessage *)quotedMessage125storedShouldStartExpireTimer:(BOOL)storedShouldStartExpireTimer126storyAuthorUuidString:(nullable NSString *)storyAuthorUuidString127storyReactionEmoji:(nullable NSString *)storyReactionEmoji128storyTimestamp:(nullable NSNumber *)storyTimestamp129wasRemotelyDeleted:(BOOL)wasRemotelyDeleted130errorType:(TSErrorMessageType)errorType131read:(BOOL)read132recipientAddress:(nullable SignalServiceAddress *)recipientAddress133sender:(nullable SignalServiceAddress *)sender134wasIdentityVerified:(BOOL)wasIdentityVerified135NS_DESIGNATED_INITIALIZER NS_SWIFT_NAME(init(grdbId:uniqueId:receivedAtTimestamp:sortId:timestamp:uniqueThreadId:body:bodyRanges:contactShare:deprecated_attachmentIds:editState:expireStartedAt:expireTimerVersion:expiresAt:expiresInSeconds:giftBadge:isGroupStoryReply:isPoll:isSmsMessageRestoredFromBackup:isViewOnceComplete:isViewOnceMessage:linkPreview:messageSticker:quotedMessage:storedShouldStartExpireTimer:storyAuthorUuidString:storyReactionEmoji:storyTimestamp:wasRemotelyDeleted:errorType:read:recipientAddress:sender:wasIdentityVerified:));136137// clang-format on138139// --- CODE GENERATION MARKER140141@property (nonatomic, readonly) TSErrorMessageType errorType;142@property (nullable, nonatomic, readonly) SignalServiceAddress *sender;143@property (nullable, nonatomic, readonly) SignalServiceAddress *recipientAddress;144145// This property only applies if errorType == .nonBlockingIdentityChange.146@property (nonatomic, readonly) BOOL wasIdentityVerified;147148@end149150NS_ASSUME_NONNULL_END151152153