This makes some invalid states unrepresentable, which is something that is desired in this application to reduce mental complexity and to reduce the risk of undesired behaviour of aplying functions like `encrypt` on already encrypted notes.
`Note` is now an enum that holds the structs. This approach is similar to the one used in some parts of `std`, though in this case other approaches could be used, but they would be way too much verbose for this use case.
This change was done because having functions like `hide` on already hidden functions is not a good idea (even if was they do is "just" cloning the structure...).
There are some rough edges, but I'll improve them in another moment.
Added an automatic migration system for notes before the #1 redesign.
Ths system works as follows:
1. Checks the password system used.
2. If it's the old system, the migration is started.
3. The data directory is backed up.
4. The notes are decrypted using the old password.
5. The notes are encrypted and saved using the `KDF(password)`
This commit also adds documentation related to future migrations of the "password system" and which migrations will be supported by each future version.
This documents also showcases that when v1 is released, support for `PasswordSystem::V0` will be completely removed.
When the password is less than 12 characters, the length is shown in red, when it is higher, it is shown in green.
Also changed the entropy colors to be more _nuanced_, now they have the following values:
[0, 35) = red
[35, 60) = orange
(60, ∞) = green
Finally closes#1.
Seems like according to the formula used (`E = L * log2(R)`, where `E` is the ntropy, `L` is the password length and `R` is the quantity of unique characters), a good value is a entropy higher than 60.
This is shown by using two distinct colors when rendering the entropy (dark orange when is lower than 60, and light green when is higher than 60).
Even though entropy is quite important, it would be more useful to take into account dictionaries when calculating the entropy, because raw bruteforce attacks are somewhat mitigated with the usage of a KDF.
Related #1
Closes#1.
The password is hashed using Argon2, with the salt being `SHA256(password)`. The output hash is then encoded using hex.
The password-checking function checks if the "note database" is encrypted using the plain password (and returns it) or if it is encrypted using the hashed+salted password (and returns the value). This allows older databases to work properly.
A migration path may be added in the future.
* implemented "hide notes"
* implemented "show notes" (internally "unhide")
* improved the title and metadata renderer to use enums and return values instead of callbacks
* added system to retry on password fails (adds `native-dialog` dep for convenience)
This adds a weird callback-based system to properly update the state once a note is removed.
This system isn't very nice, and it can be quite messy, but I'll improve it in the future
This is an initial release, I'm aware that this doesn't have the best structure and that there's lots of copying, but performance isn't relevant right now