Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
signalapp
GitHub Repository: signalapp/Signal-iOS
Path: blob/main/SignalServiceKit/Messages/Interactions/TSErrorMessage.h
1 views
1
//
2
// Copyright 2018 Signal Messenger, LLC
3
// SPDX-License-Identifier: AGPL-3.0-only
4
//
5
6
#import <SignalServiceKit/OWSReadTracking.h>
7
#import <SignalServiceKit/TSMessage.h>
8
9
NS_ASSUME_NONNULL_BEGIN
10
11
@class AciObjC;
12
@class SSKProtoEnvelope;
13
@class SignalServiceAddress;
14
@class TSErrorMessageBuilder;
15
16
typedef NS_CLOSED_ENUM(int32_t, TSErrorMessageType) {
17
/// - Note This case is deprecated, but may be persisted in legacy messages.
18
TSErrorMessageNoSession,
19
/// - Note This case is deprecated, but may be persisted in legacy messages.
20
TSErrorMessageWrongTrustedIdentityKey,
21
/// - Note This case is deprecated, but may be persisted in legacy messages.
22
TSErrorMessageInvalidKeyException,
23
/// - Note This case is deprecated, but may be persisted in legacy messages.
24
TSErrorMessageMissingKeyId,
25
/// - Note This case is deprecated, but may be persisted in legacy messages.
26
TSErrorMessageInvalidMessage,
27
/// - Note This case is deprecated, but may be persisted in legacy messages.
28
TSErrorMessageDuplicateMessage,
29
/// - Note This case is deprecated, but may be persisted in legacy messages.
30
TSErrorMessageInvalidVersion,
31
/// Represents a "safety number change"; i.e, we learned that another user's
32
/// identity key has changed.
33
TSErrorMessageNonBlockingIdentityChange,
34
/// - Note This case is deprecated, but may be persisted in legacy messages.
35
TSErrorMessageUnknownContactBlockOffer,
36
/// - Note This case is deprecated, but may be persisted in legacy messages.
37
TSErrorMessageGroupCreationFailed,
38
/// Represents that we performed a legacy session-reset with another user
39
/// because a message from them failed to decrypt and the automatic retry
40
/// system is disabled.
41
/// - Important
42
/// The automatic "request resend of message that failed to decrypt" system
43
/// should mean that these are never used. However, since that system can
44
/// be disabled via remote config these messages remain relevant.
45
TSErrorMessageSessionRefresh,
46
/// Represents a message that has permanently failed to decrypt. For
47
/// example, this may represent a message for which we requested a resend
48
/// but didn't receive one in time.
49
TSErrorMessageDecryptionFailure,
50
};
51
52
extern NSUInteger TSErrorMessageSchemaVersion;
53
54
#pragma mark -
55
56
@interface TSErrorMessage : TSMessage <OWSReadTracking, OWSPreviewText>
57
58
- (instancetype)initMessageWithBuilder:(TSMessageBuilder *)messageBuilder NS_UNAVAILABLE;
59
60
- (instancetype)initWithGrdbId:(int64_t)grdbId
61
uniqueId:(NSString *)uniqueId
62
receivedAtTimestamp:(uint64_t)receivedAtTimestamp
63
sortId:(uint64_t)sortId
64
timestamp:(uint64_t)timestamp
65
uniqueThreadId:(NSString *)uniqueThreadId
66
body:(nullable NSString *)body
67
bodyRanges:(nullable MessageBodyRanges *)bodyRanges
68
contactShare:(nullable OWSContact *)contactShare
69
deprecated_attachmentIds:(nullable NSArray<NSString *> *)deprecated_attachmentIds
70
editState:(TSEditState)editState
71
expireStartedAt:(uint64_t)expireStartedAt
72
expireTimerVersion:(nullable NSNumber *)expireTimerVersion
73
expiresAt:(uint64_t)expiresAt
74
expiresInSeconds:(unsigned int)expiresInSeconds
75
giftBadge:(nullable OWSGiftBadge *)giftBadge
76
isGroupStoryReply:(BOOL)isGroupStoryReply
77
isPoll:(BOOL)isPoll
78
isSmsMessageRestoredFromBackup:(BOOL)isSmsMessageRestoredFromBackup
79
isViewOnceComplete:(BOOL)isViewOnceComplete
80
isViewOnceMessage:(BOOL)isViewOnceMessage
81
linkPreview:(nullable OWSLinkPreview *)linkPreview
82
messageSticker:(nullable MessageSticker *)messageSticker
83
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
84
storedShouldStartExpireTimer:(BOOL)storedShouldStartExpireTimer
85
storyAuthorUuidString:(nullable NSString *)storyAuthorUuidString
86
storyReactionEmoji:(nullable NSString *)storyReactionEmoji
87
storyTimestamp:(nullable NSNumber *)storyTimestamp
88
wasRemotelyDeleted:(BOOL)wasRemotelyDeleted NS_UNAVAILABLE;
89
90
- (instancetype)initErrorMessageWithBuilder:(TSErrorMessageBuilder *)errorMessageBuilder NS_DESIGNATED_INITIALIZER
91
NS_SWIFT_NAME(init(errorMessageWithBuilder:));
92
93
- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_UNAVAILABLE;
94
95
// --- CODE GENERATION MARKER
96
97
// This snippet is generated by /Scripts/sds_codegen/sds_generate.py. Do not manually edit it, instead run
98
// `sds_codegen.sh`.
99
100
// clang-format off
101
102
- (instancetype)initWithGrdbId:(int64_t)grdbId
103
uniqueId:(NSString *)uniqueId
104
receivedAtTimestamp:(uint64_t)receivedAtTimestamp
105
sortId:(uint64_t)sortId
106
timestamp:(uint64_t)timestamp
107
uniqueThreadId:(NSString *)uniqueThreadId
108
body:(nullable NSString *)body
109
bodyRanges:(nullable MessageBodyRanges *)bodyRanges
110
contactShare:(nullable OWSContact *)contactShare
111
deprecated_attachmentIds:(nullable NSArray<NSString *> *)deprecated_attachmentIds
112
editState:(TSEditState)editState
113
expireStartedAt:(uint64_t)expireStartedAt
114
expireTimerVersion:(nullable NSNumber *)expireTimerVersion
115
expiresAt:(uint64_t)expiresAt
116
expiresInSeconds:(unsigned int)expiresInSeconds
117
giftBadge:(nullable OWSGiftBadge *)giftBadge
118
isGroupStoryReply:(BOOL)isGroupStoryReply
119
isPoll:(BOOL)isPoll
120
isSmsMessageRestoredFromBackup:(BOOL)isSmsMessageRestoredFromBackup
121
isViewOnceComplete:(BOOL)isViewOnceComplete
122
isViewOnceMessage:(BOOL)isViewOnceMessage
123
linkPreview:(nullable OWSLinkPreview *)linkPreview
124
messageSticker:(nullable MessageSticker *)messageSticker
125
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
126
storedShouldStartExpireTimer:(BOOL)storedShouldStartExpireTimer
127
storyAuthorUuidString:(nullable NSString *)storyAuthorUuidString
128
storyReactionEmoji:(nullable NSString *)storyReactionEmoji
129
storyTimestamp:(nullable NSNumber *)storyTimestamp
130
wasRemotelyDeleted:(BOOL)wasRemotelyDeleted
131
errorType:(TSErrorMessageType)errorType
132
read:(BOOL)read
133
recipientAddress:(nullable SignalServiceAddress *)recipientAddress
134
sender:(nullable SignalServiceAddress *)sender
135
wasIdentityVerified:(BOOL)wasIdentityVerified
136
NS_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:));
137
138
// clang-format on
139
140
// --- CODE GENERATION MARKER
141
142
@property (nonatomic, readonly) TSErrorMessageType errorType;
143
@property (nullable, nonatomic, readonly) SignalServiceAddress *sender;
144
@property (nullable, nonatomic, readonly) SignalServiceAddress *recipientAddress;
145
146
// This property only applies if errorType == .nonBlockingIdentityChange.
147
@property (nonatomic, readonly) BOOL wasIdentityVerified;
148
149
@end
150
151
NS_ASSUME_NONNULL_END
152
153