|
|
@ -219,14 +219,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NSString *path = [textSecureAccountsAPI stringByAppendingString:textSecureAttributesAPI];
|
|
|
|
NSString *path = [textSecureAccountsAPI stringByAppendingString:textSecureAttributesAPI];
|
|
|
|
|
|
|
|
|
|
|
|
NSString *signalingKey = self.tsAccountManager.signalingKey;
|
|
|
|
|
|
|
|
OWSAssertDebug(signalingKey.length > 0);
|
|
|
|
|
|
|
|
NSString *authKey = self.tsAccountManager.serverAuthToken;
|
|
|
|
NSString *authKey = self.tsAccountManager.serverAuthToken;
|
|
|
|
OWSAssertDebug(authKey.length > 0);
|
|
|
|
OWSAssertDebug(authKey.length > 0);
|
|
|
|
NSString *_Nullable pin = [self.ows2FAManager pinCode];
|
|
|
|
NSString *_Nullable pin = [self.ows2FAManager pinCode];
|
|
|
|
|
|
|
|
|
|
|
|
NSDictionary<NSString *, id> *accountAttributes =
|
|
|
|
NSDictionary<NSString *, id> *accountAttributes = [self accountAttributesWithPin:pin authKey:authKey];
|
|
|
|
[self accountAttributesWithPin:pin signalingKey:signalingKey authKey:authKey];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return [TSRequest requestWithUrl:[NSURL URLWithString:path] method:@"PUT" parameters:accountAttributes];
|
|
|
|
return [TSRequest requestWithUrl:[NSURL URLWithString:path] method:@"PUT" parameters:accountAttributes];
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -293,18 +290,16 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
+ (TSRequest *)verifyCodeRequestWithVerificationCode:(NSString *)verificationCode
|
|
|
|
+ (TSRequest *)verifyCodeRequestWithVerificationCode:(NSString *)verificationCode
|
|
|
|
forNumber:(NSString *)phoneNumber
|
|
|
|
forNumber:(NSString *)phoneNumber
|
|
|
|
pin:(nullable NSString *)pin
|
|
|
|
pin:(nullable NSString *)pin
|
|
|
|
signalingKey:(NSString *)signalingKey
|
|
|
|
|
|
|
|
authKey:(NSString *)authKey
|
|
|
|
authKey:(NSString *)authKey
|
|
|
|
{
|
|
|
|
{
|
|
|
|
OWSAssertDebug(verificationCode.length > 0);
|
|
|
|
OWSAssertDebug(verificationCode.length > 0);
|
|
|
|
OWSAssertDebug(phoneNumber.length > 0);
|
|
|
|
OWSAssertDebug(phoneNumber.length > 0);
|
|
|
|
OWSAssertDebug(signalingKey.length > 0);
|
|
|
|
|
|
|
|
OWSAssertDebug(authKey.length > 0);
|
|
|
|
OWSAssertDebug(authKey.length > 0);
|
|
|
|
|
|
|
|
|
|
|
|
NSString *path = [NSString stringWithFormat:@"%@/code/%@", textSecureAccountsAPI, verificationCode];
|
|
|
|
NSString *path = [NSString stringWithFormat:@"%@/code/%@", textSecureAccountsAPI, verificationCode];
|
|
|
|
|
|
|
|
|
|
|
|
NSMutableDictionary<NSString *, id> *accountAttributes =
|
|
|
|
NSMutableDictionary<NSString *, id> *accountAttributes =
|
|
|
|
[[self accountAttributesWithPin:pin signalingKey:signalingKey authKey:authKey] mutableCopy];
|
|
|
|
[[self accountAttributesWithPin:pin authKey:authKey] mutableCopy];
|
|
|
|
[accountAttributes removeObjectForKey:@"AuthKey"];
|
|
|
|
[accountAttributes removeObjectForKey:@"AuthKey"];
|
|
|
|
|
|
|
|
|
|
|
|
TSRequest *request =
|
|
|
|
TSRequest *request =
|
|
|
@ -316,10 +311,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ (NSDictionary<NSString *, id> *)accountAttributesWithPin:(nullable NSString *)pin
|
|
|
|
+ (NSDictionary<NSString *, id> *)accountAttributesWithPin:(nullable NSString *)pin
|
|
|
|
signalingKey:(NSString *)signalingKey
|
|
|
|
|
|
|
|
authKey:(NSString *)authKey
|
|
|
|
authKey:(NSString *)authKey
|
|
|
|
{
|
|
|
|
{
|
|
|
|
OWSAssertDebug(signalingKey.length > 0);
|
|
|
|
|
|
|
|
OWSAssertDebug(authKey.length > 0);
|
|
|
|
OWSAssertDebug(authKey.length > 0);
|
|
|
|
uint32_t registrationId = [self.tsAccountManager getOrGenerateRegistrationId];
|
|
|
|
uint32_t registrationId = [self.tsAccountManager getOrGenerateRegistrationId];
|
|
|
|
|
|
|
|
|
|
|
@ -334,8 +327,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
}
|
|
|
|
}
|
|
|
|
BOOL allowUnrestrictedUD = [self.udManager shouldAllowUnrestrictedAccessLocal] && udAccessKey != nil;
|
|
|
|
BOOL allowUnrestrictedUD = [self.udManager shouldAllowUnrestrictedAccessLocal] && udAccessKey != nil;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// We no longer include the signalingKey.
|
|
|
|
NSMutableDictionary *accountAttributes = [@{
|
|
|
|
NSMutableDictionary *accountAttributes = [@{
|
|
|
|
@"signalingKey" : signalingKey,
|
|
|
|
|
|
|
|
@"AuthKey" : authKey,
|
|
|
|
@"AuthKey" : authKey,
|
|
|
|
@"voice" : @(YES), // all Signal-iOS clients support voice
|
|
|
|
@"voice" : @(YES), // all Signal-iOS clients support voice
|
|
|
|
@"video" : @(YES), // all Signal-iOS clients support WebRTC-based voice and video calls.
|
|
|
|
@"video" : @(YES), // all Signal-iOS clients support WebRTC-based voice and video calls.
|
|
|
|