diff --git a/AxolotlKit/Classes/SessionCipher.m b/AxolotlKit/Classes/SessionCipher.m index ce6b745..92c93d3 100644 --- a/AxolotlKit/Classes/SessionCipher.m +++ b/AxolotlKit/Classes/SessionCipher.m @@ -124,9 +124,7 @@ static dispatch_queue_t _sessionCipherDispatchQueue; userInfo:@{}]; } - if ([self.identityKeyStore saveRemoteIdentity:sessionState.remoteIdentityKey recipientId:self.recipientId]) { - [sessionRecord removePreviousSessionStates]; - } + [self.identityKeyStore saveRemoteIdentity:sessionState.remoteIdentityKey recipientId:self.recipientId]; NSData *ciphertextBody = [AES_CBC encryptCBCMode:paddedMessage withKey:messageKeys.cipherKey withIV:messageKeys.iv]; @@ -202,11 +200,8 @@ static dispatch_queue_t _sessionCipherDispatchQueue; userInfo:@{}]; } - if ([self.identityKeyStore saveRemoteIdentity:sessionRecord.sessionState.remoteIdentityKey - recipientId:self.recipientId]) { - [sessionRecord removePreviousSessionStates]; - } - + [self.identityKeyStore saveRemoteIdentity:sessionRecord.sessionState.remoteIdentityKey + recipientId:self.recipientId]; [self.sessionStore storeSession:self.recipientId deviceId:self.deviceId session:sessionRecord]; return plaintext; diff --git a/AxolotlKit/Classes/Sessions/SessionBuilder.m b/AxolotlKit/Classes/Sessions/SessionBuilder.m index 0276f1b..9d4424e 100644 --- a/AxolotlKit/Classes/Sessions/SessionBuilder.m +++ b/AxolotlKit/Classes/Sessions/SessionBuilder.m @@ -141,14 +141,7 @@ const int kPreKeyOfLastResortId = 0xFFFFFF; break; } - BOOL previousIdentityExisted = - [self.identityStore saveRemoteIdentity:theirIdentityKey recipientId:self.recipientId]; - if (previousIdentityExisted) { - DDLogInfo(@"%@ PKWM removing previous session states for changed identity for recipient:%@", - self.tag, - self.recipientId); - [sessionRecord removePreviousSessionStates]; - } + [self.identityStore saveRemoteIdentity:theirIdentityKey recipientId:self.recipientId]; return unSignedPrekeyId; }