Skip to content

Commit

Permalink
Add support for encrypted events in webhook replies
Browse files Browse the repository at this point in the history
Obviously won't help if the encryption hardening options are enabled,
because the point of those is to prevent the bridge from decrypting old
messages.

Fixes #131
  • Loading branch information
tulir committed Jan 6, 2024
1 parent 8035a2d commit 3f5484c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions portal.go
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,12 @@ func (portal *Portal) convertReplyMessageToEmbed(eventID id.EventID, url string)
if err != nil {
return nil, fmt.Errorf("failed to fetch event: %w", err)
}
if evt.Type == event.EventEncrypted {
evt, err = portal.bridge.Crypto.Decrypt(evt)
if err != nil {
return nil, fmt.Errorf("failed to decrypt event: %w", err)
}
}
err = evt.Content.ParseRaw(evt.Type)
if err != nil {
return nil, fmt.Errorf("failed to parse event content: %w", err)
Expand Down

0 comments on commit 3f5484c

Please sign in to comment.