Added more loki databases.

This commit is contained in:
Mikunj
2019-06-04 12:12:40 +10:00
parent 4f8af1b4f2
commit bdc62a9645
6 changed files with 248 additions and 18 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;
@@ -92,6 +93,16 @@ public class PreKeyUtil {
// 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<>();