You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
epoberezkin
changed the title
[Feature
[Feature] Non-failable version of Crypto.MAC.Poly1305.initalize
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).
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
The text was updated successfully, but these errors were encountered: