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

[seraphis_wallet]: encrypted file #14

Conversation

ghostway0
Copy link

src/seraphis_wallet/encrypted_file.h Outdated Show resolved Hide resolved
src/seraphis_wallet/encrypted_file.h Show resolved Hide resolved
src/seraphis_wallet/encrypted_file.h Show resolved Hide resolved
decrypted_data.resize(file.encrypted_data.size());
crypto::chacha20(file.encrypted_data.data(), file.encrypted_data.size(), key, file.iv, &decrypted_data[0]);

binary_archive<false> ar{epee::strspan<std::uint8_t>(decrypted_data)};
Copy link

Choose a reason for hiding this comment

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

I would consider using the epee binary output. It is more flexible when adding new fields than this cryptonote scheme (which is more compact).

Copy link
Member

Choose a reason for hiding this comment

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

using the epee binary output

Which class is this exactly?

The whole wallet2 code is pretty much standardized on binary_archive now, especially since moneromooo deprecated the use of the outdated Boost serialization a few years back. I think binary_archive has proven itself quite well over all that time, and would hesitate to give up the standardization.

Copy link

@vtnerd vtnerd Nov 5, 2023

Choose a reason for hiding this comment

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

Which class is this exactly?

https://github.com/monero-project/monero/blob/master/contrib/epee/include/storages/portable_storage_template_helper.h#L91

The whole wallet2 code is pretty much standardized on binary_archive now

I forgot about that. The format is more compact, but you have to remember to add a version field manually in most cases (or some type field), as the field ordering is strict and implied.

The epee binary format is close to msgpack in terms of performance and flexibility (especially when adding new fields).

Copy link
Member

Choose a reason for hiding this comment

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

Let us stay with the same stuff that wallet2 also uses. Using the same serialization system for the file as a whole as for individual classes seems ok to me for the time being.

Copy link
Member

@rbrunner7 rbrunner7 left a comment

Choose a reason for hiding this comment

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

A general question for the PR as a whole: As this will probably be merged first, and be the first file in the not-yet-existing /src/seraphis_wallet folder, doesn't this need some CMakeList.txt file as well to be self-contained, create the folder, and start some library?

Maybe it will take some time to get the key container merge-ready, and therefore a good idea to have a state where other people could already add more code.

src/seraphis_wallet/encrypted_file.h Outdated Show resolved Hide resolved
src/seraphis_wallet/encrypted_file.h Outdated Show resolved Hide resolved
tests/unit_tests/encrypted_file.cpp Outdated Show resolved Hide resolved
tests/unit_tests/key_container.cpp Outdated Show resolved Hide resolved
@ghostway0
Copy link
Author

A general question for the PR as a whole: As this will probably be merged first, and be the first file in the not-yet-existing /src/seraphis_wallet folder, doesn't this need some CMakeList.txt file as well to be self-contained, create the folder, and start some library?

Maybe it will take some time to get the key container merge-ready, and therefore a good idea to have a state where other people could already add more code.

I preferred to let this be in the key container PR because it would add a (mostly) empty file, although, the key container seems to still be a bit raw from the comments so maybe

@rbrunner7
Copy link
Member

I preferred to let this be in the key container PR because it would add a (mostly) empty file, although, the key container seems to still be a bit raw from the comments so maybe

So be it. I still would have preferred this to be nicely self-contained by adding a CMakeList.txt file, but the code in this PR waited already long enough. We have to get things moving.

Copy link
Member

@rbrunner7 rbrunner7 left a comment

Choose a reason for hiding this comment

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

Looks ok to me after a round of improvements.

@rbrunner7 rbrunner7 merged commit e2ca1aa into seraphis-migration:seraphis_wallet Dec 10, 2023
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.

3 participants