Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions send.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

"github.com/rs/zerolog"
"go.mau.fi/libsignal/groups"
groupRecord "go.mau.fi/libsignal/groups/state/record"
"go.mau.fi/libsignal/keys/prekey"
"go.mau.fi/libsignal/protocol"
"go.mau.fi/libsignal/session"
Expand Down Expand Up @@ -822,6 +823,16 @@
start = time.Now()
builder := groups.NewGroupSessionBuilder(cli.Store, pbSerializer)
senderKeyName := protocol.NewSenderKeyName(to.String(), cli.getOwnLID().SignalAddress())
if to.Server == types.BroadcastServer && to != types.StatusBroadcastJID {
// The phone only records a message another device sent to one of its broadcast lists
// when it can't decrypt the fan-out copy and gets the message through a retry instead.
// Answering a retry also hands it the current sender key, so use a fresh one for every
// message. Recipients get the new key with each message anyway.
emptyKey := groupRecord.NewSenderKey(pbSerializer.SenderKeyRecord, pbSerializer.SenderKeyState)
if err = cli.Store.StoreSenderKey(ctx, senderKeyName, emptyKey); err != nil {
return "", nil, fmt.Errorf("failed to reset sender key to send %s to %s: %w", id, to, err)
}
}
signalSKDMessage, err := builder.Create(ctx, senderKeyName)
if err != nil {
return "", nil, fmt.Errorf("failed to create sender key distribution message to send %s to %s: %w", id, to, err)
Expand Down Expand Up @@ -1045,7 +1056,7 @@
}
}

func getButtonTypeFromMessage(msg *waE2E.Message) string {

Check failure on line 1059 in send.go

View workflow job for this annotation

GitHub Actions / Build (old)

func getButtonTypeFromMessage is unused (U1000)

Check failure on line 1059 in send.go

View workflow job for this annotation

GitHub Actions / Build (latest)

func getButtonTypeFromMessage is unused (U1000)
switch {
case msg.ViewOnceMessage != nil:
return getButtonTypeFromMessage(msg.ViewOnceMessage.Message)
Expand All @@ -1068,7 +1079,7 @@
}
}

func getButtonAttributes(msg *waE2E.Message) waBinary.Attrs {

Check failure on line 1082 in send.go

View workflow job for this annotation

GitHub Actions / Build (old)

func getButtonAttributes is unused (U1000)

Check failure on line 1082 in send.go

View workflow job for this annotation

GitHub Actions / Build (latest)

func getButtonAttributes is unused (U1000)
switch {
case msg.ViewOnceMessage != nil:
return getButtonAttributes(msg.ViewOnceMessage.Message)
Expand Down
Loading