turt2live / matrix-bot-sdk

TypeScript/JavaScript SDK for Matrix bots
MIT License
194 stars 68 forks source link

Use a more structured algorithm for determining decryption client for appservice events #352

Open Half-Shot opened 9 months ago

Half-Shot commented 9 months ago

This PR changes the way we pick a client for decrypting an event, and caches the result so that it can be reused. This is intended to ensure that when the sender user isn't used for decryption, Appservice doesn't make repeated calls to get_joined_rooms, and when it picks a client it prefers one with encryption already enabled to save time.

We also update to ES2022 so I can use Error.cause, one of my favourite new ES features.

Checklist