Search in sources :

Example 1 with SignalServiceDataStoreImpl

use of org.thoughtcrime.securesms.crypto.storage.SignalServiceDataStoreImpl in project Signal-Android by WhisperSystems.

the class ApplicationDependencyProvider method provideProtocolStore.

@Override
@NonNull
public SignalServiceDataStoreImpl provideProtocolStore() {
    ACI localAci = SignalStore.account().getAci();
    PNI localPni = SignalStore.account().getPni();
    if (localAci == null) {
        throw new IllegalStateException("No ACI set!");
    }
    if (localPni == null) {
        throw new IllegalStateException("No PNI set!");
    }
    if (!SignalStore.account().hasPniIdentityKey()) {
        SignalStore.account().generatePniIdentityKeyIfNecessary();
        CreateSignedPreKeyJob.enqueueIfNeeded();
    }
    SignalBaseIdentityKeyStore baseIdentityStore = new SignalBaseIdentityKeyStore(context);
    SignalServiceAccountDataStoreImpl aciStore = new SignalServiceAccountDataStoreImpl(context, new TextSecurePreKeyStore(localAci), new SignalIdentityKeyStore(baseIdentityStore, () -> SignalStore.account().getAciIdentityKey()), new TextSecureSessionStore(localAci), new SignalSenderKeyStore(context));
    SignalServiceAccountDataStoreImpl pniStore = new SignalServiceAccountDataStoreImpl(context, new TextSecurePreKeyStore(localPni), new SignalIdentityKeyStore(baseIdentityStore, () -> SignalStore.account().getPniIdentityKey()), new TextSecureSessionStore(localPni), new SignalSenderKeyStore(context));
    return new SignalServiceDataStoreImpl(context, aciStore, pniStore);
}
Also used : TextSecureSessionStore(org.thoughtcrime.securesms.crypto.storage.TextSecureSessionStore) TextSecurePreKeyStore(org.thoughtcrime.securesms.crypto.storage.TextSecurePreKeyStore) ACI(org.whispersystems.signalservice.api.push.ACI) SignalSenderKeyStore(org.thoughtcrime.securesms.crypto.storage.SignalSenderKeyStore) PNI(org.whispersystems.signalservice.api.push.PNI) SignalIdentityKeyStore(org.thoughtcrime.securesms.crypto.storage.SignalIdentityKeyStore) SignalBaseIdentityKeyStore(org.thoughtcrime.securesms.crypto.storage.SignalBaseIdentityKeyStore) SignalServiceAccountDataStoreImpl(org.thoughtcrime.securesms.crypto.storage.SignalServiceAccountDataStoreImpl) SignalServiceDataStoreImpl(org.thoughtcrime.securesms.crypto.storage.SignalServiceDataStoreImpl) NonNull(androidx.annotation.NonNull)

Aggregations

NonNull (androidx.annotation.NonNull)1 SignalBaseIdentityKeyStore (org.thoughtcrime.securesms.crypto.storage.SignalBaseIdentityKeyStore)1 SignalIdentityKeyStore (org.thoughtcrime.securesms.crypto.storage.SignalIdentityKeyStore)1 SignalSenderKeyStore (org.thoughtcrime.securesms.crypto.storage.SignalSenderKeyStore)1 SignalServiceAccountDataStoreImpl (org.thoughtcrime.securesms.crypto.storage.SignalServiceAccountDataStoreImpl)1 SignalServiceDataStoreImpl (org.thoughtcrime.securesms.crypto.storage.SignalServiceDataStoreImpl)1 TextSecurePreKeyStore (org.thoughtcrime.securesms.crypto.storage.TextSecurePreKeyStore)1 TextSecureSessionStore (org.thoughtcrime.securesms.crypto.storage.TextSecureSessionStore)1 ACI (org.whispersystems.signalservice.api.push.ACI)1 PNI (org.whispersystems.signalservice.api.push.PNI)1