Merge branch 'master' of github.com:loki-project/loki-messenger-android

This commit is contained in:
Niels Andriesse
2019-06-04 14:07:56 +10:00
5 changed files with 161 additions and 3 deletions

View File

@@ -19,6 +19,7 @@ package org.thoughtcrime.securesms.crypto;
import android.content.Context;
import org.jetbrains.annotations.Nullable;
import org.thoughtcrime.securesms.crypto.storage.TextSecurePreKeyStore;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.whispersystems.libsignal.IdentityKeyPair;
@@ -90,7 +91,17 @@ public class PreKeyUtil {
return TextSecurePreferences.getActiveSignedPreKeyId(context);
}
// region - Loki
// region Loki
public static synchronized @Nullable SignedPreKeyRecord getActiveSignedPreKey(Context context) {
SignedPreKeyStore signedPreKeyStore = new TextSecurePreKeyStore(context);
try {
return signedPreKeyStore.loadSignedPreKey(getActiveSignedPreKeyId(context));
} catch (InvalidKeyIdException e) {
// Fall through
}
return null;
}
public synchronized static List<PreKeyRecord> generatePreKeys(Context context, int amount) {
PreKeyStore preKeyStore = new TextSecurePreKeyStore(context);
List<PreKeyRecord> records = new LinkedList<>();