Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login without decrypting the whole tree #615

Merged
merged 4 commits into from
Sep 6, 2024
Merged

Conversation

swansontec
Copy link
Contributor

@swansontec swansontec commented Sep 5, 2024

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Description

The loginTree is a pretty heavyweight structure that has everything decrypted. We want to get rid of this thing, so we just decrypt what we need, when we need it.

Unfortunately, the loginTree is a fundamental core data structure, so getting rid of it is a huge project. This PR just removes the loginTree decryption from the early login stages. This is a change where everything depends on everything else, so there is no way to do it except for a making a single giant commit.

With this change in place, the early login process relies more heavily on the stashTree data structure, which has the same shape as the login tree, but with everything encrypted instead of decrypted. We also add a new SessionKey, which consists a decryption key along with the loginId the key goes with.

We still have a loginTree stored in redux, but this is derived from the stashTree, and only exists once login is complete. Getting rid of this will be another project, but that one will be easier to break into small pieces. Since we derive the loginTree from the stashTree now, we never need to modify the loginTree in memory, which means we can also get rid of the LoginKit.login diff.


@swansontec swansontec force-pushed the william/less-login-tree branch 2 times, most recently from 8c10a7b to c488643 Compare September 6, 2024 21:00
Copy link
Contributor

@peachbits peachbits left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took me a while to get through but makes sense 👍

src/core/login/login-types.ts Show resolved Hide resolved
src/core/login/otp.ts Show resolved Hide resolved
@swansontec swansontec force-pushed the william/less-login-tree branch from c488643 to 9d04c12 Compare September 6, 2024 23:07
@swansontec swansontec merged commit 7411c91 into master Sep 6, 2024
2 checks passed
@swansontec swansontec deleted the william/less-login-tree branch September 6, 2024 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants