-
Notifications
You must be signed in to change notification settings - Fork 43
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
Remove pad plaintext from hpke #525
base: master
Are you sure you want to change the base?
Conversation
payjoin/src/send/v2/mod.rs
Outdated
// TODO: Try to return the error as a proper HpkeError::PayloadTooLarge | ||
let body = encrypt_message_a( | ||
body, | ||
body.try_into().expect("Payload amount incorrect"), |
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.
I failed to correctly apply a map_err() from a HpkeError to a CreateRequestError. But I'm not quite sure on how to accomplish this at the moment, I need to take a closer look at Error conversions
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.
I think keeping the pad_plaintext around for deduplicate error handling is justifiable, the comments on the original may have been overly ambitious. Perhaps start with the first comment and then take a stab at removing pad_plaintext altogether. @nothingmuch can you remember why we said the pad_plaintext function should not exist at all?
ref:
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.
I have this currently, but ultimately It still feels like I moved the logic up to then simply duplicate the error handling.
I'm happy to scrap my current approach here and just go with using an array ref internally but I am perhaps also a little confused as you said about how the plan was to remove the pad plaintext as the plaintext is not really ever expected to be initially in the PADDED_PLAINTEXT_#_LENGTH
as I first thought possible here to then just pass it down as an array but ultimately it does still need to be resized in my approach.
717a1a9
to
18e6985
Compare
Pull Request Test Coverage Report for Build 13160517763Details
💛 - Coveralls |
18e6985
to
81a3c3c
Compare
We had a function to check the length and pad the plaintext in our hpke encryption functions. Instead we should just ensure that the text is passed as an array with the correct length.
The plaintext passed to hpke message encrpytion needs to be the correct A or B length respectively.
81a3c3c
to
f00820b
Compare
We had a function that checked and then padded the length of the plaintext when running message encryption. Instead we should use a fixed array length and return an error if the message is of the wrong length.