Allow messages to be decrypted from previous bundles (#1400)
Currently we only decrypt messages if received on the current bundle. This changes the behavior so that messages can be decrypted if sent to previous bundles as well, as otherwise is a bit restrictive
This commit is contained in:
parent
259a32cd9d
commit
38e5335e18
|
@ -114,7 +114,7 @@ func (s *EncryptionService) ConfirmMessagesProcessed(messageIDs [][]byte) error
|
|||
id := confirmationIDString(idByte)
|
||||
confirmationData, ok := s.messageIDs[id]
|
||||
if !ok {
|
||||
s.log.Warn("Could not confirm message", "messageID", id)
|
||||
s.log.Debug("Could not confirm message", "messageID", id)
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
@ -858,6 +858,10 @@ func (s *EncryptionServiceTestSuite) TestRefreshedBundle() {
|
|||
s.NotNil(x3dhHeader1)
|
||||
s.Equal(bobBundle1.GetSignedPreKeys()[bobInstallationID].GetSignedPreKey(), x3dhHeader1.GetId())
|
||||
|
||||
// Bob decrypts the message
|
||||
_, err = s.bob.DecryptPayload(bobKey, &aliceKey.PublicKey, aliceInstallationID, encryptionResponse1, defaultMessageID)
|
||||
s.Require().NoError(err)
|
||||
|
||||
// We add the second bob bundle
|
||||
_, err = s.alice.ProcessPublicBundle(aliceKey, bobBundle2)
|
||||
s.Require().NoError(err)
|
||||
|
@ -875,6 +879,9 @@ func (s *EncryptionServiceTestSuite) TestRefreshedBundle() {
|
|||
s.NotNil(x3dhHeader2)
|
||||
s.Equal(bobBundle2.GetSignedPreKeys()[bobInstallationID].GetSignedPreKey(), x3dhHeader2.GetId())
|
||||
|
||||
// Bob decrypts the message
|
||||
_, err = s.bob.DecryptPayload(bobKey, &aliceKey.PublicKey, aliceInstallationID, encryptionResponse2, defaultMessageID)
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
func (s *EncryptionServiceTestSuite) TestMessageConfirmation() {
|
||||
|
|
|
@ -465,7 +465,7 @@ func (s *SQLLitePersistence) GetAnyPrivateBundle(myIdentityKey []byte, installat
|
|||
func (s *SQLLitePersistence) GetPrivateKeyBundle(bundleID []byte) ([]byte, error) {
|
||||
stmt, err := s.db.Prepare(`SELECT private_key
|
||||
FROM bundles
|
||||
WHERE expired = 0 AND signed_pre_key = ? LIMIT 1`)
|
||||
WHERE signed_pre_key = ? LIMIT 1`)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue