-
Notifications
You must be signed in to change notification settings - Fork 39
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
Implement KDBX4 database saving #58
Conversation
Nice work! |
ef21ddc
to
ea8dfff
Compare
Looks promising! I too would be interested in saving databases. Thanks for the addition! |
Since I made quite a mess of the git history in merging all the outstanding PRs, I have made a rebase of your changes onto the current master branch. You can find it at kdbx4-saving. |
@sseemayer don't bother rebasing this PR. My plan is split this PR into smaller patches that are more focused and easier to review. For example, I'm going to create a PR that only extracts the constant values that are going to be used both when reading and writing. I also think that we're going to need to fence the database saving feature behind a feature flag. The reason is that writing a database will result in data loss until we support all the kdbx4 fields.
I think we should enable branch protection on the master branch. We have many CI checks that should pass before any commit makes its way to the master branch, I don't see any reason not to leverage those CI jobs for every change to the codebase. What do you think? |
Sounds good! I have added something for the master branch. |
3761b3e
to
4d0432d
Compare
9386849
to
5181388
Compare
a36e0b6
to
a93f271
Compare
This PR is ready for reviews. The I added a bunch of unit tests for many of the ciphers and kdfs combinations, but not all the combinations are covered. After this PR is merged, I will open a PR to switch to matrix testing so that we cover all the combinations. This will also reduce duplicated code in the tests. Being able to parse and dump databases will be very helpful in the future to add more granular unit tests, because we won't have to rely on "magic" databases, committed to the repo as fixtures. It will still be useful to parse actual databases from other apps as integration tests, but at least that won't be our only option for testing. I added a bunch of @droidmonkey I'd like to have your opinion on the default HMAC block size. The block size (along with most of the hmac module) was inspired by the KeePassXC codebase. I'm honestly not sure if that value makes sense. @DavidVentura I'd like to have your input on this PR, if you get a chance. The feature won't be available yet externally, so it won't be available to implement in pykeepass-rs right now, but I think we're pretty close to having the feature available at least behind a cargo feature flag. |
@@ -211,7 +316,7 @@ impl TryFrom<VariantDictionary> for KdfSettings { | |||
} | |||
} | |||
|
|||
#[derive(Debug)] | |||
#[derive(PartialEq, Debug)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PartialEq
might not be needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in #85
Thank you for the fantastic work, it looks great! I like the idea of getting things merged with a visibility of |
Hi! I'm not sure how helpful it'll be for you, I wasn't really sure what I was doing at that time, but it did seem to work! |
@DavidVentura Thanks for linking the PR. I had a look at it, and there's a few things in there that I think we could port over here, notably all the |
@louib |
@droidmonkey thanks for the review! Let's go with that default for now then. |
This is a first draft for KDBX4 database saving support. This is still a WIP, but I wanted to open the PR now in order to get early feedback. This PR also includes some refactorings that could be extracted to separate PRs in order to make the code review easier and safer.
Fixes #14
TODO
encrypt
encrypt
encrypt
encrypt
compress