Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Log clearer errors when picklekey goes missing #12971

Closed
wants to merge 3 commits into from

Conversation

richvdh
Copy link
Member

@richvdh richvdh commented Sep 11, 2024

Currently, if we have an accesstoken which is encrypted with a picklekey, but the picklekey has gone missing, we carry on with no access token at all. This is sure to blow up in some way or other later on, but in a rather cryptic way.

Instead, let's bail out early.

(This will produce a "can't restore session" error, but we normally see one of those anyway because we can't initialise the crypto store.)

Also a couple of refactoring commits to bring a bit more sanity to this part of the code. Suggest review commit-by-commit.

This is part of a quest to hunt down WTF is going on with element-hq/element-desktop#1816.

Improve variable naming and documentation on the methods in `tokens.ts`.
Since the session data isn't actually stored in localstorage, this feels like a
misleading name.
Currently, if we have an accesstoken which is encrypted with a picklekey, but
the picklekey has gone missing, we carry on with no access token at all. This
is sure to blow up in some way or other later on, but in a rather cryptic way.

Instead, let's bail out early.

(This will produce a "can't restore session" error, but we normally see one of
those anyway because we can't initialise the crypto store.)
@richvdh richvdh requested a review from a team as a code owner September 11, 2024 13:00
@richvdh
Copy link
Member Author

richvdh commented Sep 11, 2024

Closing in favour of element-hq/matrix-react-sdk#27

@richvdh richvdh closed this Sep 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants