matrix-rust-sdk
matrix-rust-sdk copied to clipboard
Crypto: Improve logging around OTKs
I've seen some bug reports which report Failed to create a new Olm session from a pre-key message: InboundCreation(MissingOneTimeKey(....))
. There are many reasons this can happen, but I need more logging to debug this further. In particular:
- Log whenever an OTK is deleted from the database. They are deleted when they get used (which we probably log already?) but they also get deleted when we reach the max OTK count (which we probably don't log).
- Log the number of stored OTKs / the max number of OTKs we will store e.g
504/1000
when we add new OTKs.
This serves two purposes:
- Logging when an OTK is deleted allows us to confirm if the OTK did exist in the first place because it will be present in the bug report logs.
- Logging the number of stored OTKs allows us to know if we are hitting the max and if the bug could be caused by this.