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

adds withEncodedPayload to JWSBuilder #329

Open
wants to merge 1 commit into
base: 2.2.x
Choose a base branch
from

Conversation

aaronpk
Copy link

@aaronpk aaronpk commented Jan 18, 2022

You can use the new withEncodedPayload method when you have already externally encoded the payload before passing it to the library for signing.

I'm not particularly attached to the particular implementation here, so suggestions are welcome if there's a better way to do this.

The goal here is to be able to pass in an already-encoded payload and avoid the library doing the base64 encoding on the payload. I realize there's already a method to sort of do that by changing the b64 header value, but that isn't always possible.

For example, in this draft you're expected to pass in a base64-url-encoded sha256 hash of a POST body a the JWS payload. In order to build a JWS that validates according to this spec, I needed to do that hash myself and pass in the exact payload contents to the JWS builder.

you can use the new `withEncodedPayload` method when you have already externally encoded the payload before passing it to the library for signing
@stale
Copy link

stale bot commented Mar 20, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Mar 20, 2022
@aaronpk
Copy link
Author

aaronpk commented Mar 20, 2022

hi? any interest in this?

@stale stale bot removed the wontfix label Mar 20, 2022
@Spomky
Copy link
Member

Spomky commented Mar 25, 2022

Hi @aaronpk,

I missed this issue (afk for personal reasons). I clearly understand the concerns here, but I'm afraid that the class design and computation process doesn't allow implementing this functionality an easy way.
The b64 header prevents the encoding/decoding process and I use it a lot with detached payloads, but that's not what you want.
Let me check deeper to find an elegant way to handle this.

@aaronpk
Copy link
Author

aaronpk commented Mar 25, 2022

Thanks for taking a look! This PR seems to let me do what I want, but I may not have done it the best way according to the style of the rest of the library. Happy to take suggestions on an alternative implementation.

HmnSDR

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants