mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-09-20 00:35:47 +01:00
Force a prekey rotation when a prekey message to our PNI fails to decrypt.
This commit is contained in:
committed by
Cody Henthorne
parent
28c69c8a0a
commit
94fcf2b2f1
@@ -106,7 +106,14 @@ class PreKeysSyncJob private constructor(
|
||||
Parameters.Builder()
|
||||
.setQueue("PreKeysSyncJob")
|
||||
.addConstraint(NetworkConstraint.KEY)
|
||||
.setMaxInstancesForFactory(1)
|
||||
.apply {
|
||||
if (forceRotation) {
|
||||
setMaxInstancesForFactory(Parameters.UNLIMITED)
|
||||
setMaxInstancesForQueue(2)
|
||||
} else {
|
||||
setMaxInstancesForFactory(1)
|
||||
}
|
||||
}
|
||||
.setMaxAttempts(Parameters.UNLIMITED)
|
||||
.setLifespan(TimeUnit.DAYS.toMillis(30))
|
||||
.build(),
|
||||
|
||||
@@ -326,7 +326,15 @@ object MessageDecryptor {
|
||||
): Result {
|
||||
if (ServiceId.parseOrNull(envelope.destinationServiceId, envelope.destinationServiceIdBinary) == SignalStore.account.pni) {
|
||||
Log.w(TAG, "${logPrefix(envelope)} Decryption error for message sent to our PNI! Ignoring.")
|
||||
return Result.Ignore(envelope, serverDeliveredTimestamp, followUpOperations)
|
||||
|
||||
if (envelope.type == Envelope.Type.PREKEY_MESSAGE) {
|
||||
Log.w(TAG, "${logPrefix(envelope)} Decryption error was on a prekey message. Forcing a prekey rotation.", true)
|
||||
followUpOperations += FollowUpOperation {
|
||||
PreKeysSyncJob.create(forceRotationRequested = true).asChain()
|
||||
}
|
||||
}
|
||||
|
||||
return Result.Ignore(envelope, serverDeliveredTimestamp, followUpOperations.toUnmodifiableList())
|
||||
}
|
||||
|
||||
val contentHint: ContentHint = ContentHint.fromType(protocolException.contentHint)
|
||||
|
||||
Reference in New Issue
Block a user