Fix issues in UD send & receive.
This commit is contained in:
parent
0b41e5e240
commit
ccb67f49a3
|
@ -151,7 +151,9 @@ public class MessageFetcherJob: NSObject {
|
|||
throw ParamParser.ParseError.invalidFormat("sourceDevice")
|
||||
}
|
||||
|
||||
let builder = SSKProtoEnvelope.builder(type: type, source: source, sourceDevice: sourceDevice, timestamp: timestamp)
|
||||
let builder = SSKProtoEnvelope.builder(type: type, timestamp: timestamp)
|
||||
builder.setSource(source)
|
||||
builder.setSourceDevice(sourceDevice)
|
||||
|
||||
if let legacyMessage = try params.optionalBase64EncodedData(key: "message") {
|
||||
builder.setLegacyMessage(legacyMessage)
|
||||
|
@ -198,8 +200,16 @@ public class MessageFetcherJob: NSObject {
|
|||
}
|
||||
|
||||
private func acknowledgeDelivery(envelope: SSKProtoEnvelope) {
|
||||
let source = envelope.source
|
||||
let request = OWSRequestFactory.acknowledgeMessageDeliveryRequest(withSource: source, timestamp: envelope.timestamp)
|
||||
let request: TSRequest
|
||||
if let source = envelope.source {
|
||||
request = OWSRequestFactory.acknowledgeMessageDeliveryRequest(withSource: source, timestamp: envelope.timestamp)
|
||||
} else if let serverGuid = envelope.serverGuid, envelope.hasServerTimestamp {
|
||||
request = OWSRequestFactory.acknowledgeMessageDeliveryRequest(withServerGuid: serverGuid, serverTimestamp: envelope.serverTimestamp)
|
||||
} else {
|
||||
owsFailDebug("Cannot ACK message which has neither source, nor server GUID and timestamp.")
|
||||
return
|
||||
}
|
||||
|
||||
self.networkManager.makeRequest(request,
|
||||
success: { (_: URLSessionDataTask?, _: Any?) -> Void in
|
||||
Logger.debug("acknowledged delivery for message at timestamp: \(envelope.timestamp)")
|
||||
|
|
|
@ -3380,9 +3380,9 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
|
|||
}();
|
||||
|
||||
SSKProtoEnvelopeBuilder *envelopeBuilder = [SSKProtoEnvelope builderWithType:SSKProtoEnvelopeTypeCiphertext
|
||||
source:source
|
||||
sourceDevice:1
|
||||
timestamp:timestamp];
|
||||
[envelopeBuilder setSource:source];
|
||||
[envelopeBuilder setSourceDevice:1];
|
||||
NSError *error;
|
||||
SSKProtoEnvelope *_Nullable envelope = [envelopeBuilder buildAndReturnError:&error];
|
||||
if (error || !envelope) {
|
||||
|
@ -3901,8 +3901,9 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
|
|||
SSKProtoEnvelopeType envelopeType = SSKProtoEnvelopeTypeCiphertext;
|
||||
NSData *content = plaintextData;
|
||||
|
||||
SSKProtoEnvelopeBuilder *envelopeBuilder =
|
||||
[SSKProtoEnvelope builderWithType:envelopeType source:source sourceDevice:sourceDevice timestamp:timestamp];
|
||||
SSKProtoEnvelopeBuilder *envelopeBuilder = [SSKProtoEnvelope builderWithType:envelopeType timestamp:timestamp];
|
||||
[envelopeBuilder setSource:source];
|
||||
[envelopeBuilder setSourceDevice:sourceDevice];
|
||||
envelopeBuilder.content = content;
|
||||
NSError *error;
|
||||
NSData *_Nullable envelopeData = [envelopeBuilder buildSerializedDataAndReturnError:&error];
|
||||
|
|
|
@ -169,12 +169,10 @@ public class ProfileFetcherJob: NSObject {
|
|||
profileNameEncrypted: signalServiceProfile.profileNameEncrypted,
|
||||
avatarUrlPath: signalServiceProfile.avatarUrlPath)
|
||||
|
||||
let isUDRecipientId = signalServiceProfile.unidentifiedAccessKey != nil
|
||||
udManager.setIsUDRecipientId(signalServiceProfile.recipientId, isUDRecipientId: isUDRecipientId)
|
||||
|
||||
udManager.setShouldAllowUnrestrictedAccess(recipientId: signalServiceProfile.recipientId, shouldAllowUnrestrictedAccess: signalServiceProfile.hasUnrestrictedUnidentifiedAccess)
|
||||
if signalServiceProfile.unidentifiedAccessKey != nil {
|
||||
udManager.addUDRecipientId(signalServiceProfile.recipientId)
|
||||
} else {
|
||||
udManager.removeUDRecipientId(signalServiceProfile.recipientId)
|
||||
}
|
||||
}
|
||||
|
||||
private func verifyIdentityUpToDateAsync(recipientId: String, latestIdentityKey: Data) {
|
||||
|
|
|
@ -26,9 +26,7 @@ message Envelope {
|
|||
|
||||
// @required
|
||||
optional Type type = 1;
|
||||
// @required
|
||||
optional string source = 2;
|
||||
// @required
|
||||
optional uint32 sourceDevice = 7;
|
||||
optional string relay = 3;
|
||||
// @required
|
||||
|
|
|
@ -10,10 +10,20 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
@class SSKProtoEnvelope;
|
||||
@class YapDatabaseReadWriteTransaction;
|
||||
|
||||
@interface OWSMessageDecryptResult : NSObject
|
||||
|
||||
@property (nonatomic, readonly) NSData *envelopeData;
|
||||
@property (nonatomic, readonly, nullable) NSData *plaintextData;
|
||||
@property (nonatomic, readonly) NSString *source;
|
||||
@property (nonatomic, readonly) UInt32 sourceDevice;
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
// Decryption result includes the envelope since the envelope
|
||||
// may be altered by the decryption process.
|
||||
typedef void (^DecryptSuccessBlock)(
|
||||
NSData *envelopeData, NSData *_Nullable plaintextData, YapDatabaseReadWriteTransaction *transaction);
|
||||
typedef void (^DecryptSuccessBlock)(OWSMessageDecryptResult *result, YapDatabaseReadWriteTransaction *transaction);
|
||||
typedef void (^DecryptFailureBlock)(void);
|
||||
|
||||
@interface OWSMessageDecrypter : OWSMessageHandler
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#import "TSErrorMessage.h"
|
||||
#import "TSPreKeyManager.h"
|
||||
#import <AxolotlKit/AxolotlExceptions.h>
|
||||
#import <AxolotlKit/NSData+keyVersionByte.h>
|
||||
#import <AxolotlKit/SessionCipher.h>
|
||||
#import <SignalCoreKit/NSData+OWS.h>
|
||||
#import <SignalCoreKit/Randomness.h>
|
||||
|
@ -36,6 +37,42 @@ NSError *EnsureDecryptError(NSError *_Nullable error, NSString *fallbackErrorDes
|
|||
return OWSErrorWithCodeDescription(OWSErrorCodeFailedToDecryptUDMessage, fallbackErrorDescription);
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@interface OWSMessageDecryptResult ()
|
||||
|
||||
@property (nonatomic) NSData *envelopeData;
|
||||
@property (nonatomic, nullable) NSData *plaintextData;
|
||||
@property (nonatomic) NSString *source;
|
||||
@property (nonatomic) UInt32 sourceDevice;
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@implementation OWSMessageDecryptResult
|
||||
|
||||
+ (OWSMessageDecryptResult *)resultWithEnvelopeData:(NSData *)envelopeData
|
||||
plaintextData:(nullable NSData *)plaintextData
|
||||
source:(NSString *)source
|
||||
sourceDevice:(UInt32)sourceDevice
|
||||
{
|
||||
OWSAssertDebug(envelopeData);
|
||||
OWSAssertDebug(source.length > 0);
|
||||
OWSAssertDebug(sourceDevice > 0);
|
||||
|
||||
OWSMessageDecryptResult *result = [OWSMessageDecryptResult new];
|
||||
result.envelopeData = envelopeData;
|
||||
result.plaintextData = plaintextData;
|
||||
result.source = source;
|
||||
result.sourceDevice = sourceDevice;
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@interface OWSMessageDecrypter ()
|
||||
|
||||
@property (nonatomic, readonly) OWSPrimaryStorage *primaryStorage;
|
||||
|
@ -92,12 +129,12 @@ NSError *EnsureDecryptError(NSError *_Nullable error, NSString *fallbackErrorDes
|
|||
#pragma mark - Decryption
|
||||
|
||||
- (void)decryptEnvelope:(SSKProtoEnvelope *)envelope
|
||||
envelopeData:(NSData *)envelopeDataOriginal
|
||||
envelopeData:(NSData *)envelopeData
|
||||
successBlock:(DecryptSuccessBlock)successBlockParameter
|
||||
failureBlock:(DecryptFailureBlock)failureBlockParameter
|
||||
{
|
||||
OWSAssertDebug(envelope);
|
||||
OWSAssertDebug(envelopeDataOriginal);
|
||||
OWSAssertDebug(envelopeData);
|
||||
OWSAssertDebug(successBlockParameter);
|
||||
OWSAssertDebug(failureBlockParameter);
|
||||
OWSAssertDebug([TSAccountManager isRegistered]);
|
||||
|
@ -112,36 +149,35 @@ NSError *EnsureDecryptError(NSError *_Nullable error, NSString *fallbackErrorDes
|
|||
});
|
||||
};
|
||||
|
||||
DecryptSuccessBlock successBlock
|
||||
= ^(NSData *envelopeDataFinal, NSData *_Nullable plaintextData, YapDatabaseReadWriteTransaction *transaction) {
|
||||
// Having received a valid (decryptable) message from this user,
|
||||
// make note of the fact that they have a valid Signal account.
|
||||
[SignalRecipient markRecipientAsRegistered:envelope.source
|
||||
deviceId:envelope.sourceDevice
|
||||
transaction:transaction];
|
||||
DecryptSuccessBlock successBlock = ^(
|
||||
OWSMessageDecryptResult *result, YapDatabaseReadWriteTransaction *transaction) {
|
||||
// Having received a valid (decryptable) message from this user,
|
||||
// make note of the fact that they have a valid Signal account.
|
||||
[SignalRecipient markRecipientAsRegistered:result.source deviceId:result.sourceDevice transaction:transaction];
|
||||
|
||||
successBlockParameter(envelopeDataFinal, plaintextData, transaction);
|
||||
};
|
||||
successBlockParameter(result, transaction);
|
||||
};
|
||||
|
||||
@try {
|
||||
OWSLogInfo(@"decrypting envelope: %@", [self descriptionForEnvelope:envelope]);
|
||||
|
||||
OWSAssertDebug(envelope.source.length > 0);
|
||||
if ([self isEnvelopeSenderBlocked:envelope]) {
|
||||
OWSLogInfo(@"ignoring blocked envelope: %@", envelope.source);
|
||||
failureBlock();
|
||||
return;
|
||||
// We block UD messages later, after they are decrypted.
|
||||
if (envelope.type != SSKProtoEnvelopeTypeUnidentifiedSender) {
|
||||
OWSAssertDebug(envelope.source.length > 0);
|
||||
if ([self isEnvelopeSenderBlocked:envelope]) {
|
||||
OWSLogInfo(@"ignoring blocked envelope: %@", envelope.source);
|
||||
failureBlock();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (envelope.type) {
|
||||
case SSKProtoEnvelopeTypeCiphertext: {
|
||||
[self decryptSecureMessage:envelope
|
||||
envelopeData:envelopeDataOriginal
|
||||
successBlock:^(NSData *envelopeDataFinal,
|
||||
NSData *_Nullable plaintextData,
|
||||
YapDatabaseReadWriteTransaction *transaction) {
|
||||
envelopeData:envelopeData
|
||||
successBlock:^(OWSMessageDecryptResult *result, YapDatabaseReadWriteTransaction *transaction) {
|
||||
OWSLogDebug(@"decrypted secure message.");
|
||||
successBlock(envelopeDataFinal, plaintextData, transaction);
|
||||
successBlock(result, transaction);
|
||||
}
|
||||
failureBlock:^(NSError *_Nullable error) {
|
||||
OWSLogError(@"decrypting secure message from address: %@ failed with error: %@",
|
||||
|
@ -155,12 +191,10 @@ NSError *EnsureDecryptError(NSError *_Nullable error, NSString *fallbackErrorDes
|
|||
}
|
||||
case SSKProtoEnvelopeTypePrekeyBundle: {
|
||||
[self decryptPreKeyBundle:envelope
|
||||
envelopeData:envelopeDataOriginal
|
||||
successBlock:^(NSData *envelopeDataFinal,
|
||||
NSData *_Nullable plaintextData,
|
||||
YapDatabaseReadWriteTransaction *transaction) {
|
||||
envelopeData:envelopeData
|
||||
successBlock:^(OWSMessageDecryptResult *result, YapDatabaseReadWriteTransaction *transaction) {
|
||||
OWSLogDebug(@"decrypted pre-key whisper message");
|
||||
successBlock(envelopeDataFinal, plaintextData, transaction);
|
||||
successBlock(result, transaction);
|
||||
}
|
||||
failureBlock:^(NSError *_Nullable error) {
|
||||
OWSLogError(@"decrypting pre-key whisper message from address: %@ failed "
|
||||
|
@ -178,18 +212,21 @@ NSError *EnsureDecryptError(NSError *_Nullable error, NSString *fallbackErrorDes
|
|||
case SSKProtoEnvelopeTypeKeyExchange:
|
||||
case SSKProtoEnvelopeTypeUnknown: {
|
||||
[self.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
successBlock(envelopeDataOriginal, nil, transaction);
|
||||
OWSMessageDecryptResult *result =
|
||||
[OWSMessageDecryptResult resultWithEnvelopeData:envelopeData
|
||||
plaintextData:nil
|
||||
source:envelope.source
|
||||
sourceDevice:envelope.sourceDevice];
|
||||
successBlock(result, transaction);
|
||||
}];
|
||||
// Return to avoid double-acknowledging.
|
||||
return;
|
||||
}
|
||||
case SSKProtoEnvelopeTypeUnidentifiedSender: {
|
||||
[self decryptUnidentifiedSender:envelope
|
||||
successBlock:^(NSData *envelopeDataFinal,
|
||||
NSData *_Nullable plaintextData,
|
||||
YapDatabaseReadWriteTransaction *transaction) {
|
||||
successBlock:^(OWSMessageDecryptResult *result, YapDatabaseReadWriteTransaction *transaction) {
|
||||
OWSLogDebug(@"decrypted unidentified sender message");
|
||||
successBlock(envelopeDataFinal, plaintextData, transaction);
|
||||
successBlock(result, transaction);
|
||||
}
|
||||
failureBlock:^(NSError *_Nullable error) {
|
||||
OWSLogError(@"decrypting unidentified sender message from address: %@ failed "
|
||||
|
@ -303,13 +340,18 @@ NSError *EnsureDecryptError(NSError *_Nullable error, NSString *fallbackErrorDes
|
|||
// plaintextData may be nil for some envelope types.
|
||||
NSData *_Nullable plaintextData =
|
||||
[[cipher decrypt:cipherMessage protocolContext:transaction] removePadding];
|
||||
successBlock(envelopeData, plaintextData, transaction);
|
||||
OWSMessageDecryptResult *result =
|
||||
[OWSMessageDecryptResult resultWithEnvelopeData:envelopeData
|
||||
plaintextData:plaintextData
|
||||
source:envelope.source
|
||||
sourceDevice:envelope.sourceDevice];
|
||||
successBlock(result, transaction);
|
||||
} @catch (NSException *exception) {
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
[self processException:exception envelope:envelope];
|
||||
NSString *errorDescription = [NSString
|
||||
stringWithFormat:@"Exception while decrypting %@: %@", cipherTypeName, exception.description];
|
||||
OWSFailDebug(@"%@", errorDescription);
|
||||
OWSLogError(@"%@", errorDescription);
|
||||
NSError *error = OWSErrorWithCodeDescription(OWSErrorCodeFailedToDecryptMessage, errorDescription);
|
||||
failureBlock(error);
|
||||
});
|
||||
|
@ -339,7 +381,10 @@ NSError *EnsureDecryptError(NSError *_Nullable error, NSString *fallbackErrorDes
|
|||
|
||||
if (!envelope.hasServerTimestamp) {
|
||||
NSString *errorDescription = @"UD Envelope is missing server timestamp.";
|
||||
OWSFailDebug(@"%@", errorDescription);
|
||||
// TODO: We're seeing incoming UD envelopes without a server timestamp on staging.
|
||||
// Until this is fixed, disabling this assert.
|
||||
// OWSFailDebug(@"%@", errorDescription);
|
||||
OWSLogError(@"%@", errorDescription);
|
||||
NSError *error = OWSErrorWithCodeDescription(OWSErrorCodeFailedToDecryptUDMessage, errorDescription);
|
||||
return failureBlock(error);
|
||||
}
|
||||
|
@ -382,6 +427,14 @@ NSError *EnsureDecryptError(NSError *_Nullable error, NSString *fallbackErrorDes
|
|||
NSError *error = OWSErrorWithCodeDescription(OWSErrorCodeFailedToDecryptUDMessage, errorDescription);
|
||||
return failureBlock(error);
|
||||
}
|
||||
|
||||
if ([self.blockingManager.blockedPhoneNumbers containsObject:source]) {
|
||||
OWSLogInfo(@"ignoring blocked UD envelope: %@", envelope.source);
|
||||
NSError *error = OWSErrorWithCodeDescription(
|
||||
OWSErrorCodeFailedToDecryptUDMessage, @"ignoring blocked UD envelope");
|
||||
return failureBlock(error);
|
||||
}
|
||||
|
||||
long sourceDeviceId = decryptResult.senderDeviceId;
|
||||
if (sourceDeviceId < 1 || sourceDeviceId > UINT32_MAX) {
|
||||
NSString *errorDescription = @"Invalid UD sender device id.";
|
||||
|
@ -401,13 +454,17 @@ NSError *EnsureDecryptError(NSError *_Nullable error, NSString *fallbackErrorDes
|
|||
return failureBlock(error);
|
||||
}
|
||||
|
||||
successBlock(newEnvelopeData, plaintextData, transaction);
|
||||
OWSMessageDecryptResult *result = [OWSMessageDecryptResult resultWithEnvelopeData:newEnvelopeData
|
||||
plaintextData:plaintextData
|
||||
source:source
|
||||
sourceDevice:(uint32_t)sourceDeviceId];
|
||||
successBlock(result, transaction);
|
||||
} @catch (NSException *exception) {
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
[self processException:exception envelope:envelope];
|
||||
NSString *errorDescription =
|
||||
[NSString stringWithFormat:@"Exception while decrypting ud message: %@", exception.description];
|
||||
OWSFailDebug(@"%@", errorDescription);
|
||||
OWSLogError(@"%@", errorDescription);
|
||||
NSError *error = OWSErrorWithCodeDescription(OWSErrorCodeFailedToDecryptMessage, errorDescription);
|
||||
failureBlock(error);
|
||||
});
|
||||
|
@ -419,8 +476,9 @@ NSError *EnsureDecryptError(NSError *_Nullable error, NSString *fallbackErrorDes
|
|||
{
|
||||
NSData *_Nullable trustRootData = [NSData dataFromBase64String:kUDTrustRoot];
|
||||
OWSAssert(trustRootData);
|
||||
OWSAssert(trustRootData.length == ECCKeyLength + 1);
|
||||
NSError *error;
|
||||
ECPublicKey *_Nullable trustRoot = [[ECPublicKey alloc] initWithKeyData:trustRootData error:&error];
|
||||
ECPublicKey *_Nullable trustRoot = [[ECPublicKey alloc] initWithKeyData:[trustRootData removeKeyType] error:&error];
|
||||
if (error || !trustRoot) {
|
||||
// This exits.
|
||||
OWSFail(@"Invalid UD trust root.");
|
||||
|
|
|
@ -34,6 +34,8 @@ NSString *envelopeAddress(SSKProtoEnvelope *envelope)
|
|||
return @"KeyExchange";
|
||||
case SSKProtoEnvelopeTypePrekeyBundle:
|
||||
return @"PreKeyEncryptedMessage";
|
||||
case SSKProtoEnvelopeTypeUnidentifiedSender:
|
||||
return @"UnidentifiedSender";
|
||||
default:
|
||||
// Shouldn't happen
|
||||
OWSProdFail([OWSAnalyticsEvents messageManagerErrorEnvelopeTypeOther]);
|
||||
|
|
|
@ -219,6 +219,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
switch (envelope.type) {
|
||||
case SSKProtoEnvelopeTypeCiphertext:
|
||||
case SSKProtoEnvelopeTypePrekeyBundle:
|
||||
case SSKProtoEnvelopeTypeUnidentifiedSender:
|
||||
if (!plaintextData) {
|
||||
OWSFailDebug(@"missing decrypted data for envelope: %@", [self descriptionForEnvelope:envelope]);
|
||||
return;
|
||||
|
|
|
@ -72,7 +72,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
NSError *error;
|
||||
SSKProtoEnvelope *_Nullable envelope = [SSKProtoEnvelope parseData:self.envelopeData error:&error];
|
||||
if (error || envelope == nil) {
|
||||
OWSFailDebug(@"failed to parase envelope with error: %@", error);
|
||||
OWSFailDebug(@"failed to parse envelope with error: %@", error);
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
@ -358,8 +358,7 @@ NSString *const OWSMessageDecryptJobFinderExtensionGroup = @"OWSMessageProcessin
|
|||
|
||||
[self.messageDecrypter decryptEnvelope:envelope
|
||||
envelopeData:job.envelopeData
|
||||
successBlock:^(
|
||||
NSData *envelopeData, NSData *_Nullable plaintextData, YapDatabaseReadWriteTransaction *transaction) {
|
||||
successBlock:^(OWSMessageDecryptResult *result, YapDatabaseReadWriteTransaction *transaction) {
|
||||
OWSAssertDebug(transaction);
|
||||
|
||||
// We persist the decrypted envelope data in the same transaction within which
|
||||
|
@ -368,8 +367,8 @@ NSString *const OWSMessageDecryptJobFinderExtensionGroup = @"OWSMessageProcessin
|
|||
//
|
||||
// NOTE: We use envelopeData from the decrypt result, not job.envelopeData,
|
||||
// since the envelope may be altered by the decryption process in the UD case.
|
||||
[self.batchMessageProcessor enqueueEnvelopeData:envelopeData
|
||||
plaintextData:plaintextData
|
||||
[self.batchMessageProcessor enqueueEnvelopeData:result.envelopeData
|
||||
plaintextData:result.plaintextData
|
||||
transaction:transaction];
|
||||
|
||||
dispatch_async(self.serialQueue, ^{
|
||||
|
|
|
@ -882,6 +882,11 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
|
|||
messageSend.remainingAttempts = messageSend.remainingAttempts - 1;
|
||||
|
||||
BOOL isUDSend = (messageSend.canUseUD && messageSend.udAccessKey != nil && messageSend.senderCertificate != nil);
|
||||
OWSLogVerbose(@"isUDSend: %d, canUseUD: %d, udAccessKey: %d, senderCertificate: %d",
|
||||
isUDSend,
|
||||
messageSend.canUseUD,
|
||||
messageSend.udAccessKey != nil,
|
||||
messageSend.senderCertificate != nil);
|
||||
|
||||
NSError *deviceMessagesError;
|
||||
NSArray<NSDictionary *> *_Nullable deviceMessages =
|
||||
|
@ -1000,9 +1005,11 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
|
|||
//
|
||||
// TODO: Do we want to discriminate based on exact error?
|
||||
OWSLogDebug(@"UD send failed; failing over to non-UD send.");
|
||||
[self.udManager removeUDRecipientId:recipient.uniqueId];
|
||||
[self.udManager setIsUDRecipientId:recipient.uniqueId isUDRecipientId:NO];
|
||||
messageSend.canUseUD = NO;
|
||||
[self sendMessageToRecipient:messageSend success:successHandler failure:failureHandler];
|
||||
dispatch_async([OWSDispatch sendingQueue], ^{
|
||||
[self sendMessageToRecipient:messageSend success:successHandler failure:failureHandler];
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,11 +20,7 @@ public enum OWSUDError: Error {
|
|||
|
||||
@objc func isUDRecipientId(_ recipientId: String) -> Bool
|
||||
|
||||
// No-op if this recipient id is already marked as a "UD recipient".
|
||||
@objc func addUDRecipientId(_ recipientId: String)
|
||||
|
||||
// No-op if this recipient id is already marked as _NOT_ a "UD recipient".
|
||||
@objc func removeUDRecipientId(_ recipientId: String)
|
||||
@objc func setIsUDRecipientId(_ recipientId: String, isUDRecipientId: Bool)
|
||||
|
||||
// Returns the UD access key for a given recipient if they are
|
||||
// a UD recipient and we have a valid profile key for them.
|
||||
|
@ -104,13 +100,12 @@ public class OWSUDManagerImpl: NSObject, OWSUDManager {
|
|||
}
|
||||
|
||||
@objc
|
||||
public func addUDRecipientId(_ recipientId: String) {
|
||||
dbConnection.setBool(true, forKey: recipientId, inCollection: kUDRecipientModeCollection)
|
||||
}
|
||||
|
||||
@objc
|
||||
public func removeUDRecipientId(_ recipientId: String) {
|
||||
dbConnection.removeObject(forKey: recipientId, inCollection: kUDRecipientModeCollection)
|
||||
public func setIsUDRecipientId(_ recipientId: String, isUDRecipientId: Bool) {
|
||||
if isUDRecipientId {
|
||||
dbConnection.setBool(true, forKey: recipientId, inCollection: kUDRecipientModeCollection)
|
||||
} else {
|
||||
dbConnection.removeObject(forKey: recipientId, inCollection: kUDRecipientModeCollection)
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the UD access key for a given recipient if they are
|
||||
|
@ -122,7 +117,7 @@ public class OWSUDManagerImpl: NSObject, OWSUDManager {
|
|||
}
|
||||
guard let profileKey = profileManager.profileKeyData(forRecipientId: recipientId) else {
|
||||
// Mark as "not a UD recipient".
|
||||
removeUDRecipientId(recipientId)
|
||||
setIsUDRecipientId(recipientId, isUDRecipientId: false)
|
||||
return nil
|
||||
}
|
||||
do {
|
||||
|
@ -130,7 +125,7 @@ public class OWSUDManagerImpl: NSObject, OWSUDManager {
|
|||
return udAccessKey
|
||||
} catch {
|
||||
Logger.error("Could not determine udAccessKey: \(error)")
|
||||
removeUDRecipientId(recipientId)
|
||||
setIsUDRecipientId(recipientId, isUDRecipientId: false)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
// Suppress normal auth headers.
|
||||
self.shouldHaveAuthorizationHeaders = NO;
|
||||
// Add UD auth header.
|
||||
[self setValue:[udAccessKey.keyData base64EncodedString] forKey:@"Unidentified-Access-Key"];
|
||||
[self setValue:[udAccessKey.keyData base64EncodedString] forHTTPHeaderField:@"Unidentified-Access-Key"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -22,6 +22,9 @@ typedef NS_ENUM(NSUInteger, TSVerificationTransport) { TSVerificationTransportVo
|
|||
|
||||
+ (TSRequest *)acknowledgeMessageDeliveryRequestWithSource:(NSString *)source timestamp:(UInt64)timestamp;
|
||||
|
||||
+ (TSRequest *)acknowledgeMessageDeliveryRequestWithServerGuid:(NSString *)serverGuid
|
||||
serverTimestamp:(UInt64)serverTimestamp;
|
||||
|
||||
+ (TSRequest *)deleteDeviceRequestWithDevice:(OWSDevice *)device;
|
||||
|
||||
+ (TSRequest *)deviceProvisioningCodeRequest;
|
||||
|
|
|
@ -72,6 +72,17 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
return [TSRequest requestWithUrl:[NSURL URLWithString:path] method:@"DELETE" parameters:@{}];
|
||||
}
|
||||
|
||||
+ (TSRequest *)acknowledgeMessageDeliveryRequestWithServerGuid:(NSString *)serverGuid
|
||||
serverTimestamp:(UInt64)serverTimestamp
|
||||
{
|
||||
OWSAssertDebug(serverGuid.length > 0);
|
||||
OWSAssertDebug(serverTimestamp > 0);
|
||||
|
||||
NSString *path = [NSString stringWithFormat:@"v1/messages/%@/%llu", serverGuid, serverTimestamp];
|
||||
|
||||
return [TSRequest requestWithUrl:[NSURL URLWithString:path] method:@"DELETE" parameters:@{}];
|
||||
}
|
||||
|
||||
+ (TSRequest *)deleteDeviceRequestWithDevice:(OWSDevice *)device
|
||||
{
|
||||
OWSAssertDebug(device);
|
||||
|
|
|
@ -26,6 +26,4 @@
|
|||
method:(NSString *)method
|
||||
parameters:(nullable NSDictionary<NSString *, id> *)parameters;
|
||||
|
||||
- (void)setParameterWithValue:(id)value forKey:(NSString *)key;
|
||||
|
||||
@end
|
||||
|
|
|
@ -110,15 +110,4 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void)setParameterWithValue:(id)value forKey:(NSString *)key
|
||||
{
|
||||
OWSAssertDebug(value);
|
||||
OWSAssertDebug(key.length > 0);
|
||||
|
||||
NSMutableDictionary<NSString *, id> *parameters
|
||||
= (self.parameters ? [self.parameters mutableCopy] : [NSMutableDictionary new]);
|
||||
parameters[key] = value;
|
||||
_parameters = [parameters copy];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -49,13 +49,19 @@ public enum SSKProtoError: Error {
|
|||
|
||||
// MARK: - SSKProtoEnvelopeBuilder
|
||||
|
||||
@objc public class func builder(type: SSKProtoEnvelopeType, source: String, sourceDevice: UInt32, timestamp: UInt64) -> SSKProtoEnvelopeBuilder {
|
||||
return SSKProtoEnvelopeBuilder(type: type, source: source, sourceDevice: sourceDevice, timestamp: timestamp)
|
||||
@objc public class func builder(type: SSKProtoEnvelopeType, timestamp: UInt64) -> SSKProtoEnvelopeBuilder {
|
||||
return SSKProtoEnvelopeBuilder(type: type, timestamp: timestamp)
|
||||
}
|
||||
|
||||
// asBuilder() constructs a builder that reflects the proto's contents.
|
||||
@objc public func asBuilder() -> SSKProtoEnvelopeBuilder {
|
||||
let builder = SSKProtoEnvelopeBuilder(type: type, source: source, sourceDevice: sourceDevice, timestamp: timestamp)
|
||||
let builder = SSKProtoEnvelopeBuilder(type: type, timestamp: timestamp)
|
||||
if let _value = source {
|
||||
builder.setSource(_value)
|
||||
}
|
||||
if hasSourceDevice {
|
||||
builder.setSourceDevice(sourceDevice)
|
||||
}
|
||||
if let _value = relay {
|
||||
builder.setRelay(_value)
|
||||
}
|
||||
|
@ -80,12 +86,10 @@ public enum SSKProtoError: Error {
|
|||
|
||||
@objc fileprivate override init() {}
|
||||
|
||||
@objc fileprivate init(type: SSKProtoEnvelopeType, source: String, sourceDevice: UInt32, timestamp: UInt64) {
|
||||
@objc fileprivate init(type: SSKProtoEnvelopeType, timestamp: UInt64) {
|
||||
super.init()
|
||||
|
||||
setType(type)
|
||||
setSource(source)
|
||||
setSourceDevice(sourceDevice)
|
||||
setTimestamp(timestamp)
|
||||
}
|
||||
|
||||
|
@ -138,12 +142,25 @@ public enum SSKProtoError: Error {
|
|||
|
||||
@objc public let type: SSKProtoEnvelopeType
|
||||
|
||||
@objc public let source: String
|
||||
|
||||
@objc public let sourceDevice: UInt32
|
||||
|
||||
@objc public let timestamp: UInt64
|
||||
|
||||
@objc public var source: String? {
|
||||
guard proto.hasSource else {
|
||||
return nil
|
||||
}
|
||||
return proto.source
|
||||
}
|
||||
@objc public var hasSource: Bool {
|
||||
return proto.hasSource
|
||||
}
|
||||
|
||||
@objc public var sourceDevice: UInt32 {
|
||||
return proto.sourceDevice
|
||||
}
|
||||
@objc public var hasSourceDevice: Bool {
|
||||
return proto.hasSourceDevice
|
||||
}
|
||||
|
||||
@objc public var relay: String? {
|
||||
guard proto.hasRelay else {
|
||||
return nil
|
||||
|
@ -193,13 +210,9 @@ public enum SSKProtoError: Error {
|
|||
|
||||
private init(proto: SignalServiceProtos_Envelope,
|
||||
type: SSKProtoEnvelopeType,
|
||||
source: String,
|
||||
sourceDevice: UInt32,
|
||||
timestamp: UInt64) {
|
||||
self.proto = proto
|
||||
self.type = type
|
||||
self.source = source
|
||||
self.sourceDevice = sourceDevice
|
||||
self.timestamp = timestamp
|
||||
}
|
||||
|
||||
|
@ -219,16 +232,6 @@ public enum SSKProtoError: Error {
|
|||
}
|
||||
let type = SSKProtoEnvelopeTypeWrap(proto.type)
|
||||
|
||||
guard proto.hasSource else {
|
||||
throw SSKProtoError.invalidProtobuf(description: "\(logTag) missing required field: source")
|
||||
}
|
||||
let source = proto.source
|
||||
|
||||
guard proto.hasSourceDevice else {
|
||||
throw SSKProtoError.invalidProtobuf(description: "\(logTag) missing required field: sourceDevice")
|
||||
}
|
||||
let sourceDevice = proto.sourceDevice
|
||||
|
||||
guard proto.hasTimestamp else {
|
||||
throw SSKProtoError.invalidProtobuf(description: "\(logTag) missing required field: timestamp")
|
||||
}
|
||||
|
@ -240,8 +243,6 @@ public enum SSKProtoError: Error {
|
|||
|
||||
let result = SSKProtoEnvelope(proto: proto,
|
||||
type: type,
|
||||
source: source,
|
||||
sourceDevice: sourceDevice,
|
||||
timestamp: timestamp)
|
||||
return result
|
||||
}
|
||||
|
@ -366,27 +367,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)
|
||||
}
|
||||
|
@ -1085,12 +1086,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)
|
||||
}
|
||||
|
@ -1098,12 +1099,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)
|
||||
}
|
||||
|
@ -1263,7 +1264,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)
|
||||
}
|
||||
|
@ -2229,7 +2230,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)
|
||||
}
|
||||
|
@ -2392,7 +2393,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)
|
||||
}
|
||||
|
@ -2406,7 +2407,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)
|
||||
}
|
||||
|
@ -2644,12 +2645,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)
|
||||
}
|
||||
|
@ -3174,7 +3175,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)
|
||||
}
|
||||
|
@ -3371,7 +3372,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)
|
||||
}
|
||||
|
@ -3980,22 +3981,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)
|
||||
}
|
||||
|
@ -4003,17 +4004,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)
|
||||
}
|
||||
|
@ -4457,7 +4458,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)
|
||||
}
|
||||
|
@ -4762,12 +4763,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)
|
||||
}
|
||||
|
@ -5073,7 +5074,7 @@ extension SSKProtoGroupDetailsAvatar.SSKProtoGroupDetailsAvatarBuilder {
|
|||
}
|
||||
let id = proto.id
|
||||
|
||||
var avatar: SSKProtoGroupDetailsAvatar? = nil
|
||||
var avatar: SSKProtoGroupDetailsAvatar?
|
||||
if proto.hasAvatar {
|
||||
avatar = try SSKProtoGroupDetailsAvatar.parseProto(proto.avatar)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
@ -42,7 +38,6 @@ struct SignalServiceProtos_Envelope {
|
|||
/// Clears the value of `type`. Subsequent reads from it will return its default value.
|
||||
mutating func clearType() {self._type = nil}
|
||||
|
||||
/// @required
|
||||
var source: String {
|
||||
get {return _source ?? String()}
|
||||
set {_source = newValue}
|
||||
|
@ -52,7 +47,6 @@ struct SignalServiceProtos_Envelope {
|
|||
/// Clears the value of `source`. Subsequent reads from it will return its default value.
|
||||
mutating func clearSource() {self._source = nil}
|
||||
|
||||
/// @required
|
||||
var sourceDevice: UInt32 {
|
||||
get {return _sourceDevice ?? 0}
|
||||
set {_sourceDevice = newValue}
|
||||
|
@ -163,15 +157,15 @@ 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 _serverGuid: String? = nil
|
||||
fileprivate var _serverTimestamp: UInt64? = 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?
|
||||
fileprivate var _serverGuid: String?
|
||||
fileprivate var _serverTimestamp: UInt64?
|
||||
}
|
||||
|
||||
#if swift(>=4.2)
|
||||
|
@ -329,8 +323,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 {
|
||||
|
@ -364,8 +358,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 {
|
||||
|
@ -417,10 +411,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 {
|
||||
|
@ -442,7 +436,7 @@ struct SignalServiceProtos_CallMessage {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _id: UInt64? = nil
|
||||
fileprivate var _id: UInt64?
|
||||
}
|
||||
|
||||
struct Hangup {
|
||||
|
@ -464,7 +458,7 @@ struct SignalServiceProtos_CallMessage {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _id: UInt64? = nil
|
||||
fileprivate var _id: UInt64?
|
||||
}
|
||||
|
||||
init() {}
|
||||
|
@ -692,9 +686,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 {
|
||||
|
@ -809,12 +803,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 {
|
||||
|
@ -885,9 +879,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 {
|
||||
|
@ -958,9 +952,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 {
|
||||
|
@ -1082,15 +1076,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 {
|
||||
|
@ -1159,7 +1153,7 @@ struct SignalServiceProtos_NullMessage {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _padding: Data? = nil
|
||||
fileprivate var _padding: Data?
|
||||
}
|
||||
|
||||
struct SignalServiceProtos_ReceiptMessage {
|
||||
|
@ -1209,7 +1203,7 @@ struct SignalServiceProtos_ReceiptMessage {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _type: SignalServiceProtos_ReceiptMessage.TypeEnum? = nil
|
||||
fileprivate var _type: SignalServiceProtos_ReceiptMessage.TypeEnum?
|
||||
}
|
||||
|
||||
#if swift(>=4.2)
|
||||
|
@ -1295,10 +1289,10 @@ 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)
|
||||
|
@ -1562,7 +1556,7 @@ struct SignalServiceProtos_SyncMessage {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _type: SignalServiceProtos_SyncMessage.Request.TypeEnum? = nil
|
||||
fileprivate var _type: SignalServiceProtos_SyncMessage.Request.TypeEnum?
|
||||
}
|
||||
|
||||
struct Read {
|
||||
|
@ -1594,8 +1588,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 {
|
||||
|
@ -1616,7 +1610,7 @@ struct SignalServiceProtos_SyncMessage {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _readReceipts: Bool? = nil
|
||||
fileprivate var _readReceipts: Bool?
|
||||
}
|
||||
|
||||
init() {}
|
||||
|
@ -1747,16 +1741,16 @@ 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)
|
||||
|
@ -1972,8 +1966,8 @@ struct SignalServiceProtos_ContactDetails {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _contentType: String? = nil
|
||||
fileprivate var _length: UInt32? = nil
|
||||
fileprivate var _contentType: String?
|
||||
fileprivate var _length: UInt32?
|
||||
}
|
||||
|
||||
init() {}
|
||||
|
@ -2084,8 +2078,8 @@ struct SignalServiceProtos_GroupDetails {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _contentType: String? = nil
|
||||
fileprivate var _length: UInt32? = nil
|
||||
fileprivate var _contentType: String?
|
||||
fileprivate var _length: UInt32?
|
||||
}
|
||||
|
||||
init() {}
|
||||
|
@ -2095,7 +2089,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"
|
||||
|
@ -2108,7 +2102,7 @@ extension SignalServiceProtos_Envelope: SwiftProtobuf.Message, SwiftProtobuf._Me
|
|||
6: .same(proto: "legacyMessage"),
|
||||
8: .same(proto: "content"),
|
||||
9: .same(proto: "serverGuid"),
|
||||
10: .same(proto: "serverTimestamp"),
|
||||
10: .same(proto: "serverTimestamp")
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
@ -2181,7 +2175,7 @@ extension SignalServiceProtos_Envelope.TypeEnum: SwiftProtobuf._ProtoNameProvidi
|
|||
2: .same(proto: "KEY_EXCHANGE"),
|
||||
3: .same(proto: "PREKEY_BUNDLE"),
|
||||
5: .same(proto: "RECEIPT"),
|
||||
6: .same(proto: "UNIDENTIFIED_SENDER"),
|
||||
6: .same(proto: "UNIDENTIFIED_SENDER")
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -2192,15 +2186,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()
|
||||
|
||||
|
@ -2286,16 +2280,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()
|
||||
|
||||
|
@ -2383,7 +2377,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 {
|
||||
|
@ -2418,7 +2412,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 {
|
||||
|
@ -2455,7 +2449,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 {
|
||||
|
@ -2499,7 +2493,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 {
|
||||
|
@ -2528,7 +2522,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 {
|
||||
|
@ -2565,18 +2559,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()
|
||||
|
@ -2683,7 +2677,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")
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -2693,7 +2687,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 {
|
||||
|
@ -2740,14 +2734,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()
|
||||
|
||||
|
@ -2821,7 +2815,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")
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -2833,16 +2827,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()
|
||||
|
||||
|
@ -2934,7 +2928,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 {
|
||||
|
@ -2990,7 +2984,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 {
|
||||
|
@ -3031,7 +3025,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")
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -3040,7 +3034,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 {
|
||||
|
@ -3081,7 +3075,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")
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -3096,7 +3090,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 {
|
||||
|
@ -3166,7 +3160,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")
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -3174,12 +3168,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()
|
||||
|
||||
|
@ -3242,7 +3236,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 {
|
||||
|
@ -3272,7 +3266,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 {
|
||||
|
@ -3306,7 +3300,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")
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -3316,7 +3310,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 {
|
||||
|
@ -3361,7 +3355,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")
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -3376,19 +3370,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()
|
||||
|
||||
|
@ -3496,14 +3490,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()
|
||||
|
||||
|
@ -3579,12 +3573,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()
|
||||
|
||||
|
@ -3647,11 +3641,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()
|
||||
|
||||
|
@ -3709,7 +3703,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 {
|
||||
|
@ -3743,7 +3737,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 {
|
||||
|
@ -3775,7 +3769,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")
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -3783,7 +3777,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 {
|
||||
|
@ -3817,7 +3811,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 {
|
||||
|
@ -3855,7 +3849,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 {
|
||||
|
@ -3928,7 +3922,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")
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -3939,15 +3933,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()
|
||||
|
||||
|
@ -4031,7 +4025,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")
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -4045,18 +4039,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()
|
||||
|
||||
|
@ -4156,7 +4150,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 {
|
||||
|
@ -4197,18 +4191,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()
|
||||
|
||||
|
@ -4308,7 +4302,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 {
|
||||
|
|
|
@ -1,100 +0,0 @@
|
|||
//
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import SignalMetadataKit
|
||||
|
||||
#if DEBUG
|
||||
|
||||
@objc
|
||||
public class OWSFakeUDManager: NSObject, OWSUDManager {
|
||||
|
||||
@objc public func setup() {}
|
||||
|
||||
// MARK: - Recipient state
|
||||
|
||||
private var udRecipientSet = Set<String>()
|
||||
|
||||
@objc
|
||||
public func isUDRecipientId(_ recipientId: String) -> Bool {
|
||||
return udRecipientSet.contains(recipientId)
|
||||
}
|
||||
|
||||
@objc
|
||||
public func addUDRecipientId(_ recipientId: String) {
|
||||
udRecipientSet.insert(recipientId)
|
||||
}
|
||||
|
||||
@objc
|
||||
public func removeUDRecipientId(_ recipientId: String) {
|
||||
udRecipientSet.remove(recipientId)
|
||||
}
|
||||
|
||||
// Returns the UD access key for a given recipient if they are
|
||||
// a UD recipient and we have a valid profile key for them.
|
||||
@objc
|
||||
public func udAccessKeyForRecipient(_ recipientId: String) -> SMKUDAccessKey? {
|
||||
guard isUDRecipientId(recipientId) else {
|
||||
return nil
|
||||
}
|
||||
guard let profileKey = Randomness.generateRandomBytes(Int32(kAES256_KeyByteLength)) else {
|
||||
// Mark as "not a UD recipient".
|
||||
removeUDRecipientId(recipientId)
|
||||
return nil
|
||||
}
|
||||
do {
|
||||
let udAccessKey = try SMKUDAccessKey(profileKey: profileKey)
|
||||
return udAccessKey
|
||||
} catch {
|
||||
Logger.error("Could not determine udAccessKey: \(error)")
|
||||
removeUDRecipientId(recipientId)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Server Certificate
|
||||
|
||||
// Tests can control the behavior of this mock by setting this property.
|
||||
@objc public var nextSenderCertificate: SMKSenderCertificate?
|
||||
|
||||
@objc public func ensureSenderCertificateObjC(success:@escaping (SMKSenderCertificate) -> Void,
|
||||
failure:@escaping (Error) -> Void) {
|
||||
guard let certificate = nextSenderCertificate else {
|
||||
failure(OWSUDError.assertionError(description: "No mock server certificate"))
|
||||
return
|
||||
}
|
||||
success(certificate)
|
||||
}
|
||||
|
||||
// MARK: - Unrestricted Access
|
||||
|
||||
private var _shouldAllowUnrestrictedAccessLocal = false
|
||||
private var _shouldAllowUnrestrictedAccessSet = Set<String>()
|
||||
|
||||
@objc
|
||||
public func shouldAllowUnrestrictedAccessLocal() -> Bool {
|
||||
return _shouldAllowUnrestrictedAccessLocal
|
||||
}
|
||||
|
||||
@objc
|
||||
public func setShouldAllowUnrestrictedAccessLocal(_ value: Bool) {
|
||||
_shouldAllowUnrestrictedAccessLocal = value
|
||||
}
|
||||
|
||||
@objc
|
||||
public func shouldAllowUnrestrictedAccess(recipientId: String) -> Bool {
|
||||
return _shouldAllowUnrestrictedAccessSet.contains(recipientId)
|
||||
}
|
||||
|
||||
@objc
|
||||
public func setShouldAllowUnrestrictedAccess(recipientId: String, shouldAllowUnrestrictedAccess: Bool) {
|
||||
if shouldAllowUnrestrictedAccess {
|
||||
_shouldAllowUnrestrictedAccessSet.insert(recipientId)
|
||||
} else {
|
||||
_shouldAllowUnrestrictedAccessSet.remove(recipientId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue