mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-03 08:52:20 +00:00
Fix session handling
This commit is contained in:
@@ -94,7 +94,7 @@ public class IdentityKeyUtil {
|
||||
save(context, IDENTITY_PUBLIC_KEY_PREF, Base64.encodeBytes(publicKey.serialize()));
|
||||
save(context, IDENTITY_PRIVATE_KEY_PREF, Base64.encodeBytes(keyPair.getPrivateKey().serialize()));
|
||||
} catch (Exception e) {
|
||||
Log.d("Loki", "Couldn't restore key pair from seed due to error: " + e.getMessage());
|
||||
Log.d("Loki", "Couldn't restore key pair from seed due to error: " + e.getMessage() + ".");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -102,14 +102,12 @@ public class PreKeyUtil {
|
||||
}
|
||||
|
||||
public synchronized static List<PreKeyRecord> generatePreKeys(Context context, int amount) {
|
||||
PreKeyStore preKeyStore = new TextSecurePreKeyStore(context);
|
||||
List<PreKeyRecord> records = new LinkedList<>();
|
||||
int preKeyIDOffset = TextSecurePreferences.getNextPreKeyId(context);
|
||||
for (int i = 0; i < amount; i++) {
|
||||
int preKeyID = (preKeyIDOffset + i) % Medium.MAX_VALUE;
|
||||
ECKeyPair keyPair = Curve.generateKeyPair();
|
||||
PreKeyRecord record = new PreKeyRecord(preKeyID, keyPair);
|
||||
preKeyStore.storePreKey(preKeyID, record);
|
||||
records.add(record);
|
||||
}
|
||||
TextSecurePreferences.setNextPreKeyId(context, (preKeyIDOffset + BATCH_SIZE + 1) % Medium.MAX_VALUE);
|
||||
|
||||
@@ -92,8 +92,8 @@ public class TextSecureSessionStore implements LokiSessionDatabaseProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
public void archiveAllSessions(@NonNull String name) {
|
||||
SignalProtocolAddress address = new SignalProtocolAddress(name, -1);
|
||||
public void archiveAllSessions(@NonNull String hexEncodedPublicKey) {
|
||||
SignalProtocolAddress address = new SignalProtocolAddress(hexEncodedPublicKey, -1);
|
||||
archiveSiblingSessions(address);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user