Skip to content

Commit

Permalink
signalmeow: clean up decryption code
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Sep 9, 2024
1 parent 798ebb6 commit ffd1ba3
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 164 deletions.
3 changes: 2 additions & 1 deletion pkg/connector/handlesignal.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ func (s *SignalClient) wrapDecryptionError(evt *events.DecryptionError) bridgev2
Timestamp: time.UnixMilli(int64(evt.Timestamp)),
},
Data: evt,
ID: "decrypterr|" + signalid.MakeMessageID(evt.Sender, evt.Timestamp),
// TODO use main message id and edit it if it later becomes decryptable?
ID: "decrypterr|" + signalid.MakeMessageID(evt.Sender, evt.Timestamp),

ConvertMessageFunc: convertDecryptionError,
}
Expand Down
5 changes: 2 additions & 3 deletions pkg/libsignalgo/sealedsender.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import "C"
import (
"context"
"runtime"
"time"

"github.com/google/uuid"
)
Expand Down Expand Up @@ -113,7 +112,7 @@ func SealedSenderDecrypt(
ciphertext []byte,
localAddress *SealedSenderAddress,
trustRoot *PublicKey,
timestamp time.Time,
timestamp uint64,
sessionStore SessionStore,
identityStore IdentityKeyStore,
preKeyStore PreKeyStore,
Expand All @@ -134,7 +133,7 @@ func SealedSenderDecrypt(
&senderDeviceID,
BytesToBuffer(ciphertext),
trustRoot.ptr,
C.uint64_t(timestamp.UnixMilli()),
C.uint64_t(timestamp),
C.CString(localAddress.E164),
C.CString(localAddress.UUID.String()),
C.uint32_t(localAddress.DeviceID),
Expand Down
2 changes: 1 addition & 1 deletion pkg/libsignalgo/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ func TestSealedSenderSession(t *testing.T) {
ciphertext,
recipientAddress,
trustRoot.GetPublicKey(),
time.UnixMilli(31335),
31335,
bobStore,
bobStore,
bobStore,
Expand Down
Loading

0 comments on commit ffd1ba3

Please sign in to comment.