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

Encryption modes #238

Merged
merged 15 commits into from
Nov 24, 2020
Merged

Encryption modes #238

merged 15 commits into from
Nov 24, 2020

Conversation

j-berman
Copy link
Collaborator

@j-berman j-berman commented Nov 24, 2020

Admins can now set their apps' encryption mode to either 'end-to-end' (the default), or 'server-side'. The 'end-to-end' encryption mode is the mode all apps that currently exist are set to. The 'server-side' mode is a new mode that allows users who forget their password to reset it and maintain access to their data, without needing access to a previously used device. This is our most requested feature at the moment. Here's what it looks like in the Admin panel:

Screen Shot 2020-11-19 at 9 11 12 PM

Screen Shot 2020-11-19 at 9 11 47 PM

Screen Shot 2020-11-19 at 9 12 43 PM

Additional highlights in this PR

  • getDatabases() returns each database's encryptionMode.
  • sign() returns a boolean changePassword if the user needs to change their password to access database and payments functions in the SDK.
  • forgotPassword() accepts a new optional parameter deleteEndToEndEncryptedData to allow users of an app with encryption mode set to 'end-to-end' who forget their password and lose access to their device to regain access to their account. (Enable user to delete all data and create new password #118)
  • openDatabase(), insertItem(), updateItem(), putTransaction(), uploadFile(), and getFile() all take a new optional parameter encryptionMode to override an app's default behavior for a database.

Bug fixes

  • signIn() signs in correctly when a user provides the correct password but their seed stored in browser storage is incorrect, rather than throw ServiceUnavailable.
  • init() returns the lastUsedUsername when a user's seed stored in browser storage is incorrect, rather than throw ServiceUnavailable.

- all data storage functions accept an encryption mode of either 'end-to-end' or 'server-side'
- 'end-to-end' is the default and keeps data e2e encrypted
- 'server-side' sends all data to server encrypted except sends database encryption key in plaintext, which is still encrypted at rest on server
- forgotPassword accepts a parameter to reset password and delete e2e encrypted data without needing access to seed. When this is triggered, client rotates user's seed and keys. all data stored with 'server-side' encryption mode is still accessible after resetting password this way
- safe because client only provides new keys if user signed in with temporary password that deletes their end-to-end encrypted data
- signIn now uses password based backup from server by default to decrypt seed, and only uses seed saved in local storage when required to when signing in with temp password. Also overwrites seed in local storage when using the backup every sign in
- init will correctly return last used username prompting user to sign in again if incorrect seed saved
- updateUser will update session's username upon rotating keys
- client uses app's encryption mode to set default encryption mode param on database & payment functions
- if end-to-end, user must have access to seed to receive temp password in email by default
- if server-side, default behavior simply sends user's email the temp password to sign back in
- in server-side encryption mode
- tested deleteEndToEndEncryptedData param
@j-berman j-berman force-pushed the encryption-modes branch 2 times, most recently from 03e0751 to ed8f715 Compare November 24, 2020 14:01
@j-berman j-berman merged commit 4550140 into master Nov 24, 2020
@j-berman j-berman deleted the encryption-modes branch November 24, 2020 14: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.

None yet

1 participant