mirror of
https://github.com/oxen-io/session-android.git
synced 2025-05-01 22:10:49 +00:00
minor refactoring on receiving decryption
This commit is contained in:
parent
55b68c3db9
commit
bd96342a16
@ -20,10 +20,12 @@ object MessageReceiverDecryption {
|
|||||||
internal fun decryptWithSignalProtocol(envelope: SignalServiceEnvelope): Pair<ByteArray, String> {
|
internal fun decryptWithSignalProtocol(envelope: SignalServiceEnvelope): Pair<ByteArray, String> {
|
||||||
val storage = Configuration.shared.signalStorage
|
val storage = Configuration.shared.signalStorage
|
||||||
val certificateValidator = Configuration.shared.certificateValidator
|
val certificateValidator = Configuration.shared.certificateValidator
|
||||||
|
val sskDatabase = Configuration.shared.sskDatabase
|
||||||
|
val sessionResetImp = Configuration.shared.sessionResetImp
|
||||||
val data = envelope.content
|
val data = envelope.content
|
||||||
if (data.count() == 0) { throw Error.NoData }
|
if (data.count() == 0) { throw Error.NoData }
|
||||||
val userPublicKey = Configuration.shared.storage.getUserPublicKey() ?: throw Error.NoUserPublicKey
|
val userPublicKey = Configuration.shared.storage.getUserPublicKey() ?: throw Error.NoUserPublicKey
|
||||||
val cipher = LokiServiceCipher(SignalServiceAddress(userPublicKey), storage, sskDatabase, Configuration.shared.sessionResetImp, certificateValidator)
|
val cipher = LokiServiceCipher(SignalServiceAddress(userPublicKey), storage, sskDatabase, sessionResetImp, certificateValidator)
|
||||||
val result = cipher.decrypt(envelope)
|
val result = cipher.decrypt(envelope)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user