mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Add -Werror
This commit is contained in:
parent
80380d26aa
commit
c058550feb
@ -7,6 +7,9 @@ objc_library(
|
||||
"Sources/**/*.m",
|
||||
"Sources/**/*.h",
|
||||
]),
|
||||
copts = [
|
||||
"-Werror",
|
||||
],
|
||||
hdrs = glob([
|
||||
"PublicHeaders/**/*.h",
|
||||
]),
|
||||
|
@ -33,13 +33,13 @@
|
||||
|
||||
@interface MTSocksProxySettings : NSObject
|
||||
|
||||
@property (nonatomic, strong, readonly) NSString *ip;
|
||||
@property (nonatomic, strong, readonly) NSString * _Nonnull ip;
|
||||
@property (nonatomic, readonly) uint16_t port;
|
||||
@property (nonatomic, strong, readonly) NSString *username;
|
||||
@property (nonatomic, strong, readonly) NSString *password;
|
||||
@property (nonatomic, strong, readonly) NSData *secret;
|
||||
@property (nonatomic, strong, readonly) NSString * _Nullable username;
|
||||
@property (nonatomic, strong, readonly) NSString * _Nullable password;
|
||||
@property (nonatomic, strong, readonly) NSData * _Nullable secret;
|
||||
|
||||
- (instancetype)initWithIp:(NSString *)ip port:(uint16_t)port username:(NSString *)username password:(NSString *)password secret:(NSData *)secret;
|
||||
- (instancetype _Nonnull)initWithIp:(NSString * _Nonnull )ip port:(uint16_t)port username:(NSString * _Nullable)username password:(NSString * _Nullable)password secret:(NSData * _Nullable)secret;
|
||||
|
||||
@end
|
||||
|
||||
@ -47,38 +47,38 @@
|
||||
|
||||
@property (nonatomic, readonly) bool reducedBackupDiscoveryTimeout;
|
||||
|
||||
- (instancetype)initWithReducedBackupDiscoveryTimeout:(bool)reducedBackupDiscoveryTimeout;
|
||||
- (instancetype _Nonnull)initWithReducedBackupDiscoveryTimeout:(bool)reducedBackupDiscoveryTimeout;
|
||||
|
||||
@end
|
||||
|
||||
@interface MTApiEnvironment : NSObject
|
||||
|
||||
@property (nonatomic) int32_t apiId;
|
||||
@property (nonatomic, strong, readonly) NSString *deviceModel;
|
||||
@property (nonatomic, strong, readonly) NSString *systemVersion;
|
||||
@property (nonatomic, strong) NSString *appVersion;
|
||||
@property (nonatomic, strong, readonly) NSString *systemLangCode;
|
||||
@property (nonatomic, strong) NSNumber *layer;
|
||||
@property (nonatomic, strong, readonly) NSData *systemCode;
|
||||
@property (nonatomic, strong, readonly) NSString * _Nullable deviceModel;
|
||||
@property (nonatomic, strong, readonly) NSString * _Nullable systemVersion;
|
||||
@property (nonatomic, strong) NSString * _Nullable appVersion;
|
||||
@property (nonatomic, strong, readonly) NSString * _Nullable systemLangCode;
|
||||
@property (nonatomic, strong) NSNumber * _Nullable layer;
|
||||
@property (nonatomic, strong, readonly) NSData * _Nullable systemCode;
|
||||
|
||||
@property (nonatomic, strong) NSString *langPack;
|
||||
@property (nonatomic, strong, readonly) NSString *langPackCode;
|
||||
@property (nonatomic, strong) NSString * _Nullable langPack;
|
||||
@property (nonatomic, strong, readonly) NSString * _Nullable langPackCode;
|
||||
|
||||
@property (nonatomic, strong, readonly) NSString *apiInitializationHash;
|
||||
@property (nonatomic, strong, readonly) NSString * _Nullable apiInitializationHash;
|
||||
|
||||
@property (nonatomic) bool disableUpdates;
|
||||
@property (nonatomic) NSData *tcpPayloadPrefix;
|
||||
@property (nonatomic) NSDictionary *datacenterAddressOverrides;
|
||||
@property (nonatomic) NSString *accessHostOverride;
|
||||
@property (nonatomic) NSData * _Nullable tcpPayloadPrefix;
|
||||
@property (nonatomic) NSDictionary * _Nullable datacenterAddressOverrides;
|
||||
@property (nonatomic) NSString * _Nullable accessHostOverride;
|
||||
|
||||
@property (nonatomic, strong, readonly) MTSocksProxySettings *socksProxySettings;
|
||||
@property (nonatomic, strong, readonly) MTNetworkSettings *networkSettings;
|
||||
@property (nonatomic, strong, readonly) MTSocksProxySettings * _Nullable socksProxySettings;
|
||||
@property (nonatomic, strong, readonly) MTNetworkSettings * _Nullable networkSettings;
|
||||
|
||||
@property (nonatomic, copy) void (^passwordInputHandler)(void);
|
||||
@property (nonatomic, copy) void (^ _Nullable passwordInputHandler)(void);
|
||||
|
||||
- (MTApiEnvironment *)withUpdatedLangPackCode:(NSString *)langPackCode;
|
||||
- (MTApiEnvironment *)withUpdatedSocksProxySettings:(MTSocksProxySettings *)socksProxySettings;
|
||||
- (MTApiEnvironment *)withUpdatedNetworkSettings:(MTNetworkSettings *)networkSettings;
|
||||
- (MTApiEnvironment *)withUpdatedSystemCode:(NSData *)systemCode;
|
||||
- (MTApiEnvironment * _Nonnull)withUpdatedLangPackCode:(NSString * _Nullable)langPackCode;
|
||||
- (MTApiEnvironment * _Nonnull)withUpdatedSocksProxySettings:(MTSocksProxySettings * _Nullable)socksProxySettings;
|
||||
- (MTApiEnvironment * _Nonnull)withUpdatedNetworkSettings:(MTNetworkSettings * _Nullable)networkSettings;
|
||||
- (MTApiEnvironment * _Nonnull)withUpdatedSystemCode:(NSData * _Nullable)systemCode;
|
||||
|
||||
@end
|
||||
|
@ -19,34 +19,34 @@
|
||||
|
||||
@optional
|
||||
|
||||
- (void)contextDatacenterAddressSetUpdated:(MTContext *)context datacenterId:(NSInteger)datacenterId addressSet:(MTDatacenterAddressSet *)addressSet;
|
||||
- (void)contextDatacenterAuthInfoUpdated:(MTContext *)context datacenterId:(NSInteger)datacenterId authInfo:(MTDatacenterAuthInfo *)authInfo selector:(MTDatacenterAuthInfoSelector)selector;
|
||||
- (void)contextDatacenterAuthTokenUpdated:(MTContext *)context datacenterId:(NSInteger)datacenterId authToken:(id)authToken;
|
||||
- (void)contextDatacenterTransportSchemesUpdated:(MTContext *)context datacenterId:(NSInteger)datacenterId shouldReset:(bool)shouldReset;
|
||||
- (void)contextIsPasswordRequiredUpdated:(MTContext *)context datacenterId:(NSInteger)datacenterId;
|
||||
- (void)contextDatacenterPublicKeysUpdated:(MTContext *)context datacenterId:(NSInteger)datacenterId publicKeys:(NSArray<NSDictionary *> *)publicKeys;
|
||||
- (MTSignal *)fetchContextDatacenterPublicKeys:(MTContext *)context datacenterId:(NSInteger)datacenterId;
|
||||
- (void)contextApiEnvironmentUpdated:(MTContext *)context apiEnvironment:(MTApiEnvironment *)apiEnvironment;
|
||||
- (MTSignal *)isContextNetworkAccessAllowed:(MTContext *)context;
|
||||
- (void)contextLoggedOut:(MTContext *)context;
|
||||
- (void)contextDatacenterAddressSetUpdated:(MTContext * _Nonnull)context datacenterId:(NSInteger)datacenterId addressSet:(MTDatacenterAddressSet * _Nonnull)addressSet;
|
||||
- (void)contextDatacenterAuthInfoUpdated:(MTContext * _Nonnull)context datacenterId:(NSInteger)datacenterId authInfo:(MTDatacenterAuthInfo * _Nonnull)authInfo selector:(MTDatacenterAuthInfoSelector)selector;
|
||||
- (void)contextDatacenterAuthTokenUpdated:(MTContext * _Nonnull)context datacenterId:(NSInteger)datacenterId authToken:(id _Nullable)authToken;
|
||||
- (void)contextDatacenterTransportSchemesUpdated:(MTContext * _Nonnull)context datacenterId:(NSInteger)datacenterId shouldReset:(bool)shouldReset;
|
||||
- (void)contextIsPasswordRequiredUpdated:(MTContext * _Nonnull)context datacenterId:(NSInteger)datacenterId;
|
||||
- (void)contextDatacenterPublicKeysUpdated:(MTContext * _Nonnull)context datacenterId:(NSInteger)datacenterId publicKeys:(NSArray<NSDictionary *> * _Nonnull)publicKeys;
|
||||
- (MTSignal * _Nonnull)fetchContextDatacenterPublicKeys:(MTContext * _Nonnull)context datacenterId:(NSInteger)datacenterId;
|
||||
- (void)contextApiEnvironmentUpdated:(MTContext * _Nonnull)context apiEnvironment:(MTApiEnvironment * _Nonnull)apiEnvironment;
|
||||
- (MTSignal * _Nonnull)isContextNetworkAccessAllowed:(MTContext * _Nonnull)context;
|
||||
- (void)contextLoggedOut:(MTContext * _Nonnull)context;
|
||||
|
||||
@end
|
||||
|
||||
@interface MTContextBlockChangeListener : NSObject <MTContextChangeListener>
|
||||
|
||||
@property (nonatomic, copy) void (^contextIsPasswordRequiredUpdated)(MTContext *, NSInteger);
|
||||
@property (nonatomic, copy) MTSignal *(^fetchContextDatacenterPublicKeys)(MTContext *, NSInteger);
|
||||
@property (nonatomic, copy) MTSignal *(^isContextNetworkAccessAllowed)(MTContext *);
|
||||
@property (nonatomic, copy) void (^ _Nullable contextIsPasswordRequiredUpdated)(MTContext * _Nonnull, NSInteger);
|
||||
@property (nonatomic, copy) MTSignal * _Nonnull (^ _Nullable fetchContextDatacenterPublicKeys)(MTContext * _Nonnull, NSInteger);
|
||||
@property (nonatomic, copy) MTSignal * _Nonnull(^ _Nullable isContextNetworkAccessAllowed)(MTContext * _Nonnull);
|
||||
|
||||
@end
|
||||
|
||||
@interface MTContext : NSObject
|
||||
|
||||
@property (nonatomic, strong) id<MTKeychain> keychain;
|
||||
@property (nonatomic, strong) id<MTKeychain> _Nonnull keychain;
|
||||
|
||||
@property (nonatomic, strong, readonly) id<MTSerialization> serialization;
|
||||
@property (nonatomic, strong) id<EncryptionProvider> encryptionProvider;
|
||||
@property (nonatomic, strong, readonly) MTApiEnvironment *apiEnvironment;
|
||||
@property (nonatomic, strong, readonly) id<MTSerialization> _Nonnull serialization;
|
||||
@property (nonatomic, strong) id<EncryptionProvider> _Nonnull encryptionProvider;
|
||||
@property (nonatomic, strong, readonly) MTApiEnvironment * _Nonnull apiEnvironment;
|
||||
@property (nonatomic, readonly) bool isTestingEnvironment;
|
||||
@property (nonatomic, readonly) bool useTempAuthKeys;
|
||||
@property (nonatomic) int32_t tempKeyExpiration;
|
||||
@ -54,66 +54,66 @@
|
||||
+ (int32_t)fixedTimeDifference;
|
||||
+ (void)setFixedTimeDifference:(int32_t)fixedTimeDifference;
|
||||
|
||||
+ (MTQueue *)contextQueue;
|
||||
+ (MTQueue * _Nonnull)contextQueue;
|
||||
|
||||
- (instancetype)initWithSerialization:(id<MTSerialization>)serialization encryptionProvider:(id<EncryptionProvider>)encryptionProvider apiEnvironment:(MTApiEnvironment *)apiEnvironment isTestingEnvironment:(bool)isTestingEnvironment useTempAuthKeys:(bool)useTempAuthKeys;
|
||||
- (instancetype _Nonnull)initWithSerialization:(id<MTSerialization> _Nonnull)serialization encryptionProvider:(id<EncryptionProvider> _Nonnull)encryptionProvider apiEnvironment:(MTApiEnvironment * _Nonnull)apiEnvironment isTestingEnvironment:(bool)isTestingEnvironment useTempAuthKeys:(bool)useTempAuthKeys;
|
||||
|
||||
- (void)performBatchUpdates:(void (^)())block;
|
||||
- (void)performBatchUpdates:(void (^ _Nonnull)())block;
|
||||
|
||||
- (void)addChangeListener:(id<MTContextChangeListener>)changeListener;
|
||||
- (void)removeChangeListener:(id<MTContextChangeListener>)changeListener;
|
||||
- (void)addChangeListener:(id<MTContextChangeListener> _Nonnull)changeListener;
|
||||
- (void)removeChangeListener:(id<MTContextChangeListener> _Nonnull)changeListener;
|
||||
|
||||
- (void)setDiscoverBackupAddressListSignal:(MTSignal *)signal;
|
||||
- (void)setDiscoverBackupAddressListSignal:(MTSignal * _Nonnull)signal;
|
||||
|
||||
- (NSTimeInterval)globalTime;
|
||||
- (NSTimeInterval)globalTimeDifference;
|
||||
- (NSTimeInterval)globalTimeOffsetFromUTC;
|
||||
- (void)setGlobalTimeDifference:(NSTimeInterval)globalTimeDifference;
|
||||
|
||||
- (void)setSeedAddressSetForDatacenterWithId:(NSInteger)datacenterId seedAddressSet:(MTDatacenterAddressSet *)seedAddressSet;
|
||||
- (void)updateAddressSetForDatacenterWithId:(NSInteger)datacenterId addressSet:(MTDatacenterAddressSet *)addressSet forceUpdateSchemes:(bool)forceUpdateSchemes;
|
||||
- (void)addAddressForDatacenterWithId:(NSInteger)datacenterId address:(MTDatacenterAddress *)address;
|
||||
- (void)updateTransportSchemeForDatacenterWithId:(NSInteger)datacenterId transportScheme:(MTTransportScheme *)transportScheme media:(bool)media isProxy:(bool)isProxy;
|
||||
- (void)updateAuthInfoForDatacenterWithId:(NSInteger)datacenterId authInfo:(MTDatacenterAuthInfo *)authInfo selector:(MTDatacenterAuthInfoSelector)selector;
|
||||
- (void)setSeedAddressSetForDatacenterWithId:(NSInteger)datacenterId seedAddressSet:(MTDatacenterAddressSet * _Nonnull)seedAddressSet;
|
||||
- (void)updateAddressSetForDatacenterWithId:(NSInteger)datacenterId addressSet:(MTDatacenterAddressSet * _Nonnull)addressSet forceUpdateSchemes:(bool)forceUpdateSchemes;
|
||||
- (void)addAddressForDatacenterWithId:(NSInteger)datacenterId address:(MTDatacenterAddress * _Nonnull)address;
|
||||
- (void)updateTransportSchemeForDatacenterWithId:(NSInteger)datacenterId transportScheme:(MTTransportScheme * _Nonnull)transportScheme media:(bool)media isProxy:(bool)isProxy;
|
||||
- (void)updateAuthInfoForDatacenterWithId:(NSInteger)datacenterId authInfo:(MTDatacenterAuthInfo * _Nullable)authInfo selector:(MTDatacenterAuthInfoSelector)selector;
|
||||
|
||||
- (bool)isPasswordInputRequiredForDatacenterWithId:(NSInteger)datacenterId;
|
||||
- (bool)updatePasswordInputRequiredForDatacenterWithId:(NSInteger)datacenterId required:(bool)required;
|
||||
|
||||
- (void)scheduleSessionCleanupForAuthKeyId:(int64_t)authKeyId sessionInfo:(MTSessionInfo *)sessionInfo;
|
||||
- (void)collectSessionIdsForCleanupWithAuthKeyId:(int64_t)authKeyId completion:(void (^)(NSArray *sessionIds))completion;
|
||||
- (void)sessionIdsDeletedForAuthKeyId:(int64_t)authKeyId sessionIds:(NSArray *)sessionIds;
|
||||
- (void)scheduleSessionCleanupForAuthKeyId:(int64_t)authKeyId sessionInfo:(MTSessionInfo * _Nonnull)sessionInfo;
|
||||
- (void)collectSessionIdsForCleanupWithAuthKeyId:(int64_t)authKeyId completion:(void (^ _Nonnull)(NSArray * _Nonnull sessionIds))completion;
|
||||
- (void)sessionIdsDeletedForAuthKeyId:(int64_t)authKeyId sessionIds:(NSArray * _Nonnull)sessionIds;
|
||||
|
||||
- (NSArray *)knownDatacenterIds;
|
||||
- (void)enumerateAddressSetsForDatacenters:(void (^)(NSInteger datacenterId, MTDatacenterAddressSet *addressSet, BOOL *stop))block;
|
||||
- (NSArray * _Nonnull)knownDatacenterIds;
|
||||
- (void)enumerateAddressSetsForDatacenters:(void (^ _Nonnull)(NSInteger datacenterId, MTDatacenterAddressSet * _Nonnull addressSet, BOOL * _Nullable stop))block;
|
||||
|
||||
- (MTDatacenterAddressSet *)addressSetForDatacenterWithId:(NSInteger)datacenterId;
|
||||
- (void)reportTransportSchemeFailureForDatacenterId:(NSInteger)datacenterId transportScheme:(MTTransportScheme *)transportScheme;
|
||||
- (void)reportTransportSchemeSuccessForDatacenterId:(NSInteger)datacenterId transportScheme:(MTTransportScheme *)transportScheme;
|
||||
- (MTDatacenterAddressSet * _Nonnull)addressSetForDatacenterWithId:(NSInteger)datacenterId;
|
||||
- (void)reportTransportSchemeFailureForDatacenterId:(NSInteger)datacenterId transportScheme:(MTTransportScheme * _Nonnull)transportScheme;
|
||||
- (void)reportTransportSchemeSuccessForDatacenterId:(NSInteger)datacenterId transportScheme:(MTTransportScheme * _Nonnull)transportScheme;
|
||||
- (void)invalidateTransportSchemesForDatacenterIds:(NSArray<NSNumber *> * _Nonnull)datacenterIds;
|
||||
- (void)invalidateTransportSchemesForKnownDatacenterIds;
|
||||
- (MTTransportScheme * _Nullable)chooseTransportSchemeForConnectionToDatacenterId:(NSInteger)datacenterId schemes:(NSArray<MTTransportScheme *> * _Nonnull)schemes;
|
||||
- (NSArray<MTTransportScheme *> * _Nonnull)transportSchemesForDatacenterWithId:(NSInteger)datacenterId media:(bool)media enforceMedia:(bool)enforceMedia isProxy:(bool)isProxy;
|
||||
- (void)transportSchemeForDatacenterWithIdRequired:(NSInteger)datacenterId media:(bool)media;
|
||||
- (void)invalidateTransportSchemeForDatacenterId:(NSInteger)datacenterId transportScheme:(MTTransportScheme *)transportScheme isProbablyHttp:(bool)isProbablyHttp media:(bool)media;
|
||||
- (void)revalidateTransportSchemeForDatacenterId:(NSInteger)datacenterId transportScheme:(MTTransportScheme *)transportScheme media:(bool)media;
|
||||
- (MTDatacenterAuthInfo *)authInfoForDatacenterWithId:(NSInteger)datacenterId selector:(MTDatacenterAuthInfoSelector)selector;
|
||||
- (void)invalidateTransportSchemeForDatacenterId:(NSInteger)datacenterId transportScheme:(MTTransportScheme * _Nonnull)transportScheme isProbablyHttp:(bool)isProbablyHttp media:(bool)media;
|
||||
- (void)revalidateTransportSchemeForDatacenterId:(NSInteger)datacenterId transportScheme:(MTTransportScheme * _Nonnull)transportScheme media:(bool)media;
|
||||
- (MTDatacenterAuthInfo * _Nullable)authInfoForDatacenterWithId:(NSInteger)datacenterId selector:(MTDatacenterAuthInfoSelector)selector;
|
||||
|
||||
- (NSArray<NSDictionary *> *)publicKeysForDatacenterWithId:(NSInteger)datacenterId;
|
||||
- (void)updatePublicKeysForDatacenterWithId:(NSInteger)datacenterId publicKeys:(NSArray<NSDictionary *> *)publicKeys;
|
||||
- (NSArray<NSDictionary *> * _Nonnull)publicKeysForDatacenterWithId:(NSInteger)datacenterId;
|
||||
- (void)updatePublicKeysForDatacenterWithId:(NSInteger)datacenterId publicKeys:(NSArray<NSDictionary *> * _Nonnull)publicKeys;
|
||||
- (void)publicKeysForDatacenterWithIdRequired:(NSInteger)datacenterId;
|
||||
|
||||
- (void)removeAllAuthTokens;
|
||||
- (void)removeTokenForDatacenterWithId:(NSInteger)datacenterId;
|
||||
- (id)authTokenForDatacenterWithId:(NSInteger)datacenterId;
|
||||
- (void)updateAuthTokenForDatacenterWithId:(NSInteger)datacenterId authToken:(id)authToken;
|
||||
- (id _Nullable)authTokenForDatacenterWithId:(NSInteger)datacenterId;
|
||||
- (void)updateAuthTokenForDatacenterWithId:(NSInteger)datacenterId authToken:(id _Nullable)authToken;
|
||||
|
||||
- (void)addressSetForDatacenterWithIdRequired:(NSInteger)datacenterId;
|
||||
- (void)authInfoForDatacenterWithIdRequired:(NSInteger)datacenterId isCdn:(bool)isCdn selector:(MTDatacenterAuthInfoSelector)selector;
|
||||
- (void)authTokenForDatacenterWithIdRequired:(NSInteger)datacenterId authToken:(id)authToken masterDatacenterId:(NSInteger)masterDatacenterId;
|
||||
- (void)authTokenForDatacenterWithIdRequired:(NSInteger)datacenterId authToken:(id _Nullable)authToken masterDatacenterId:(NSInteger)masterDatacenterId;
|
||||
|
||||
- (void)reportProblemsWithDatacenterAddressForId:(NSInteger)datacenterId address:(MTDatacenterAddress *)address;
|
||||
- (void)reportProblemsWithDatacenterAddressForId:(NSInteger)datacenterId address:(MTDatacenterAddress * _Nonnull)address;
|
||||
|
||||
- (void)updateApiEnvironment:(MTApiEnvironment *(^)(MTApiEnvironment *))f;
|
||||
- (void)updateApiEnvironment:(MTApiEnvironment * _Nullable (^ _Nonnull)(MTApiEnvironment * _Nullable))f;
|
||||
|
||||
- (void)beginExplicitBackupAddressDiscovery;
|
||||
|
||||
|
@ -4,18 +4,18 @@
|
||||
|
||||
@interface MTDatacenterAddress : NSObject <NSCoding, NSCopying>
|
||||
|
||||
@property (nonatomic, strong, readonly) NSString *host;
|
||||
@property (nonatomic, strong, readonly) NSString *ip;
|
||||
@property (nonatomic, strong, readonly) NSString * _Nullable host;
|
||||
@property (nonatomic, strong, readonly) NSString * _Nullable ip;
|
||||
@property (nonatomic, readonly) uint16_t port;
|
||||
@property (nonatomic, readonly) bool preferForMedia;
|
||||
@property (nonatomic, readonly) bool restrictToTcp;
|
||||
@property (nonatomic, readonly) bool cdn;
|
||||
@property (nonatomic, readonly) bool preferForProxy;
|
||||
@property (nonatomic, readonly) NSData *secret;
|
||||
@property (nonatomic, readonly) NSData * _Nullable secret;
|
||||
|
||||
- (instancetype)initWithIp:(NSString *)ip port:(uint16_t)port preferForMedia:(bool)preferForMedia restrictToTcp:(bool)restrictToTcp cdn:(bool)cdn preferForProxy:(bool)preferForProxy secret:(NSData *)secret;
|
||||
- (instancetype _Nonnull)initWithIp:(NSString * _Nonnull)ip port:(uint16_t)port preferForMedia:(bool)preferForMedia restrictToTcp:(bool)restrictToTcp cdn:(bool)cdn preferForProxy:(bool)preferForProxy secret:(NSData * _Nullable)secret;
|
||||
|
||||
- (BOOL)isEqualToAddress:(MTDatacenterAddress *)other;
|
||||
- (BOOL)isEqualToAddress:(MTDatacenterAddress * _Nonnull)other;
|
||||
- (BOOL)isIpv6;
|
||||
|
||||
@end
|
||||
|
@ -9,66 +9,66 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
NSData *MTSha1(NSData *data);
|
||||
NSData *MTSubdataSha1(NSData *data, NSUInteger offset, NSUInteger length);
|
||||
NSData * _Nonnull MTSha1(NSData * _Nonnull data);
|
||||
NSData * _Nonnull MTSubdataSha1(NSData * _Nonnull data, NSUInteger offset, NSUInteger length);
|
||||
|
||||
NSData *MTSha256(NSData *data);
|
||||
NSData * _Nonnull MTSha256(NSData * _Nonnull data);
|
||||
|
||||
void MTRawSha1(void const *inData, NSUInteger length, void *outData);
|
||||
void MTRawSha256(void const *inData, NSUInteger length, void *outData);
|
||||
void MTRawSha1(void const * _Nonnull inData, NSUInteger length, void * _Nonnull outData);
|
||||
void MTRawSha256(void const * _Nonnull inData, NSUInteger length, void * _Nonnull outData);
|
||||
|
||||
int32_t MTMurMurHash32(const void *bytes, int length);
|
||||
int32_t MTMurMurHash32(const void * _Nonnull bytes, int length);
|
||||
|
||||
void MTAesEncryptInplace(NSMutableData *data, NSData *key, NSData *iv);
|
||||
void MTAesEncryptInplaceAndModifyIv(NSMutableData *data, NSData *key, NSMutableData *iv);
|
||||
void MTAesEncryptBytesInplaceAndModifyIv(void *data, NSInteger length, NSData *key, void *iv);
|
||||
void MTAesEncryptRaw(void const *data, void *outData, NSInteger length, void const *key, void const *iv);
|
||||
void MTAesDecryptRaw(void const *data, void *outData, NSInteger length, void const *key, void const *iv);
|
||||
void MTAesDecryptInplaceAndModifyIv(NSMutableData *data, NSData *key, NSMutableData *iv);
|
||||
void MTAesDecryptBytesInplaceAndModifyIv(void *data, NSInteger length, NSData *key, void *iv);
|
||||
NSData *MTAesEncrypt(NSData *data, NSData *key, NSData *iv);
|
||||
NSData *MTAesDecrypt(NSData *data, NSData *key, NSData *iv);
|
||||
NSData *MTRsaEncrypt(id<EncryptionProvider> provider, NSString *publicKey, NSData *data);
|
||||
NSData *MTExp(id<EncryptionProvider> provider, NSData *base, NSData *exp, NSData *modulus);
|
||||
NSData *MTModSub(id<EncryptionProvider> provider, NSData *a, NSData *b, NSData *modulus);
|
||||
NSData *MTModMul(id<EncryptionProvider> provider, NSData *a, NSData *b, NSData *modulus);
|
||||
NSData *MTMul(id<EncryptionProvider> provider, NSData *a, NSData *b);
|
||||
NSData *MTAdd(id<EncryptionProvider> provider, NSData *a, NSData *b);
|
||||
bool MTFactorize(uint64_t what, uint64_t *resA, uint64_t *resB);
|
||||
bool MTIsZero(id<EncryptionProvider> provider, NSData *value);
|
||||
void MTAesEncryptInplace(NSMutableData * _Nonnull data, NSData * _Nonnull key, NSData * _Nonnull iv);
|
||||
void MTAesEncryptInplaceAndModifyIv(NSMutableData * _Nonnull data, NSData * _Nonnull key, NSMutableData * _Nonnull iv);
|
||||
void MTAesEncryptBytesInplaceAndModifyIv(void * _Nonnull data, NSInteger length, NSData * _Nonnull key, void * _Nonnull iv);
|
||||
void MTAesEncryptRaw(void const * _Nonnull data, void * _Nonnull outData, NSInteger length, void const * _Nonnull key, void const * _Nonnull iv);
|
||||
void MTAesDecryptRaw(void const * _Nonnull data, void * _Nonnull outData, NSInteger length, void const * _Nonnull key, void const * _Nonnull iv);
|
||||
void MTAesDecryptInplaceAndModifyIv(NSMutableData * _Nonnull data, NSData * _Nonnull key, NSMutableData * _Nonnull iv);
|
||||
void MTAesDecryptBytesInplaceAndModifyIv(void * _Nonnull data, NSInteger length, NSData * _Nonnull key, void * _Nonnull iv);
|
||||
NSData * _Nullable MTAesEncrypt(NSData * _Nonnull data, NSData * _Nonnull key, NSData * _Nonnull iv);
|
||||
NSData * _Nullable MTAesDecrypt(NSData * _Nonnull data, NSData * _Nonnull key, NSData * _Nonnull iv);
|
||||
NSData * _Nullable MTRsaEncrypt(id<EncryptionProvider> _Nonnull provider, NSString * _Nonnull publicKey, NSData * _Nonnull data);
|
||||
NSData * _Nullable MTExp(id<EncryptionProvider> _Nonnull provider, NSData * _Nonnull base, NSData * _Nonnull exp, NSData * _Nonnull modulus);
|
||||
NSData * _Nullable MTModSub(id<EncryptionProvider> _Nonnull provider, NSData * _Nonnull a, NSData * _Nonnull b, NSData * _Nonnull modulus);
|
||||
NSData * _Nullable MTModMul(id<EncryptionProvider> _Nonnull provider, NSData * _Nonnull a, NSData * _Nonnull b, NSData * _Nonnull modulus);
|
||||
NSData * _Nullable MTMul(id<EncryptionProvider> _Nonnull provider, NSData * _Nonnull a, NSData * _Nonnull b);
|
||||
NSData * _Nullable MTAdd(id<EncryptionProvider> _Nonnull provider, NSData * _Nonnull a, NSData * _Nonnull b);
|
||||
bool MTFactorize(uint64_t what, uint64_t * _Nonnull resA, uint64_t * _Nonnull resB);
|
||||
bool MTIsZero(id<EncryptionProvider> _Nonnull provider, NSData * _Nonnull value);
|
||||
|
||||
NSData *MTAesCtrDecrypt(NSData *data, NSData *key, NSData *iv);
|
||||
NSData * _Nullable MTAesCtrDecrypt(NSData * _Nonnull data, NSData * _Nonnull key, NSData * _Nonnull iv);
|
||||
|
||||
@protocol MTKeychain;
|
||||
bool MTCheckIsSafeG(unsigned int g);
|
||||
bool MTCheckIsSafeB(id<EncryptionProvider> provider, NSData *b, NSData *p);
|
||||
bool MTCheckIsSafePrime(id<EncryptionProvider> provider, NSData *numberBytes, id<MTKeychain> keychain);
|
||||
bool MTCheckIsSafeGAOrB(id<EncryptionProvider> provider, NSData *gAOrB, NSData *p);
|
||||
bool MTCheckMod(id<EncryptionProvider> provider, NSData *numberBytes, unsigned int g, id<MTKeychain> keychain);
|
||||
bool MTCheckIsSafeB(id<EncryptionProvider> _Nonnull provider, NSData * _Nonnull b, NSData * _Nonnull p);
|
||||
bool MTCheckIsSafePrime(id<EncryptionProvider> _Nonnull provider, NSData * _Nonnull numberBytes, id<MTKeychain> _Nonnull keychain);
|
||||
bool MTCheckIsSafeGAOrB(id<EncryptionProvider> _Nonnull provider, NSData * _Nonnull gAOrB, NSData * _Nonnull p);
|
||||
bool MTCheckMod(id<EncryptionProvider> _Nonnull provider, NSData * _Nonnull numberBytes, unsigned int g, id<MTKeychain> _Nonnull keychain);
|
||||
|
||||
@interface MTAesCtr : NSObject
|
||||
|
||||
- (instancetype)initWithKey:(const void *)key keyLength:(int)keyLength iv:(const void *)iv decrypt:(bool)decrypt;
|
||||
- (instancetype)initWithKey:(const void *)key keyLength:(int)keyLength iv:(const void *)iv ecount:(void *)ecount num:(uint32_t)num;
|
||||
- (instancetype _Nonnull)initWithKey:(const void * _Nonnull)key keyLength:(int)keyLength iv:(const void * _Nonnull)iv decrypt:(bool)decrypt;
|
||||
- (instancetype _Nonnull)initWithKey:(const void * _Nonnull)key keyLength:(int)keyLength iv:(const void * _Nonnull)iv ecount:(void * _Nonnull)ecount num:(uint32_t)num;
|
||||
|
||||
- (uint32_t)num;
|
||||
- (void *)ecount;
|
||||
- (void)getIv:(void *)iv;
|
||||
- (void * _Nonnull)ecount;
|
||||
- (void)getIv:(void * _Nonnull)iv;
|
||||
|
||||
- (void)encryptIn:(const unsigned char *)in out:(unsigned char *)out len:(size_t)len;
|
||||
- (void)encryptIn:(const unsigned char * _Nonnull)in out:(unsigned char * _Nonnull)out len:(size_t)len;
|
||||
|
||||
@end
|
||||
|
||||
uint64_t MTRsaFingerprint(id<EncryptionProvider> provider, NSString *key);
|
||||
uint64_t MTRsaFingerprint(id<EncryptionProvider> _Nonnull provider, NSString * _Nonnull key);
|
||||
|
||||
NSData *MTRsaEncryptPKCS1OAEP(id<EncryptionProvider> provider, NSString *key, NSData *data);
|
||||
NSData * _Nullable MTRsaEncryptPKCS1OAEP(id<EncryptionProvider> _Nonnull provider, NSString * _Nonnull key, NSData * _Nonnull data);
|
||||
|
||||
@interface MTBackupDatacenterAddress : NSObject
|
||||
|
||||
@property (nonatomic, readonly) int32_t datacenterId;
|
||||
@property (nonatomic, strong, readonly) NSString *ip;
|
||||
@property (nonatomic, strong, readonly) NSString * _Nonnull ip;
|
||||
@property (nonatomic, readonly) int32_t port;
|
||||
@property (nonatomic, strong, readonly) NSData *secret;
|
||||
@property (nonatomic, strong, readonly) NSData * _Nullable secret;
|
||||
|
||||
@end
|
||||
|
||||
@ -76,11 +76,11 @@ NSData *MTRsaEncryptPKCS1OAEP(id<EncryptionProvider> provider, NSString *key, NS
|
||||
|
||||
@property (nonatomic, readonly) int32_t timestamp;
|
||||
@property (nonatomic, readonly) int32_t expirationDate;
|
||||
@property (nonatomic, strong, readonly) NSArray<MTBackupDatacenterAddress *> *addressList;
|
||||
@property (nonatomic, strong, readonly) NSArray<MTBackupDatacenterAddress *> * _Nonnull addressList;
|
||||
|
||||
@end
|
||||
|
||||
MTBackupDatacenterData *MTIPDataDecode(id<EncryptionProvider> provider, NSData *data, NSString *phoneNumber);
|
||||
MTBackupDatacenterData * _Nullable MTIPDataDecode(id<EncryptionProvider> _Nonnull provider, NSData * _Nonnull data, NSString * _Nonnull phoneNumber);
|
||||
|
||||
NSData * _Nullable MTPBKDF2(NSData * _Nonnull data, NSData * _Nonnull salt, int rounds);
|
||||
|
||||
|
@ -19,34 +19,34 @@
|
||||
|
||||
@optional
|
||||
|
||||
- (void)transportNetworkAvailabilityChanged:(MTTransport *)transport isNetworkAvailable:(bool)isNetworkAvailable;
|
||||
- (void)transportConnectionStateChanged:(MTTransport *)transport isConnected:(bool)isConnected proxySettings:(MTSocksProxySettings *)proxySettings;
|
||||
- (void)transportConnectionFailed:(MTTransport *)transport scheme:(MTTransportScheme *)scheme;
|
||||
- (void)transportConnectionContextUpdateStateChanged:(MTTransport *)transport isUpdatingConnectionContext:(bool)isUpdatingConnectionContext;
|
||||
- (void)transportConnectionProblemsStatusChanged:(MTTransport *)transport scheme:(MTTransportScheme *)scheme hasConnectionProblems:(bool)hasConnectionProblems isProbablyHttp:(bool)isProbablyHttp;
|
||||
- (void)transportNetworkAvailabilityChanged:(MTTransport * _Nonnull)transport isNetworkAvailable:(bool)isNetworkAvailable;
|
||||
- (void)transportConnectionStateChanged:(MTTransport * _Nonnull)transport isConnected:(bool)isConnected proxySettings:(MTSocksProxySettings * _Nullable)proxySettings;
|
||||
- (void)transportConnectionFailed:(MTTransport * _Nonnull)transport scheme:(MTTransportScheme * _Nonnull)scheme;
|
||||
- (void)transportConnectionContextUpdateStateChanged:(MTTransport * _Nonnull)transport isUpdatingConnectionContext:(bool)isUpdatingConnectionContext;
|
||||
- (void)transportConnectionProblemsStatusChanged:(MTTransport * _Nonnull)transport scheme:(MTTransportScheme * _Nonnull)scheme hasConnectionProblems:(bool)hasConnectionProblems isProbablyHttp:(bool)isProbablyHttp;
|
||||
|
||||
- (void)transportReadyForTransaction:(MTTransport *)transport scheme:(MTTransportScheme *)scheme transportSpecificTransaction:(MTMessageTransaction *)transportSpecificTransaction forceConfirmations:(bool)forceConfirmations transactionReady:(void (^)(NSArray *))transactionReady;
|
||||
- (void)transportHasIncomingData:(MTTransport *)transport scheme:(MTTransportScheme *)scheme data:(NSData *)data transactionId:(id)transactionId requestTransactionAfterProcessing:(bool)requestTransactionAfterProcessing decodeResult:(void (^)(id transactionId, bool success))decodeResult;
|
||||
- (void)transportTransactionsMayHaveFailed:(MTTransport *)transport transactionIds:(NSArray *)transactionIds;
|
||||
- (void)transportReceivedQuickAck:(MTTransport *)transport quickAckId:(int32_t)quickAckId;
|
||||
- (void)transportDecodeProgressToken:(MTTransport *)transport scheme:(MTTransportScheme *)scheme data:(NSData *)data token:(int64_t)token completion:(void (^)(int64_t token, id progressToken))completion;
|
||||
- (void)transportUpdatedDataReceiveProgress:(MTTransport *)transport progressToken:(id)progressToken packetLength:(NSInteger)packetLength progress:(float)progress;
|
||||
- (void)transportReadyForTransaction:(MTTransport * _Nonnull)transport scheme:(MTTransportScheme * _Nonnull)scheme transportSpecificTransaction:(MTMessageTransaction * _Nonnull)transportSpecificTransaction forceConfirmations:(bool)forceConfirmations transactionReady:(void (^ _Nonnull)(NSArray * _Nonnull))transactionReady;
|
||||
- (void)transportHasIncomingData:(MTTransport * _Nonnull)transport scheme:(MTTransportScheme * _Nonnull)scheme data:(NSData * _Nonnull)data transactionId:(id _Nonnull)transactionId requestTransactionAfterProcessing:(bool)requestTransactionAfterProcessing decodeResult:(void (^ _Nonnull)(id _Nonnull transactionId, bool success))decodeResult;
|
||||
- (void)transportTransactionsMayHaveFailed:(MTTransport * _Nonnull)transport transactionIds:(NSArray * _Nonnull)transactionIds;
|
||||
- (void)transportReceivedQuickAck:(MTTransport * _Nonnull)transport quickAckId:(int32_t)quickAckId;
|
||||
- (void)transportDecodeProgressToken:(MTTransport * _Nonnull)transport scheme:(MTTransportScheme * _Nonnull)scheme data:(NSData * _Nonnull)data token:(int64_t)token completion:(void (^ _Nonnull)(int64_t token, id _Nonnull progressToken))completion;
|
||||
- (void)transportUpdatedDataReceiveProgress:(MTTransport * _Nonnull)transport progressToken:(id _Nonnull)progressToken packetLength:(NSInteger)packetLength progress:(float)progress;
|
||||
|
||||
@end
|
||||
|
||||
@interface MTTransport : NSObject <MTMessageService>
|
||||
|
||||
@property (nonatomic, weak) id<MTTransportDelegate> delegate;
|
||||
@property (nonatomic, weak) id<MTTransportDelegate> _Nullable delegate;
|
||||
|
||||
@property (nonatomic, strong, readonly) MTContext *context;
|
||||
@property (nonatomic, strong, readonly) MTContext * _Nullable context;
|
||||
@property (nonatomic, readonly) NSInteger datacenterId;
|
||||
@property (nonatomic, strong, readonly) MTSocksProxySettings *proxySettings;
|
||||
@property (nonatomic, strong, readonly) MTSocksProxySettings * _Nullable proxySettings;
|
||||
@property (nonatomic) bool simultaneousTransactionsEnabled;
|
||||
@property (nonatomic) bool reportTransportConnectionContextUpdateStates;
|
||||
|
||||
- (instancetype)initWithDelegate:(id<MTTransportDelegate>)delegate context:(MTContext *)context datacenterId:(NSInteger)datacenterId schemes:(NSArray<MTTransportScheme *> * _Nonnull)schemes proxySettings:(MTSocksProxySettings *)proxySettings usageCalculationInfo:(MTNetworkUsageCalculationInfo *)usageCalculationInfo;
|
||||
- (instancetype _Nonnull)initWithDelegate:(id<MTTransportDelegate> _Nullable)delegate context:(MTContext * _Nonnull)context datacenterId:(NSInteger)datacenterId schemes:(NSArray<MTTransportScheme *> * _Nonnull)schemes proxySettings:(MTSocksProxySettings * _Null_unspecified)proxySettings usageCalculationInfo:(MTNetworkUsageCalculationInfo * _Nullable)usageCalculationInfo;
|
||||
|
||||
- (void)setUsageCalculationInfo:(MTNetworkUsageCalculationInfo *)usageCalculationInfo;
|
||||
- (void)setUsageCalculationInfo:(MTNetworkUsageCalculationInfo * _Null_unspecified)usageCalculationInfo;
|
||||
|
||||
- (bool)needsParityCorrection;
|
||||
|
||||
@ -54,10 +54,10 @@
|
||||
- (void)stop;
|
||||
- (void)updateConnectionState;
|
||||
- (void)setDelegateNeedsTransaction;
|
||||
- (void)_processIncomingData:(NSData *)data scheme:(MTTransportScheme *)scheme transactionId:(id)transactionId requestTransactionAfterProcessing:(bool)requestTransactionAfterProcessing decodeResult:(void (^)(id transactionId, bool success))decodeResult;
|
||||
- (void)_processIncomingData:(NSData * _Nonnull)data scheme:(MTTransportScheme * _Nonnull)scheme transactionId:(id _Nonnull)transactionId requestTransactionAfterProcessing:(bool)requestTransactionAfterProcessing decodeResult:(void (^ _Nonnull)(id _Nonnull transactionId, bool success))decodeResult;
|
||||
- (void)_networkAvailabilityChanged:(bool)networkAvailable;
|
||||
|
||||
- (void)activeTransactionIds:(void (^)(NSArray *activeTransactionId))completion;
|
||||
- (void)activeTransactionIds:(void (^ _Nonnull)(NSArray * _Nonnull activeTransactionId))completion;
|
||||
|
||||
- (void)updateSchemes:(NSArray<MTTransportScheme *> * _Nonnull)schemes;
|
||||
|
||||
|
@ -10,14 +10,14 @@
|
||||
|
||||
@interface MTTransportScheme : NSObject <NSCoding>
|
||||
|
||||
@property (nonatomic, strong, readonly) Class transportClass;
|
||||
@property (nonatomic, strong, readonly) MTDatacenterAddress *address;
|
||||
@property (nonatomic, strong, readonly) Class _Nonnull transportClass;
|
||||
@property (nonatomic, strong, readonly) MTDatacenterAddress * _Nonnull address;
|
||||
@property (nonatomic, readonly) bool media;
|
||||
|
||||
- (instancetype)initWithTransportClass:(Class)transportClass address:(MTDatacenterAddress *)address media:(bool)media;
|
||||
- (instancetype _Nonnull)initWithTransportClass:(Class _Nonnull)transportClass address:(MTDatacenterAddress * _Nonnull)address media:(bool)media;
|
||||
|
||||
- (BOOL)isEqualToScheme:(MTTransportScheme *)other;
|
||||
- (BOOL)isEqualToScheme:(MTTransportScheme * _Nonnull)other;
|
||||
- (BOOL)isOptimal;
|
||||
- (NSComparisonResult)compareToScheme:(MTTransportScheme *)other;
|
||||
- (NSComparisonResult)compareToScheme:(MTTransportScheme * _Nonnull)other;
|
||||
|
||||
@end
|
||||
|
@ -92,7 +92,7 @@ static NSString * AFStringFromIndexSet(NSIndexSet *indexSet) {
|
||||
if (self.response && !self.HTTPError) {
|
||||
if (![self hasAcceptableStatusCode]) {
|
||||
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
|
||||
[userInfo setValue:[NSString stringWithFormat:NSLocalizedString(@"Expected status code in (%@), got %d", nil), AFStringFromIndexSet(self.acceptableStatusCodes), [self.response statusCode]] forKey:NSLocalizedDescriptionKey];
|
||||
[userInfo setValue:[NSString stringWithFormat:NSLocalizedString(@"Expected status code in (%@), got %ld", nil), AFStringFromIndexSet(self.acceptableStatusCodes), (long)[self.response statusCode]] forKey:NSLocalizedDescriptionKey];
|
||||
[userInfo setValue:[self.request URL] forKey:NSURLErrorFailingURLErrorKey];
|
||||
|
||||
self.HTTPError = [[NSError alloc] initWithDomain:AFNetworkingErrorDomain code:NSURLErrorBadServerResponse userInfo:userInfo];
|
||||
@ -176,21 +176,27 @@ static NSString * AFStringFromIndexSet(NSIndexSet *indexSet) {
|
||||
- (void)setCompletionBlockWithSuccess:(void (^)(NSOperation *operation, id responseObject))success
|
||||
failure:(void (^)(NSOperation *operation, NSError *error))failure
|
||||
{
|
||||
__weak typeof(self) weakSelf = self;
|
||||
self.completionBlock = ^ {
|
||||
if ([self isCancelled]) {
|
||||
__strong typeof(weakSelf) strongSelf = weakSelf;
|
||||
if (!strongSelf) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.error) {
|
||||
if ([strongSelf isCancelled]) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (strongSelf.error) {
|
||||
if (failure) {
|
||||
dispatch_group_async(self.dispatchGroup, self.failureCallbackQueue ? self.failureCallbackQueue : dispatch_get_main_queue(), ^{
|
||||
failure(self, self.error);
|
||||
dispatch_group_async(strongSelf.dispatchGroup, strongSelf.failureCallbackQueue ? strongSelf.failureCallbackQueue : dispatch_get_main_queue(), ^{
|
||||
failure(strongSelf, strongSelf.error);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (success) {
|
||||
dispatch_group_async(self.dispatchGroup, self.successCallbackQueue ? self.successCallbackQueue : dispatch_get_main_queue(), ^{
|
||||
success(self, self.responseData);
|
||||
dispatch_group_async(strongSelf.dispatchGroup, strongSelf.successCallbackQueue ? strongSelf.successCallbackQueue : dispatch_get_main_queue(), ^{
|
||||
success(strongSelf, strongSelf.responseData);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -414,11 +414,11 @@ static int32_t fixedTimeDifferenceValue = 0;
|
||||
_cleanupSessionIdsByAuthKeyId = [[NSMutableDictionary alloc] initWithDictionary:cleanupSessionIdsByAuthKeyId];
|
||||
|
||||
if (MTLogEnabled()) {
|
||||
MTLog(@"[MTContext#%x: received keychain globalTimeDifference:%f datacenterAuthInfoById:%@]", (int)self, _globalTimeDifference, _datacenterAuthInfoById);
|
||||
MTLog(@"[MTContext#%llx: received keychain globalTimeDifference:%f datacenterAuthInfoById:%@]", (intptr_t)self, _globalTimeDifference, _datacenterAuthInfoById);
|
||||
}
|
||||
} else {
|
||||
if (MTLogEnabled()) {
|
||||
MTLog(@"[MTContext#%x: received keychain nil]", (int)self);
|
||||
MTLog(@"[MTContext#%llx: received keychain nil]", (intptr_t)self);
|
||||
}
|
||||
}
|
||||
}];
|
||||
@ -477,7 +477,7 @@ static int32_t fixedTimeDifferenceValue = 0;
|
||||
_globalTimeDifference = globalTimeDifference;
|
||||
|
||||
if (MTLogEnabled()) {
|
||||
MTLog(@"[MTContext#%x: global time difference changed: %.1fs]", (int)self, globalTimeDifference);
|
||||
MTLog(@"[MTContext#%llx: global time difference changed: %.1fs]", (intptr_t)self, globalTimeDifference);
|
||||
}
|
||||
|
||||
[_keychain setObject:@(_globalTimeDifference) forKey:@"globalTimeDifference" group:@"temp"];
|
||||
@ -499,7 +499,7 @@ static int32_t fixedTimeDifferenceValue = 0;
|
||||
if (addressSet != nil && datacenterId != 0)
|
||||
{
|
||||
if (MTLogEnabled()) {
|
||||
MTLog(@"[MTContext#%x: address set updated for %d]", (int)self, datacenterId);
|
||||
MTLog(@"[MTContext#%llx: address set updated for %d]", (intptr_t)self, datacenterId);
|
||||
}
|
||||
|
||||
bool updateSchemes = forceUpdateSchemes;
|
||||
@ -592,7 +592,7 @@ static int32_t fixedTimeDifferenceValue = 0;
|
||||
if (updated)
|
||||
{
|
||||
if (MTLogEnabled()) {
|
||||
MTLog(@"[MTContext#%x: added address %@ for datacenter %d]", (int)self, address, datacenterId);
|
||||
MTLog(@"[MTContext#%llx: added address %@ for datacenter %d]", (intptr_t)self, address, datacenterId);
|
||||
}
|
||||
|
||||
_datacenterAddressSetById[@(datacenterId)] = addressSet;
|
||||
@ -631,7 +631,7 @@ static int32_t fixedTimeDifferenceValue = 0;
|
||||
if (MTLogEnabled()) {
|
||||
MTDatacenterAuthInfo *persistentInfo = _datacenterAuthInfoById[authInfoMapIntegerKey((int32_t)datacenterId, MTDatacenterAuthInfoSelectorPersistent)];
|
||||
|
||||
MTLog(@"[MTContext#%x: auth info updated for %d selector %d to %@ (persistent key id is %llu)]", (int)self, datacenterId, selector, authInfo, persistentInfo.authKeyId);
|
||||
MTLog(@"[MTContext#%llx: auth info updated for %d selector %d to %@ (persistent key id is %llu)]", (intptr_t)self, datacenterId, selector, authInfo, persistentInfo.authKeyId);
|
||||
}
|
||||
|
||||
[_keychain setObject:_datacenterAuthInfoById forKey:@"datacenterAuthInfoById" group:@"persistent"];
|
||||
@ -706,7 +706,7 @@ static int32_t fixedTimeDifferenceValue = 0;
|
||||
NSArray *currentListeners = [[NSArray alloc] initWithArray:_changeListeners];
|
||||
|
||||
if (MTLogEnabled()) {
|
||||
MTLog(@"[MTContext#%x: %@ transport scheme updated for %d: %@]", (int)self, media ? @"media" : @"generic", datacenterId, transportScheme);
|
||||
MTLog(@"[MTContext#%llx: %@ transport scheme updated for %d: %@]", (intptr_t)self, media ? @"media" : @"generic", datacenterId, transportScheme);
|
||||
}
|
||||
|
||||
for (id<MTContextChangeListener> listener in currentListeners) {
|
||||
|
@ -11,10 +11,10 @@ typedef struct {
|
||||
|
||||
@interface MTDiscoverConnectionSignals : NSObject
|
||||
|
||||
+ (NSData *)payloadData:(MTPayloadData *)outPayloadData context:(MTContext *)context address:(MTDatacenterAddress *)address;
|
||||
+ (NSData * _Nonnull)payloadData:(MTPayloadData * _Nonnull)outPayloadData context:(MTContext * _Nonnull)context address:(MTDatacenterAddress * _Nonnull)address;
|
||||
|
||||
+ (MTSignal *)discoverSchemeWithContext:(MTContext *)context datacenterId:(NSInteger)datacenterId addressList:(NSArray *)addressList media:(bool)media isProxy:(bool)isProxy;
|
||||
+ (MTSignal * _Nonnull)discoverSchemeWithContext:(MTContext * _Nonnull)context datacenterId:(NSInteger)datacenterId addressList:(NSArray * _Nonnull)addressList media:(bool)media isProxy:(bool)isProxy;
|
||||
|
||||
+ (MTSignal * _Nonnull)checkIfAuthKeyRemovedWithContext:(MTContext * _Nonnull)context datacenterId:(NSInteger)datacenterId authKey:(MTDatacenterAuthKey *)authKey;
|
||||
+ (MTSignal * _Nonnull)checkIfAuthKeyRemovedWithContext:(MTContext * _Nonnull)context datacenterId:(NSInteger)datacenterId authKey:(MTDatacenterAuthKey * _Nonnull)authKey;
|
||||
|
||||
@end
|
||||
|
@ -600,7 +600,7 @@ bool MTCheckIsSafePrime(id<EncryptionProvider> provider, NSData *numberBytes, id
|
||||
id<MTBignum> bnNumberMinusOneDivByTwo = [context create];
|
||||
[context rightShift1Bit:bnNumberMinusOneDivByTwo a:bnNumberMinusOne];
|
||||
|
||||
int result = [context isPrime:bnNumberMinusOneDivByTwo numberOfChecks:30];
|
||||
result = [context isPrime:bnNumberMinusOneDivByTwo numberOfChecks:30];
|
||||
}
|
||||
|
||||
[keychain setObject:@(result == 1) forKey:primeKey group:@"primes"];
|
||||
|
@ -137,7 +137,6 @@ static void MTNetworkAvailabilityContextRelease(const void *info)
|
||||
[[MTNetworkAvailability networkAvailabilityQueue] dispatchOnQueue:^
|
||||
{
|
||||
BOOL isReachable = ((flags & kSCNetworkReachabilityFlagsReachable) != 0);
|
||||
BOOL needsConnection = ((flags & kSCNetworkReachabilityFlagsConnectionRequired) != 0);
|
||||
BOOL canConnectionAutomatically = (((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) ||
|
||||
((flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0));
|
||||
BOOL canConnectWithoutUserInteraction = (canConnectionAutomatically &&
|
||||
|
@ -117,7 +117,7 @@
|
||||
|
||||
if (request.requestContext.messageId != 0) {
|
||||
if (MTLogEnabled()) {
|
||||
MTLog(@"[MTRequestMessageService#%x drop %" PRId64 "]", (int)self, request.requestContext.messageId);
|
||||
MTLog(@"[MTRequestMessageService#%llx drop %" PRId64 "]", (intptr_t)self, request.requestContext.messageId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -933,8 +933,8 @@
|
||||
request.requestContext.responseMessageId = responseMessageId;
|
||||
return true;
|
||||
} else {
|
||||
MTLog(@"[MTRequestMessageService#%x will not request message %" PRId64 " (transaction was not completed)]", (int)self, messageId);
|
||||
MTLog(@"[MTRequestMessageService#%x but today it will]", (int)self);
|
||||
MTLog(@"[MTRequestMessageService#%llx will not request message %" PRId64 " (transaction was not completed)]", (intptr_t)self, messageId);
|
||||
MTLog(@"[MTRequestMessageService#%llx but today it will]", (intptr_t)self);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ static void generate_public_key(unsigned char key[32], id<EncryptionProvider> pr
|
||||
}
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
/*typedef enum {
|
||||
HelloGenerationCommandInvalid = 0,
|
||||
HelloGenerationCommandString = 1,
|
||||
HelloGenerationCommandZero = 2,
|
||||
@ -471,7 +471,7 @@ static NSData *executeGenerationCode(id<EncryptionProvider> provider, NSData *do
|
||||
((uint8_t *)resultData.mutableBytes)[paddingLengthPosition + 1] = ((uint8_t *)&calculatedLength)[0];
|
||||
|
||||
return resultData;
|
||||
}
|
||||
}*/
|
||||
|
||||
@interface MTTcpConnectionData : NSObject
|
||||
|
||||
@ -861,14 +861,14 @@ struct ctr_state {
|
||||
if (MTLogEnabled()) {
|
||||
if (strongSelf->_socksIp != nil) {
|
||||
if (strongSelf->_socksUsername.length == 0) {
|
||||
MTLog(@"[MTTcpConnection#%x connecting to %@:%d via %@:%d]", (int)strongSelf, strongSelf->_scheme.address.ip, (int)strongSelf->_scheme.address.port, strongSelf->_socksIp, (int)strongSelf->_socksPort);
|
||||
MTLog(@"[MTTcpConnection#%llx connecting to %@:%d via %@:%d]", (intptr_t)strongSelf, strongSelf->_scheme.address.ip, (int)strongSelf->_scheme.address.port, strongSelf->_socksIp, (int)strongSelf->_socksPort);
|
||||
} else {
|
||||
MTLog(@"[MTTcpConnection#%x connecting to %@:%d via %@:%d using %@:%@]", (int)strongSelf, strongSelf->_scheme.address.ip, (int)strongSelf->_scheme.address.port, strongSelf->_socksIp, (int)strongSelf->_socksPort, strongSelf->_socksUsername, strongSelf->_socksPassword);
|
||||
MTLog(@"[MTTcpConnection#%llx connecting to %@:%d via %@:%d using %@:%@]", (intptr_t)strongSelf, strongSelf->_scheme.address.ip, (int)strongSelf->_scheme.address.port, strongSelf->_socksIp, (int)strongSelf->_socksPort, strongSelf->_socksUsername, strongSelf->_socksPassword);
|
||||
}
|
||||
} else if (strongSelf->_mtpIp != nil) {
|
||||
MTLog(@"[MTTcpConnection#%x connecting to %@:%d via mtp://%@:%d:%@]", (int)strongSelf, strongSelf->_scheme.address.ip, (int)strongSelf->_scheme.address.port, strongSelf->_mtpIp, (int)strongSelf->_mtpPort, strongSelf->_mtpSecret);
|
||||
MTLog(@"[MTTcpConnection#%llx connecting to %@:%d via mtp://%@:%d:%@]", (intptr_t)strongSelf, strongSelf->_scheme.address.ip, (int)strongSelf->_scheme.address.port, strongSelf->_mtpIp, (int)strongSelf->_mtpPort, strongSelf->_mtpSecret);
|
||||
} else {
|
||||
MTLog(@"[MTTcpConnection#%x connecting to %@:%d]", (int)strongSelf, strongSelf->_scheme.address.ip, (int)strongSelf->_scheme.address.port);
|
||||
MTLog(@"[MTTcpConnection#%llx connecting to %@:%d]", (intptr_t)strongSelf, strongSelf->_scheme.address.ip, (int)strongSelf->_scheme.address.port);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1280,7 +1280,7 @@ struct ctr_state {
|
||||
_responseTimeoutTimer = nil;
|
||||
|
||||
if (MTLogEnabled()) {
|
||||
MTLog(@"[MTTcpConnection#%x response timeout]", (int)self);
|
||||
MTLog(@"[MTTcpConnection#%llx response timeout]", (intptr_t)self);
|
||||
}
|
||||
[self closeAndNotifyWithError:true];
|
||||
}
|
||||
@ -1421,7 +1421,7 @@ struct ctr_state {
|
||||
|
||||
if (resp.Reply != 0x00) {
|
||||
if (MTLogEnabled()) {
|
||||
MTLog(@"***** %x %s: socks5 connect failed, error 0x%02x", (int)self, __PRETTY_FUNCTION__, resp.Reply);
|
||||
MTLog(@"***** %llx %s: socks5 connect failed, error 0x%02x", (intptr_t)self, __PRETTY_FUNCTION__, resp.Reply);
|
||||
}
|
||||
[self closeAndNotifyWithError:true];
|
||||
return;
|
||||
@ -1772,7 +1772,7 @@ struct ctr_state {
|
||||
} else {
|
||||
if (length > 16 * 1024 * 1024) {
|
||||
if (MTLogEnabled()) {
|
||||
MTLog(@"[MTTcpConnection#%x received invalid length %d]", (int)self, length);
|
||||
MTLog(@"[MTTcpConnection#%llx received invalid length %d]", (intptr_t)self, length);
|
||||
}
|
||||
[self closeAndNotifyWithError:true];
|
||||
} else {
|
||||
@ -1848,7 +1848,7 @@ struct ctr_state {
|
||||
}
|
||||
} else if (header == 0 && packetData.length < 16) {
|
||||
if (MTLogEnabled()) {
|
||||
MTLog(@"[MTTcpConnection#%x received nop packet]", (int)self);
|
||||
MTLog(@"[MTTcpConnection#%llx received nop packet]", (intptr_t)self);
|
||||
}
|
||||
ignorePacket = true;
|
||||
}
|
||||
@ -1907,12 +1907,12 @@ struct ctr_state {
|
||||
{
|
||||
if (error != nil) {
|
||||
if (MTLogEnabled()) {
|
||||
MTLog(@"[MTTcpConnection#%x disconnected from %@ (%@)]", (int)self, _scheme.address.ip, error);
|
||||
MTLog(@"[MTTcpConnection#%llx disconnected from %@ (%@)]", (intptr_t)self, _scheme.address.ip, error);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (MTLogEnabled()) {
|
||||
MTLog(@"[MTTcpConnection#%x disconnected from %@]", (int)self, _scheme.address.ip);
|
||||
MTLog(@"[MTTcpConnection#%llx disconnected from %@]", (intptr_t)self, _scheme.address.ip);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -573,7 +573,7 @@ static const NSTimeInterval MTTcpTransportSleepWatchdogTimeout = 60.0;
|
||||
if (!transportContext.didSendActualizationPingAfterConnection)
|
||||
{
|
||||
if (MTLogEnabled()) {
|
||||
MTLog(@"[MTTcpTransport#%x unlocking transaction processing due to connection context update task]", (int)self);
|
||||
MTLog(@"[MTTcpTransport#%llx unlocking transaction processing due to connection context update task]", (intptr_t)self);
|
||||
}
|
||||
transportContext.isWaitingForTransactionToBecomeReady = false;
|
||||
transportContext.transactionLockTime = 0.0;
|
||||
@ -581,7 +581,7 @@ static const NSTimeInterval MTTcpTransportSleepWatchdogTimeout = 60.0;
|
||||
else if (CFAbsoluteTimeGetCurrent() > transportContext.transactionLockTime + 1.0)
|
||||
{
|
||||
if (MTLogEnabled()) {
|
||||
MTLog(@"[MTTcpTransport#%x unlocking transaction processing due to timeout]", (int)self);
|
||||
MTLog(@"[MTTcpTransport#%llx unlocking transaction processing due to timeout]", (intptr_t)self);
|
||||
}
|
||||
transportContext.isWaitingForTransactionToBecomeReady = false;
|
||||
transportContext.transactionLockTime = 0.0;
|
||||
@ -589,7 +589,7 @@ static const NSTimeInterval MTTcpTransportSleepWatchdogTimeout = 60.0;
|
||||
else
|
||||
{
|
||||
if (MTLogEnabled()) {
|
||||
MTLog(@"[MTTcpTransport#%x skipping transaction request]", (int)self);
|
||||
MTLog(@"[MTTcpTransport#%llx skipping transaction request]", (intptr_t)self);
|
||||
}
|
||||
transportContext.requestAnotherTransactionWhenReady = true;
|
||||
|
||||
|
@ -364,7 +364,7 @@ private enum MultipartFetchSource {
|
||||
var ivOffset: Int32 = (offset / 16).bigEndian
|
||||
memcpy(bytes.advanced(by: partIvCount - 4), &ivOffset, 4)
|
||||
}
|
||||
return .single(MTAesCtrDecrypt(bytes.makeData(), key, partIv))
|
||||
return .single(MTAesCtrDecrypt(bytes.makeData(), key, partIv)!)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -493,7 +493,7 @@ func initializedNetwork(accountId: AccountRecordId, arguments: NetworkInitializa
|
||||
context = current
|
||||
context.updateApiEnvironment({ _ in return apiEnvironment})
|
||||
} else {
|
||||
context = MTContext(serialization: serialization, encryptionProvider: arguments.encryptionProvider, apiEnvironment: apiEnvironment, isTestingEnvironment: testingEnvironment, useTempAuthKeys: useTempAuthKeys)!
|
||||
context = MTContext(serialization: serialization, encryptionProvider: arguments.encryptionProvider, apiEnvironment: apiEnvironment, isTestingEnvironment: testingEnvironment, useTempAuthKeys: useTempAuthKeys)
|
||||
store.contexts[key] = context
|
||||
}
|
||||
contextValue = context
|
||||
|
@ -14,7 +14,7 @@ private func messageKey(key: SecretChatKey, msgKey: UnsafeRawPointer, mode: Secr
|
||||
memcpy(bytes, msgKey, 16)
|
||||
memcpy(bytes.advanced(by: 16), key.key.memory.advanced(by: x), 32)
|
||||
}
|
||||
let sha1A = MTSha1(sha1AData)!
|
||||
let sha1A = MTSha1(sha1AData)
|
||||
|
||||
var sha1BData = Data()
|
||||
sha1BData.count = 16 + 16 + 16
|
||||
@ -23,7 +23,7 @@ private func messageKey(key: SecretChatKey, msgKey: UnsafeRawPointer, mode: Secr
|
||||
memcpy(bytes.advanced(by: 16), msgKey, 16)
|
||||
memcpy(bytes.advanced(by: 16 + 16), key.key.memory.advanced(by: 48 + x), 16)
|
||||
}
|
||||
let sha1B = MTSha1(sha1BData)!
|
||||
let sha1B = MTSha1(sha1BData)
|
||||
|
||||
var sha1CData = Data()
|
||||
sha1CData.count = 32 + 16
|
||||
@ -31,7 +31,7 @@ private func messageKey(key: SecretChatKey, msgKey: UnsafeRawPointer, mode: Secr
|
||||
memcpy(bytes, key.key.memory.advanced(by: 64 + x), 32)
|
||||
memcpy(bytes.advanced(by: 32), msgKey, 16)
|
||||
}
|
||||
let sha1C = MTSha1(sha1CData)!
|
||||
let sha1C = MTSha1(sha1CData)
|
||||
|
||||
var sha1DData = Data()
|
||||
sha1DData.count = 16 + 32
|
||||
@ -39,7 +39,7 @@ private func messageKey(key: SecretChatKey, msgKey: UnsafeRawPointer, mode: Secr
|
||||
memcpy(bytes, msgKey, 16)
|
||||
memcpy(bytes.advanced(by: 16), key.key.memory.advanced(by: 96 + x), 32)
|
||||
}
|
||||
let sha1D = MTSha1(sha1DData)!
|
||||
let sha1D = MTSha1(sha1DData)
|
||||
|
||||
var aesKey = Data()
|
||||
aesKey.count = 8 + 12 + 12
|
||||
@ -85,13 +85,13 @@ private func messageKey(key: SecretChatKey, msgKey: UnsafeRawPointer, mode: Secr
|
||||
sha256_a_data.append(msgKey.assumingMemoryBound(to: UInt8.self), count: 16)
|
||||
sha256_a_data.append(key.key.memory.assumingMemoryBound(to: UInt8.self).advanced(by: xValue), count: 36)
|
||||
|
||||
let sha256_a = MTSha256(sha256_a_data)!
|
||||
let sha256_a = MTSha256(sha256_a_data)
|
||||
|
||||
var sha256_b_data = Data()
|
||||
sha256_b_data.append(key.key.memory.assumingMemoryBound(to: UInt8.self).advanced(by: 40 + xValue), count: 36)
|
||||
sha256_b_data.append(msgKey.assumingMemoryBound(to: UInt8.self), count: 16)
|
||||
|
||||
let sha256_b = MTSha256(sha256_b_data)!
|
||||
let sha256_b = MTSha256(sha256_b_data)
|
||||
|
||||
var aesKey = Data()
|
||||
aesKey.append(sha256_a.subdata(in: 0 ..< (0 + 8)))
|
||||
@ -136,7 +136,7 @@ func withDecryptedMessageContents(parameters: SecretChatEncryptionParameters, da
|
||||
return nil
|
||||
}
|
||||
|
||||
let calculatedMsgKeyData = MTSubdataSha1(decryptedData, 0, UInt(payloadLength) + 4)!
|
||||
let calculatedMsgKeyData = MTSubdataSha1(decryptedData, 0, UInt(payloadLength) + 4)
|
||||
let msgKeyMatches = calculatedMsgKeyData.withUnsafeBytes { (bytes: UnsafePointer<UInt8>) -> Bool in
|
||||
return memcmp(bytes.advanced(by: calculatedMsgKeyData.count - 16), msgKey, 16) == 0
|
||||
}
|
||||
@ -184,7 +184,7 @@ func withDecryptedMessageContents(parameters: SecretChatEncryptionParameters, da
|
||||
keyLargeData.append(parameters.key.key.memory.assumingMemoryBound(to: UInt8.self).advanced(by: 88 + xValue), count: 32)
|
||||
keyLargeData.append(decryptedData)
|
||||
|
||||
let keyLarge = MTSha256(keyLargeData)!
|
||||
let keyLarge = MTSha256(keyLargeData)
|
||||
let localMessageKey = keyLarge.subdata(in: 8 ..< (8 + 16))
|
||||
|
||||
let msgKeyData = Data(bytes: msgKey.assumingMemoryBound(to: UInt8.self), count: 16)
|
||||
@ -230,7 +230,7 @@ func encryptedMessageContents(parameters: SecretChatEncryptionParameters, data:
|
||||
|
||||
switch parameters.mode {
|
||||
case .v1:
|
||||
var msgKey = MTSha1(payloadData)!
|
||||
var msgKey = MTSha1(payloadData)
|
||||
msgKey.replaceSubrange(0 ..< (msgKey.count - 16), with: Data())
|
||||
|
||||
var randomBuf = malloc(16)!
|
||||
@ -301,7 +301,7 @@ func encryptedMessageContents(parameters: SecretChatEncryptionParameters, data:
|
||||
|
||||
keyData.append(decryptedData)
|
||||
|
||||
let keyLarge = MTSha256(keyData)!
|
||||
let keyLarge = MTSha256(keyData)
|
||||
|
||||
let msgKey = keyLarge.subdata(in: 8 ..< (8 + 16))
|
||||
|
||||
|
@ -59,7 +59,7 @@ func secretChatAdvanceRekeySessionIfNeeded(encryptionProvider: EncryptionProvide
|
||||
}
|
||||
}
|
||||
|
||||
let keyHash = MTSha1(key)!
|
||||
let keyHash = MTSha1(key)
|
||||
|
||||
var keyFingerprint: Int64 = 0
|
||||
keyHash.withUnsafeBytes { (bytes: UnsafePointer<UInt8>) -> Void in
|
||||
|
@ -40,7 +40,7 @@ func updateSecretChat(encryptionProvider: EncryptionProvider, accountPeerId: Pee
|
||||
}
|
||||
}
|
||||
|
||||
let keyHash = MTSha1(key)!
|
||||
let keyHash = MTSha1(key)
|
||||
|
||||
var keyFingerprint: Int64 = 0
|
||||
keyHash.withUnsafeBytes { (bytes: UnsafePointer<UInt8>) -> Void in
|
||||
|
@ -685,14 +685,14 @@ private final class CallSessionManagerContext {
|
||||
}
|
||||
}
|
||||
|
||||
let keyHash = MTSha1(key)!
|
||||
let keyHash = MTSha1(key)
|
||||
|
||||
var keyId: Int64 = 0
|
||||
keyHash.withUnsafeBytes { (bytes: UnsafePointer<UInt8>) -> Void in
|
||||
memcpy(&keyId, bytes.advanced(by: keyHash.count - 8), 8)
|
||||
}
|
||||
|
||||
let keyVisualHash = MTSha256(key + gA)!
|
||||
let keyVisualHash = MTSha256(key + gA)
|
||||
|
||||
context.state = .confirming(id: id, accessHash: accessHash, key: key, keyId: keyId, keyVisualHash: keyVisualHash, disposable: (confirmCallSession(network: self.network, stableId: id, accessHash: accessHash, gA: gA, keyFingerprint: keyId, maxLayer: self.maxLayer, versions: selectedVersions) |> deliverOnMainQueue).start(next: { [weak self] updatedCall in
|
||||
if let strongSelf = self, let context = strongSelf.contexts[internalId], case .confirming = context.state {
|
||||
@ -888,18 +888,18 @@ private final class CallSessionManagerContext {
|
||||
}
|
||||
}
|
||||
|
||||
let keyHash = MTSha1(key)!
|
||||
let keyHash = MTSha1(key)
|
||||
|
||||
var keyId: Int64 = 0
|
||||
keyHash.withUnsafeBytes { (bytes: UnsafePointer<UInt8>) -> Void in
|
||||
memcpy(&keyId, bytes.advanced(by: keyHash.count - 8), 8)
|
||||
}
|
||||
|
||||
if MTSha256(gA)! != gAHash {
|
||||
if MTSha256(gA) != gAHash {
|
||||
return nil
|
||||
}
|
||||
|
||||
let keyVisualHash = MTSha256(key + gA)!
|
||||
let keyVisualHash = MTSha256(key + gA)
|
||||
|
||||
return (key, keyId, keyVisualHash)
|
||||
}
|
||||
@ -1161,7 +1161,7 @@ private func requestCallSession(postbox: Postbox, network: Network, peerId: Peer
|
||||
return .single(.failed(.generic))
|
||||
}
|
||||
|
||||
let gAHash = MTSha256(ga)!
|
||||
let gAHash = MTSha256(ga)
|
||||
|
||||
var callFlags: Int32 = 0
|
||||
if isVideo {
|
||||
|
@ -219,7 +219,7 @@ private func initialHandshakeAccept(postbox: Postbox, network: Network, peerId:
|
||||
}
|
||||
}
|
||||
|
||||
let keyHash = MTSha1(key)!
|
||||
let keyHash = MTSha1(key)
|
||||
|
||||
var keyFingerprint: Int64 = 0
|
||||
keyHash.withUnsafeBytes { (bytes: UnsafePointer<UInt8>) -> Void in
|
||||
@ -321,7 +321,7 @@ private func pfsAcceptKey(postbox: Postbox, network: Network, peerId: PeerId, la
|
||||
}
|
||||
}
|
||||
|
||||
let keyHash = MTSha1(key)!
|
||||
let keyHash = MTSha1(key)
|
||||
|
||||
var keyFingerprint: Int64 = 0
|
||||
keyHash.withUnsafeBytes { (bytes: UnsafePointer<UInt8>) -> Void in
|
||||
|
@ -258,7 +258,7 @@ public class Serialization: NSObject, MTSerialization {
|
||||
let restrictToTcp = (flags & (1 << 2)) != 0
|
||||
let isCdn = (flags & (1 << 3)) != 0
|
||||
let preferForProxy = (flags & (1 << 4)) != 0
|
||||
addressDict[id as NSNumber]!.append(MTDatacenterAddress(ip: ipAddress, port: UInt16(port), preferForMedia: preferForMedia, restrictToTcp: restrictToTcp, cdn: isCdn, preferForProxy: preferForProxy, secret: secret?.makeData())!)
|
||||
addressDict[id as NSNumber]!.append(MTDatacenterAddress(ip: ipAddress, port: UInt16(port), preferForMedia: preferForMedia, restrictToTcp: restrictToTcp, cdn: isCdn, preferForProxy: preferForProxy, secret: secret?.makeData()))
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -24,9 +24,9 @@ private func accountInfo(account: Account) -> Signal<StoredAccountInfo, NoError>
|
||||
if let authInfo = context.authInfoForDatacenter(withId: id, selector: .persistent), let authKey = authInfo.authKey {
|
||||
let transportScheme = context.chooseTransportSchemeForConnection(toDatacenterId: id, schemes: context.transportSchemesForDatacenter(withId: id, media: true, enforceMedia: false, isProxy: false))
|
||||
var addressList: [AccountDatacenterAddress] = []
|
||||
if let transportScheme = transportScheme, let address = transportScheme.address, let host = address.host {
|
||||
let secret: Data? = address.secret
|
||||
addressList.append(AccountDatacenterAddress(host: host, port: Int32(address.port), isMedia: address.preferForMedia, secret: secret))
|
||||
if let transportScheme = transportScheme, let host = transportScheme.address.host {
|
||||
let secret: Data? = transportScheme.address.secret
|
||||
addressList.append(AccountDatacenterAddress(host: host, port: Int32(transportScheme.address.port), isMedia: transportScheme.address.preferForMedia, secret: secret))
|
||||
}
|
||||
|
||||
var ephemeralMainKey: AccountDatacenterKey?
|
||||
|
Loading…
x
Reference in New Issue
Block a user