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
This commit is contained in:
Tulir Asokan 2024-01-06 11:05:16 +02:00
parent 8035a2d3a1
commit 3f5484c73e

View file

@ -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)