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

Expose useful crypto utility functions as a crate feature #43

Closed
cygnet3 opened this issue Sep 15, 2023 · 1 comment
Closed

Expose useful crypto utility functions as a crate feature #43

cygnet3 opened this issue Sep 15, 2023 · 1 comment
Labels
enhancement New feature or request security

Comments

@cygnet3
Copy link
Owner

cygnet3 commented Sep 15, 2023

The tests/common/utils.rs contains a bunch of very useful utility functions. Maybe it's a good idea to expose these under a feature called 'utilities' or something?

Initially I was thinking that the library should be very limited in which parts should be done by the library and which things should be calculated by the user beforehand (like calculating the ecdh shared secret for example, since this requires dealing with private keys).

But the issue with this approach is that this forces the user to do some cryptography themselves, which is very error-prone.

Even though all the crypto stuff can be found in tests/common/utils.rs file, I'm thinking it's a bad idea to just refer to these as an example.
For most of these functions, the user would probably simply copy our example code into their own codebase. I don't think that is a practice that we should encourage, since that could very easily lead to bugs.

So I think it is preferable to expose these functions as an optional feature instead.

Another advantage of that is that we can also create utility functions that depend on rust-bitcoin. That way, by default, our lib doesn't depend on this lib, but it is possible as an optional dependency.

@cygnet3 cygnet3 added enhancement New feature or request security labels Sep 15, 2023
@cygnet3
Copy link
Owner Author

cygnet3 commented Apr 24, 2024

Fixed in #64

@cygnet3 cygnet3 closed this as completed Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request security
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant