feat: encrypt profile entries with passphrase-derived key, migrate to typescript#7
Open
MoustaphaCamara wants to merge 77 commits into
Open
feat: encrypt profile entries with passphrase-derived key, migrate to typescript#7MoustaphaCamara wants to merge 77 commits into
MoustaphaCamara wants to merge 77 commits into
Conversation
active profile set to null app-state back to select-profile
…mits the raw value
did not know the ci in private repos is limited in minutes, monthly so this one should be trigerred only on workflow dispatch, not on every push. Keeping the lint for every push/pr but not this one
Encrypt local profile entries with passphrase-derived keys - Replace stored profile passphrase hashes with passphrase-derived local encryption - generate an Ed25519 keypair when creating a profile - store the public key, key salt, and encrypted private key in profile index - derive anunlock key from the passphrase and use it to decrypt the private key - Encrypt entry title/body before saving to SQLite - Decrypt entry title/body after reading from SQLite - Clear in-memory profile keys on logout! note: currently, the SQLite database file is still readable as a SQLite file, but entry content is encrypted. Table names, row counts, and timestamps are not encrypted in this PR. I'm not sure if we wanted to encrypt only the content or also the db itself, but files cant be read even via db. Steps to reproduce & test - Create a new profile with a passphrase - Verify wrong passphrase does not unlock the profile - Create entries and confirm title/body are not readable in `data.sqlite3` - Verify entries decrypt correctly after unlocking with the right passphrase :)
- Replace stored profile passphrase hashes with passphrase-derived local encryption - Generate a random per-profile salt when creating a profile - Derive a local encryption key from the passphrase using Argon2id - Store the salt and an encrypted verifier in the profile index - Verify the passphrase by deriving the same key and decrypting the verifier - Encrypt entry title/body before saving to SQLite - Decrypt entry title/body after reading from SQLite - Clear the in-memory profile key on logout
Open
now it goes - generate ed25519 keypair when creating a profile - store the public key, salt, and encrypted private key in the profile index (it is needed ! to have something persistent that proves the passphrase is correct after the app restarts, while recovering the same Ed25519 identity) - derive an unlock key from the passphrase using Argon2id - Use the derived key to decrypt the encrypted private key when unlocking a profile - Treat private key decryption failure as an invalid passphrase - Encrypt entry title/body before saving to SQLite - Decrypt entry title/body after reading from SQLite - Clear in-memory profile keys on logout
NicolasCARPi
requested changes
May 18, 2026
Contributor
NicolasCARPi
left a comment
There was a problem hiding this comment.
on create new entry, reset state (title), instead of asking other components to remember to do it
remove all ed25519 code: we don't sign anything.
crypto is:
passphrase + salt (stored in clear in json profile) = master key
use the master key to decrypt data, because it's authenticated, you'll get an error if it's not the correct key.
| @@ -0,0 +1,321 @@ | |||
| .app-shell { | |||
Contributor
There was a problem hiding this comment.
try and refactor this, remove many things
| @@ -0,0 +1,30 @@ | |||
| import type { Action } from 'svelte/action'; | |||
Contributor
There was a problem hiding this comment.
try and use Attachments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
small tweaks
fix #2
fix #8 86745a6
fix #11 5bfa1b2
fix #12 5a10e8d
fix #14
encryption
Encrypt local profile entries with passphrase-derived keys
note: currently, the SQLite database file is still readable as a SQLite file, but entry content is encrypted. Table names, row counts, and timestamps are not encrypted in this PR. I'm not sure if we wanted to encrypt only the content or also the db itself, but files cant be read even via db. e.g.,
Now try to read some
Steps to reproduce & test
data.sqlite3Summary by CodeRabbit
New Features
Bug Fixes
Style
Chores