Search in sources :

Example 1 with SignalSenderKeyStore

use of org.thoughtcrime.securesms.crypto.storage.SignalSenderKeyStore 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)

Example 2 with SignalSenderKeyStore

use of org.thoughtcrime.securesms.crypto.storage.SignalSenderKeyStore in project Signal-Android by signalapp.

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)2 SignalBaseIdentityKeyStore (org.thoughtcrime.securesms.crypto.storage.SignalBaseIdentityKeyStore)2 SignalIdentityKeyStore (org.thoughtcrime.securesms.crypto.storage.SignalIdentityKeyStore)2 SignalSenderKeyStore (org.thoughtcrime.securesms.crypto.storage.SignalSenderKeyStore)2 SignalServiceAccountDataStoreImpl (org.thoughtcrime.securesms.crypto.storage.SignalServiceAccountDataStoreImpl)2 SignalServiceDataStoreImpl (org.thoughtcrime.securesms.crypto.storage.SignalServiceDataStoreImpl)2 TextSecurePreKeyStore (org.thoughtcrime.securesms.crypto.storage.TextSecurePreKeyStore)2 TextSecureSessionStore (org.thoughtcrime.securesms.crypto.storage.TextSecureSessionStore)2 ACI (org.whispersystems.signalservice.api.push.ACI)2 PNI (org.whispersystems.signalservice.api.push.PNI)2