mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-17 13:58:25 +00:00
Integrate SSKs into the encryption pipeline
This commit is contained in:
parent
1e223c90ca
commit
86837f031a
@ -186,6 +186,7 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
|||||||
LokiAPIDatabase apiDB = DatabaseFactory.getLokiAPIDatabase(this);
|
LokiAPIDatabase apiDB = DatabaseFactory.getLokiAPIDatabase(this);
|
||||||
LokiThreadDatabase threadDB = DatabaseFactory.getLokiThreadDatabase(this);
|
LokiThreadDatabase threadDB = DatabaseFactory.getLokiThreadDatabase(this);
|
||||||
LokiUserDatabase userDB = DatabaseFactory.getLokiUserDatabase(this);
|
LokiUserDatabase userDB = DatabaseFactory.getLokiUserDatabase(this);
|
||||||
|
SharedSenderKeysDatabase sskDatabase = DatabaseFactory.getSSKDatabase(this);
|
||||||
String userPublicKey = TextSecurePreferences.getLocalNumber(this);
|
String userPublicKey = TextSecurePreferences.getLocalNumber(this);
|
||||||
SessionResetImplementation sessionResetImpl = new SessionResetImplementation(this);
|
SessionResetImplementation sessionResetImpl = new SessionResetImplementation(this);
|
||||||
if (userPublicKey != null) {
|
if (userPublicKey != null) {
|
||||||
@ -196,7 +197,7 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
|||||||
SyncMessagesProtocol.Companion.configureIfNeeded(apiDB, userPublicKey);
|
SyncMessagesProtocol.Companion.configureIfNeeded(apiDB, userPublicKey);
|
||||||
}
|
}
|
||||||
MultiDeviceProtocol.Companion.configureIfNeeded(apiDB);
|
MultiDeviceProtocol.Companion.configureIfNeeded(apiDB);
|
||||||
SessionManagementProtocol.Companion.configureIfNeeded(sessionResetImpl, threadDB, this);
|
SessionManagementProtocol.Companion.configureIfNeeded(sessionResetImpl, sskDatabase, this);
|
||||||
setUpP2PAPIIfNeeded();
|
setUpP2PAPIIfNeeded();
|
||||||
PushNotificationAcknowledgement.Companion.configureIfNeeded(BuildConfig.DEBUG);
|
PushNotificationAcknowledgement.Companion.configureIfNeeded(BuildConfig.DEBUG);
|
||||||
if (setUpStorageAPIIfNeeded()) {
|
if (setUpStorageAPIIfNeeded()) {
|
||||||
|
@ -153,6 +153,7 @@ public class SignalCommunicationModule {
|
|||||||
Optional.of(new MessageSenderEventListener(context)),
|
Optional.of(new MessageSenderEventListener(context)),
|
||||||
TextSecurePreferences.getLocalNumber(context),
|
TextSecurePreferences.getLocalNumber(context),
|
||||||
DatabaseFactory.getLokiAPIDatabase(context),
|
DatabaseFactory.getLokiAPIDatabase(context),
|
||||||
|
DatabaseFactory.getSSKDatabase(context),
|
||||||
DatabaseFactory.getLokiThreadDatabase(context),
|
DatabaseFactory.getLokiThreadDatabase(context),
|
||||||
DatabaseFactory.getLokiMessageDatabase(context),
|
DatabaseFactory.getLokiMessageDatabase(context),
|
||||||
DatabaseFactory.getLokiPreKeyBundleDatabase(context),
|
DatabaseFactory.getLokiPreKeyBundleDatabase(context),
|
||||||
|
@ -255,7 +255,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
|||||||
SignalProtocolStore axolotlStore = new SignalProtocolStoreImpl(context);
|
SignalProtocolStore axolotlStore = new SignalProtocolStoreImpl(context);
|
||||||
SessionResetProtocol sessionResetProtocol = new SessionResetImplementation(context);
|
SessionResetProtocol sessionResetProtocol = new SessionResetImplementation(context);
|
||||||
SignalServiceAddress localAddress = new SignalServiceAddress(TextSecurePreferences.getLocalNumber(context));
|
SignalServiceAddress localAddress = new SignalServiceAddress(TextSecurePreferences.getLocalNumber(context));
|
||||||
LokiServiceCipher cipher = new LokiServiceCipher(localAddress, axolotlStore, sessionResetProtocol, UnidentifiedAccessUtil.getCertificateValidator());
|
LokiServiceCipher cipher = new LokiServiceCipher(localAddress, axolotlStore, DatabaseFactory.getSSKDatabase(context), sessionResetProtocol, UnidentifiedAccessUtil.getCertificateValidator());
|
||||||
|
|
||||||
SignalServiceContent content = cipher.decrypt(envelope);
|
SignalServiceContent content = cipher.decrypt(envelope);
|
||||||
|
|
||||||
|
@ -154,6 +154,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity, ConversationClickListe
|
|||||||
val apiDB = DatabaseFactory.getLokiAPIDatabase(this)
|
val apiDB = DatabaseFactory.getLokiAPIDatabase(this)
|
||||||
val threadDB = DatabaseFactory.getLokiThreadDatabase(this)
|
val threadDB = DatabaseFactory.getLokiThreadDatabase(this)
|
||||||
val userDB = DatabaseFactory.getLokiUserDatabase(this)
|
val userDB = DatabaseFactory.getLokiUserDatabase(this)
|
||||||
|
val sskDatabase = DatabaseFactory.getSSKDatabase(this)
|
||||||
val userPublicKey = TextSecurePreferences.getLocalNumber(this)
|
val userPublicKey = TextSecurePreferences.getLocalNumber(this)
|
||||||
val sessionResetImpl = SessionResetImplementation(this)
|
val sessionResetImpl = SessionResetImplementation(this)
|
||||||
if (userPublicKey != null) {
|
if (userPublicKey != null) {
|
||||||
@ -162,7 +163,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity, ConversationClickListe
|
|||||||
SyncMessagesProtocol.configureIfNeeded(apiDB, userPublicKey)
|
SyncMessagesProtocol.configureIfNeeded(apiDB, userPublicKey)
|
||||||
application.publicChatManager.startPollersIfNeeded()
|
application.publicChatManager.startPollersIfNeeded()
|
||||||
}
|
}
|
||||||
SessionManagementProtocol.configureIfNeeded(sessionResetImpl, threadDB, application)
|
SessionManagementProtocol.configureIfNeeded(sessionResetImpl, sskDatabase, application)
|
||||||
MultiDeviceProtocol.configureIfNeeded(apiDB)
|
MultiDeviceProtocol.configureIfNeeded(apiDB)
|
||||||
IP2Country.configureIfNeeded(this)
|
IP2Country.configureIfNeeded(this)
|
||||||
// Preload device links to make message sending quicker
|
// Preload device links to make message sending quicker
|
||||||
|
@ -108,12 +108,13 @@ class LandingActivity : BaseActionBarActivity(), LinkDeviceSlaveModeDialogDelega
|
|||||||
val apiDB = DatabaseFactory.getLokiAPIDatabase(this)
|
val apiDB = DatabaseFactory.getLokiAPIDatabase(this)
|
||||||
val threadDB = DatabaseFactory.getLokiThreadDatabase(this)
|
val threadDB = DatabaseFactory.getLokiThreadDatabase(this)
|
||||||
val userDB = DatabaseFactory.getLokiUserDatabase(this)
|
val userDB = DatabaseFactory.getLokiUserDatabase(this)
|
||||||
|
val sskDatabase = DatabaseFactory.getSSKDatabase(this)
|
||||||
val userPublicKey = TextSecurePreferences.getLocalNumber(this)
|
val userPublicKey = TextSecurePreferences.getLocalNumber(this)
|
||||||
val sessionResetImpl = SessionResetImplementation(this)
|
val sessionResetImpl = SessionResetImplementation(this)
|
||||||
MentionsManager.configureIfNeeded(userPublicKey, threadDB, userDB)
|
MentionsManager.configureIfNeeded(userPublicKey, threadDB, userDB)
|
||||||
SessionMetaProtocol.configureIfNeeded(apiDB, userPublicKey)
|
SessionMetaProtocol.configureIfNeeded(apiDB, userPublicKey)
|
||||||
org.whispersystems.signalservice.loki.protocol.shelved.multidevice.MultiDeviceProtocol.configureIfNeeded(apiDB)
|
org.whispersystems.signalservice.loki.protocol.shelved.multidevice.MultiDeviceProtocol.configureIfNeeded(apiDB)
|
||||||
SessionManagementProtocol.configureIfNeeded(sessionResetImpl, threadDB, application)
|
SessionManagementProtocol.configureIfNeeded(sessionResetImpl, sskDatabase, application)
|
||||||
SyncMessagesProtocol.configureIfNeeded(apiDB, userPublicKey)
|
SyncMessagesProtocol.configureIfNeeded(apiDB, userPublicKey)
|
||||||
application.setUpP2PAPIIfNeeded()
|
application.setUpP2PAPIIfNeeded()
|
||||||
application.setUpStorageAPIIfNeeded()
|
application.setUpStorageAPIIfNeeded()
|
||||||
|
@ -103,4 +103,9 @@ class SharedSenderKeysDatabase(context: Context, helper: SQLCipherOpenHelper) :
|
|||||||
}.toSet()
|
}.toSet()
|
||||||
}
|
}
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
|
override fun isSSKBasedClosedGroup(groupPublicKey: String): Boolean {
|
||||||
|
return getAllClosedGroupPublicKeys().contains(groupPublicKey)
|
||||||
|
}
|
||||||
|
// endregion
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user