mirror of
https://github.com/oxen-io/session-android.git
synced 2025-03-28 12:52:14 +00:00
When processing PreKeyBundle, archive current session if it exists.
This commit is contained in:
parent
3e287f930d
commit
07c61394e9
@ -222,6 +222,7 @@ public class SessionBuilder {
|
||||
throw new InvalidKeyException("Both signed and unsigned prekeys are absent!");
|
||||
}
|
||||
|
||||
boolean isExistingSession = sessionStore.containsSession(recipientId, deviceId);
|
||||
SessionRecord sessionRecord = sessionStore.loadSession(recipientId, deviceId);
|
||||
ECKeyPair ourBaseKey = Curve.generateKeyPair();
|
||||
ECPublicKey theirSignedPreKey = preKey.getSignedPreKey() != null ? preKey.getSignedPreKey() :
|
||||
@ -238,8 +239,8 @@ public class SessionBuilder {
|
||||
Optional.fromNullable(preKey.getPreKey()) :
|
||||
Optional.<ECPublicKey>absent());
|
||||
|
||||
if (sessionRecord.getSessionState().getNeedsRefresh()) sessionRecord.archiveCurrentState();
|
||||
else sessionRecord.reset();
|
||||
if (isExistingSession) sessionRecord.archiveCurrentState();
|
||||
else sessionRecord.reset();
|
||||
|
||||
RatchetingSession.initializeSession(sessionRecord.getSessionState(),
|
||||
preKey.getSignedPreKey() == null ? 2 : 3,
|
||||
|
Loading…
x
Reference in New Issue
Block a user