pimeys / rust-web-push

A Web Push library for Rust
Apache License 2.0
113 stars 21 forks source link

Delegate jwt signing and remove many dependencies #31

Closed andyblarblar closed 3 years ago

andyblarblar commented 3 years ago

This PR builds on my last by delegating the jwt signing to jwt_simple, removing the hand written calculations in signer.rs. Doing this also allowed for the removal of Openssl as a direct dependency. Many other dependencies were unneeded either due to these changes, or just in general. All in all, these removals amount to around an 11s decrease in compile time on my machine.

Changes 📝

[\~] - Delegate JWT signing and key management to jwt_simple. [\~] - Manually ensure compatibility with both SEC1 and pkcs8 encoded PEM keys.
[+] - Add WebPushError::InvalidClaims variant for use when invalid JWT claims are used. [+] - Add pkcs8, pem, and sec1_decode crates to handle PEM decoding. [\~] - Make lazy_static a dev dep. [\~] - Migrate futures to futures-light and feature gate behind the isahc client. [-] - Remove openssl, ring, time, native_tls, and futures deps. [+] - Improve tests. [+] - Improve docs. [+] - Bump to v0.9.0

Breaking Changes ⚠

Adding a new error variant is a breaking change due to exhaustive matching. The public API is otherwise unchanged.

Notes

BTW, I would be happy to maintain this crate if you want, by this point I've refactored most of the code so I know my way around. Just let me know what to do on the github/cargo side of things if this is what you want :]

andyblarblar commented 3 years ago

Looks like you need to remove the 'openssl/vendored' feature flag from the CI cargo test for it to run, else it just errors.

pimeys commented 3 years ago

It's nice that finally there are all the ingredients available as dependencies :) When I wrote this as one of my first Rust exercises in 2017, everything needed to be written by hand and there was just barely Tokio available for async exec. I love to see all that hand-written crypto removed.

I'll add you as an admin to this repo and if you give me your crates.io username, to the crate too.

andyblarblar commented 3 years ago

My crates username is andyblarblar, same as my github. I'll look into getting these tests to pass when I find the time. Glad to see my work is appreciated :)

andyblarblar commented 3 years ago

It looks like my crates name may be 'Andrew Ealovega'. Try that if the other doesn't work.

pimeys commented 3 years ago

I am happy people actually take part and continue work I have no need for anymore.

There are the fcm and a2 counterparts too :)

andyblarblar commented 3 years ago

That's the beauty of open source isn't it. I may port some of these changes to fcm if I've ever got the need for a project, but with school and work that may not happen for a while.

Bumping to semver 0.9 due to breaking changes. Once tests pass I'll merge and get a new release out. Thanks again for letting me help out :)