Respond to CR.

pull/1/head
Matthew Chen 7 years ago
parent c0f4254599
commit bb5c9ff106

@ -7,6 +7,15 @@ NS_ASSUME_NONNULL_BEGIN
@class ECKeyPair; @class ECKeyPair;
@class OWSAES256Key; @class OWSAES256Key;
@interface RemoteAttestationAuth : NSObject
@property (nonatomic, readonly) NSString *username;
@property (nonatomic, readonly) NSString *password;
@end
#pragma mark -
@interface RemoteAttestationKeys : NSObject @interface RemoteAttestationKeys : NSObject
@property (nonatomic, readonly) ECKeyPair *keyPair; @property (nonatomic, readonly) ECKeyPair *keyPair;
@ -18,17 +27,20 @@ NS_ASSUME_NONNULL_BEGIN
@end @end
#pragma mark -
@interface RemoteAttestation : NSObject @interface RemoteAttestation : NSObject
@property (nonatomic, readonly) RemoteAttestationKeys *keys; @property (nonatomic, readonly) RemoteAttestationKeys *keys;
@property (nonatomic, readonly) NSArray<NSHTTPCookie *> *cookies; @property (nonatomic, readonly) NSArray<NSHTTPCookie *> *cookies;
@property (nonatomic, readonly) NSData *requestId; @property (nonatomic, readonly) NSData *requestId;
@property (nonatomic, readonly) NSString *enclaveId; @property (nonatomic, readonly) NSString *enclaveId;
@property (nonatomic, readonly) NSString *authUsername; @property (nonatomic, readonly) RemoteAttestationAuth *auth;
@property (nonatomic, readonly) NSString *authToken;
@end @end
#pragma mark -
@interface ContactDiscoveryService : NSObject @interface ContactDiscoveryService : NSObject
- (instancetype)init NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE;

@ -16,7 +16,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface RemoteAttestationAuth : NSObject @interface RemoteAttestationAuth ()
@property (nonatomic) NSString *username; @property (nonatomic) NSString *username;
@property (nonatomic) NSString *password; @property (nonatomic) NSString *password;
@ -152,16 +152,6 @@ NS_ASSUME_NONNULL_BEGIN
@implementation RemoteAttestation @implementation RemoteAttestation
- (NSString *)authUsername
{
return self.auth.username;
}
- (NSString *)authToken
{
return self.auth.password;
}
@end @end
#pragma mark - #pragma mark -

@ -7,9 +7,6 @@ import Foundation
@objc(OWSLegacyContactDiscoveryOperation) @objc(OWSLegacyContactDiscoveryOperation)
class LegacyContactDiscoveryBatchOperation: OWSOperation { class LegacyContactDiscoveryBatchOperation: OWSOperation {
// TODO: Remove this feature flag.
private let isCDSEnabled = true
@objc @objc
var registeredRecipientIds: Set<String> var registeredRecipientIds: Set<String>
@ -86,9 +83,6 @@ class LegacyContactDiscoveryBatchOperation: OWSOperation {
// Called at most one time. // Called at most one time.
override func didSucceed() { override func didSucceed() {
guard isCDSEnabled else {
return
}
// Compare against new CDS service // Compare against new CDS service
let modernCDSOperation = CDSOperation(recipientIdsToLookup: self.recipientIdsToLookup) let modernCDSOperation = CDSOperation(recipientIdsToLookup: self.recipientIdsToLookup)
let cdsFeedbackOperation = CDSFeedbackOperation(legacyRegisteredRecipientIds: self.registeredRecipientIds) let cdsFeedbackOperation = CDSFeedbackOperation(legacyRegisteredRecipientIds: self.registeredRecipientIds)
@ -271,8 +265,8 @@ class CDSBatchOperation: OWSOperation {
cryptIv: encryptionResult.initializationVector, cryptIv: encryptionResult.initializationVector,
cryptMac: encryptionResult.authTag, cryptMac: encryptionResult.authTag,
enclaveId: remoteAttestation.enclaveId, enclaveId: remoteAttestation.enclaveId,
authUsername: remoteAttestation.authUsername, authUsername: remoteAttestation.auth.username,
authPassword: remoteAttestation.authToken, authPassword: remoteAttestation.auth.password,
cookies: remoteAttestation.cookies) cookies: remoteAttestation.cookies)
self.networkManager.makeRequest(request, self.networkManager.makeRequest(request,

@ -328,6 +328,7 @@ NS_ASSUME_NONNULL_BEGIN
// these cookies are ephemeral. // these cookies are ephemeral.
[request setHTTPShouldHandleCookies:NO]; [request setHTTPShouldHandleCookies:NO];
// Set the cookie header. // Set the cookie header.
OWSAssertDebug(request.allHTTPHeaderFields.count == 0);
[request setAllHTTPHeaderFields:[NSHTTPCookie requestHeaderFieldsWithCookies:cookies]]; [request setAllHTTPHeaderFields:[NSHTTPCookie requestHeaderFieldsWithCookies:cookies]];
return request; return request;

Loading…
Cancel
Save