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

[Feature] Non-failable version of Crypto.MAC.Poly1305.initalize #28

Open
epoberezkin opened this issue Jan 9, 2024 · 1 comment
Open

Comments

@epoberezkin
Copy link

epoberezkin commented Jan 9, 2024

The only reason it can fail is if it receives key not equal to 32 bytes.

Given that this is a very common size, we could add some newtype that cannot accidentally be constructed and pass it here (e.g. with additional function Crypto.Cipher.XSalsa.generate32, which is commonly used for NaCl crypto_box construction).

newtype Bytes32 a = Bytes32 a -- where a would be an instance of ByteArrayAccess

It would eliminate a lot of error handling code in all consumers for errors that can never happen (that currently can only be removed with partial pattern matches on CryptoFailable / using errors)

Happy to make a PR

@epoberezkin epoberezkin changed the title [Feature [Feature] Non-failable version of Crypto.MAC.Poly1305.initalize Jan 9, 2024
@kazu-yamamoto
Copy link
Owner

Please make a PR.

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

No branches or pull requests

2 participants