Sketch out OWSIdentityManager.

// FREEBIE
This commit is contained in:
Matthew Chen 2017-06-06 14:12:47 -04:00 committed by Michael Kirk
parent 847f9e50bb
commit ceb210748e
9 changed files with 35 additions and 36 deletions

View File

@ -3,10 +3,10 @@ source 'https://github.com/CocoaPods/Specs.git'
target 'Signal' do
pod 'SocketRocket', :git => 'https://github.com/facebook/SocketRocket.git'
pod 'AxolotlKit', git: 'https://github.com/WhisperSystems/SignalProtocolKit.git'
#pod 'AxolotlKit', path: '../SignalProtocolKit'
pod 'SignalServiceKit', git: 'https://github.com/WhisperSystems/SignalServiceKit.git'
#pod 'SignalServiceKit', path: '../SignalServiceKit'
#pod 'AxolotlKit', git: 'https://github.com/WhisperSystems/SignalProtocolKit.git'
pod 'AxolotlKit', path: '../SignalProtocolKit'
#pod 'SignalServiceKit', git: 'https://github.com/WhisperSystems/SignalServiceKit.git'
pod 'SignalServiceKit', path: '../SignalServiceKit'
pod 'OpenSSL'
pod 'JSQMessagesViewController', git: 'https://github.com/WhisperSystems/JSQMessagesViewController.git', branch: 'mkirk/position-edit-menu'
#pod 'JSQMessagesViewController' path: '../JSQMessagesViewController'

View File

@ -109,35 +109,29 @@ PODS:
- YapDatabase/SQLCipher/Core
DEPENDENCIES:
- AxolotlKit (from `https://github.com/WhisperSystems/SignalProtocolKit.git`)
- AxolotlKit (from `../SignalProtocolKit`)
- JSQMessagesViewController (from `https://github.com/WhisperSystems/JSQMessagesViewController.git`, branch `mkirk/position-edit-menu`)
- OpenSSL
- PureLayout
- Reachability
- SignalServiceKit (from `https://github.com/WhisperSystems/SignalServiceKit.git`)
- SignalServiceKit (from `../SignalServiceKit`)
- SocketRocket (from `https://github.com/facebook/SocketRocket.git`)
EXTERNAL SOURCES:
AxolotlKit:
:git: https://github.com/WhisperSystems/SignalProtocolKit.git
:path: ../SignalProtocolKit
JSQMessagesViewController:
:branch: mkirk/position-edit-menu
:git: https://github.com/WhisperSystems/JSQMessagesViewController.git
SignalServiceKit:
:git: https://github.com/WhisperSystems/SignalServiceKit.git
:path: ../SignalServiceKit
SocketRocket:
:git: https://github.com/facebook/SocketRocket.git
CHECKOUT OPTIONS:
AxolotlKit:
:commit: 9179d4e326df58185f35af45831e7a5d7250ab85
:git: https://github.com/WhisperSystems/SignalProtocolKit.git
JSQMessagesViewController:
:commit: 7054e4b13ee5bcd6d524adb6dc9a726e8c466308
:git: https://github.com/WhisperSystems/JSQMessagesViewController.git
SignalServiceKit:
:commit: 43d1aa49dc869486cdba8546b56e716beae5c1d0
:git: https://github.com/WhisperSystems/SignalServiceKit.git
SocketRocket:
:commit: 877ac7438be3ad0b45ef5ca3969574e4b97112bf
:git: https://github.com/facebook/SocketRocket.git
@ -164,6 +158,6 @@ SPEC CHECKSUMS:
UnionFind: c33be5adb12983981d6e827ea94fc7f9e370f52d
YapDatabase: cd911121580ff16675f65ad742a9eb0ab4d9e266
PODFILE CHECKSUM: 48e80d7f1e049bbf544a689fdfdf33e8196c640a
PODFILE CHECKSUM: dc5ed308ade575a81ccadf5c485990530353c4ee
COCOAPODS: 1.2.1

View File

