From 3f5484c73ea5ce55125fee7a2bdbb598961e26a5 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 6 Jan 2024 11:05:16 +0200 Subject: [PATCH] Add support for encrypted events in webhook replies 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 --- portal.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/portal.go b/portal.go index 904f474..c9b4871 100644 --- a/portal.go +++ b/portal.go @@ -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)