implement jwa algorithms
working on #621.
@GlenDC I've written the conversions in rama-crypto/src/jose/jwa.rs file. Let me know if they are correct. However, I'd like some guidance on what changes needs to be made in the rama-crypto/src/jose/jwk.rs file.
I've asked @soundofspace to do the initial reviews and guidance here. He'll come back to you.
For changes in rama-crypto/src/jose/jwk.rs I would start with RSA as it behaves quite similar to EC curves.
Places that need updating:
- Add
JWK::new_from_rsa_keypairusingRsaKeyPairfromawc_lc_rs. Here you create key_typeJWKType::RSAwith base64 encoded values for n, e (usingRsaKeyPair.public_key().modules/exponent) - In
JWK::unparsed_public_keyimplement the reverse so we can get an UnparsedPublicKey - Add
RsaKeyvery similar toEcdsaKeybut modify where needed to use RSA stuff - Rename
EcdsaKeySigningHeaderstoSigningHeadersso you can also use it to sign for RSA - Implement
SignerforRsaKey, this logic can probably be copied from the implementation forEcdsaKeybut might need small tweaks - Add some tests to verify that everything works like expected. These can be hardcoded to some expected output for a given input, there are lots of other projects online that have already a very nice test suite for this if you need inspiration
- If you see opportunities to extend the current (very minimal) test suite please also do, it would appreciated a lot
Also don't be afraid to look at the jwk rfc it's a decently sized one but it's split up in a lot of chapters and it also contains some examples
And thanks for looking into this!
@soundofspace could you review this?
@valkrypton I waited with reviewing since tests were failing. And seems there is a merge conflict now also.
Can you fix both, I will review after? Let me know if you need help with the merge conflict.
You can run the same tests ci-cd does by running just qa locally, if that command succeeds ci-cd should also succeed
Fixed @soundofspace
LGTM for me, thanks for this! @GlenDC do you still want to review?
LGTM for me, thanks for this! @GlenDC do you still want to review?
Yes I'll review tonight and merge it if I'm also okay with it. Can you @soundofspace please resolve the threads with a comment if they are resolved as there are still open (review/comment) threads in this PR.
LGTM for me, thanks for this! @GlenDC do you still want to review?
Yes I'll review tonight and merge it if I'm also okay with it. Can you @soundofspace please resolve the threads with a comment if they are resolved as there are still open (review/comment) threads in this PR.
Resolved them, thought I resolved all of them, but seems like Github didn't load all of them
In case there is something nog clear @valkrypton , do ask @soundofspace or myself for more explanation. Issues like these come with mentoring so do make use of it where you need and want it.
In case there is something nog clear @valkrypton , do ask @soundofspace or myself for more explanation. Issues like these come with mentoring so do make use of it where you need and want it.
Yes I will definitely ask for help if i need it. I've been busy with my day job. I'll take a look at this over the weekend
@GlenDC could you take a look at the new changes?
@GlenDC @soundofspace I've updated the docs, please have a look
@valkrypton ci/cd is failing can you fix it and run just qa locally to test if everything is working
just qa runs successfully for me
just qaruns successfully for me
rebase main branch in your branch, you’ll see the errors once you did that.
We no longer allow usage of expext/unwrap unless you explicitly allow it. Most of the times however you want to actually avoid it
rebased and pushed