@ -62,12 +62,12 @@ class ProfileFetcherJob: NSObject {
private func verifyIdentityUpToDateAsync(recipientId: String, latestIdentityKey: Data) {
OWSDispatch.sessionStoreQueue().async {
if self.storageManager.identityKey(forRecipientId: recipientId) == nil {
if OWSIdentityManager.shared().identityKey(forRecipientId: recipientId) == nil {
// first time use, do nothing, since there's no change.
return
}
if self.storageManager.saveRemoteIdentity(latestIdentityKey, recipientId: recipientId) {
if OWSIdentityManager.shared().saveRemoteIdentity(latestIdentityKey, recipientId: recipientId) {
Logger.info("\(self.TAG) updated identity key in fetched profile for recipient: \(recipientId)")
self.storageManager.deleteAllSessions(forContact: recipientId)
} else {

View File

@ -52,13 +52,14 @@
#import <SignalServiceKit/OWSDispatch.h>
#import <SignalServiceKit/OWSEndSessionMessage.h>
#import <SignalServiceKit/OWSError.h>
#import <SignalServiceKit/OWSFingerprint.h>
#import <SignalServiceKit/OWSFingerprintBuilder.h>
#import <SignalServiceKit/OWSGetMessagesRequest.h>
#import <SignalServiceKit/OWSGetProfileRequest.h>
#import <SignalServiceKit/OWSIdentityManager.h>
#import <SignalServiceKit/OWSMessageSender.h>
#import <SignalServiceKit/OWSOutgoingCallMessage.h>
#import <SignalServiceKit/OWSRecipientIdentity.h>
#import <SignalServiceKit/OWSFingerprintBuilder.h>
#import <SignalServiceKit/OWSFingerprint.h>
#import <SignalServiceKit/OWSSignalService.h>
#import <SignalServiceKit/OWSTurnServerInfoRequest.h>
#import <SignalServiceKit/PhoneNumber.h>
@ -77,7 +78,6 @@
#import <SignalServiceKit/TSNetworkManager.h>
#import <SignalServiceKit/TSSocketManager.h>
#import <SignalServiceKit/TSStorageManager+Calling.h>
#import <SignalServiceKit/TSStorageManager+IdentityKeyStore.h>
#import <SignalServiceKit/TSStorageManager+SessionStore.h>
#import <SignalServiceKit/TSStorageManager+keyingMaterial.h>
#import <SignalServiceKit/TSThread.h>

View File

@ -11,8 +11,8 @@
#import <SignalServiceKit/NSDate+millisecondTimeStamp.h>
#import <SignalServiceKit/OWSError.h>
#import <SignalServiceKit/OWSFingerprint.h>
#import <SignalServiceKit/OWSIdentityManager.h>
#import <SignalServiceKit/TSInfoMessage.h>
#import <SignalServiceKit/TSStorageManager+IdentityKeyStore.h>
#import <SignalServiceKit/TSStorageManager+SessionStore.h>
#import <SignalServiceKit/TSStorageManager+keyingMaterial.h>

View File

@ -8,7 +8,7 @@
#import "SettingsTableViewController.h"
#import <SignalServiceKit/ECKeyPair+OWSPrivateKey.h>
#import <SignalServiceKit/OWSDeviceProvisioner.h>
#import <SignalServiceKit/TSStorageManager+IdentityKeyStore.h>
#import <SignalServiceKit/OWSIdentityManager.h>
#import <SignalServiceKit/TSStorageManager+keyingMaterial.h>
NS_ASSUME_NONNULL_BEGIN
@ -128,8 +128,10 @@ NS_ASSUME_NONNULL_BEGIN
- (void)provisionWithParser:(OWSDeviceProvisioningURLParser *)parser
{
NSData *myPublicKey = [[TSStorageManager sharedManager] identityKeyPair].publicKey;
NSData *myPrivateKey = [[TSStorageManager sharedManager] identityKeyPair].ows_privateKey;
ECKeyPair *_Nullable identityKeyPair = [[OWSIdentityManager sharedManager] identityKeyPair];
OWSAssert(identityKeyPair);
NSData *myPublicKey = identityKeyPair.publicKey;
NSData *myPrivateKey = identityKeyPair.ows_privateKey;
NSString *accountIdentifier = [TSStorageManager localNumber];
OWSDeviceProvisioner *provisioner = [[OWSDeviceProvisioner alloc] initWithMyPublicKey:myPublicKey

View File

@ -4,6 +4,7 @@
import Foundation
// TODO:
class SafetyNumberConfirmationAlert: NSObject {
let TAG = "[SafetyNumberConfirmationAlert]"
@ -69,10 +70,8 @@ class SafetyNumberConfirmationAlert: NSObject {
Logger.info("\(self.TAG) Confirmed identity: \(untrustedIdentity)")
OWSDispatch.sessionStoreQueue().async {
self.storageManager.saveRemoteIdentity(untrustedIdentity.identityKey,
recipientId: untrustedIdentity.recipientId,
approvedForBlockingUse: true,
approvedForNonBlockingUse: true)
OWSIdentityManager.shared().saveRemoteIdentity(untrustedIdentity.identityKey,
recipientId: untrustedIdentity.recipientId)
MarkIdentityAsSeenJob.run(recipientId: untrustedIdentity.recipientId)
DispatchQueue.main.async {
completion(true)
@ -111,15 +110,19 @@ class SafetyNumberConfirmationAlert: NSObject {
}
private func unconfirmedIdentities(recipientIds: [String]) -> [OWSRecipientIdentity] {
return recipientIds.flatMap {
self.storageManager.unconfirmedIdentityThatShouldBlockSending(forRecipientId: $0)
}
// TODO: Return the _unverified_ identities.
return []
// return recipientIds.flatMap {
// OWSIdentityManager.shared().unconfirmedIdentityThatShouldBlockSending(forRecipientId: $0)
// }
}
private func unseenIdentities(recipientIds: [String]) -> [OWSRecipientIdentity] {
return recipientIds.flatMap {
self.storageManager.unseenIdentityChange(forRecipientId: $0)
}
// TODO: Return the _unverified_ identities.
return []
// return recipientIds.flatMap {
// OWSIdentityManager.shared().unseenIdentityChange(forRecipientId: $0)
// }
}
}

View File

@ -470,7 +470,7 @@ protocol CallServiceObserver: class {
let newCall = SignalCall.incomingCall(localId: UUID(), remotePhoneNumber: thread.contactIdentifier(), signalingId: callId)
guard self.storageManager.unseenIdentityChange(forRecipientId: thread.contactIdentifier()) == nil else {
guard OWSIdentityManager.shared().isCurrentIdentityTrustedForSending(withRecipientId: thread.contactIdentifier()) else {
let callerName = self.contactsManager.displayName(forPhoneIdentifier: thread.contactIdentifier())
self.notificationsAdapter.presentRejectedCallWithUnseenIdentityChange(newCall, callerName: callerName)
return

View File

@ -3,8 +3,8 @@
//
#import "OWS104CreateRecipientIdentities.h"
#import <SignalServiceKit/OWSIdentityManager.h>
#import <SignalServiceKit/OWSRecipientIdentity.h>
#import <SignalServiceKit/TSStorageManager+IdentityKeyStore.h>
#import <YapDatabase/YapDatabaseConnection.h>
#import <YapDatabase/YapDatabaseTransaction.h>