OpenSSL, Webpush, Vapid Keys, Oh My!

I have been making an attempt to port this code, and everything to support it from Ruby to Crystal:

It’s a Ruby library to handle webpush. What I have encountered, however, is a lot more challenging than it initially appeared to be.

I’m leveraging the Spider-Gazelle project’s GitHub - spider-gazelle/openssl_ext: Crystal bindings for OpenSSL RSA and GitHub - spider-gazelle/HKDF: HMAC-based Extract-and-Expand Key Derivation Function (HKDF) for crystal lang shards to help fill in the openssl gaps for this port.

What I have encountered, though, are a considerable number of places where openssl_ext is just different enough in implementation, or where openssl_ext is completely missing equivalencies to the Ruby version of the same, that porting this code has been an exercise in two steps forwards, three steps backwards.

I’ve concluded that in order for me to have success with this approach, I will really have to step back into openssl_ext, and start just filling in the gaps there methodically, as hacks and partial measures aren’t working.

What I am wondering, though, is if there is maybe some other shard that already exists that I am unaware of already implement the web push protocol in Crystal. Has someone already done this, and I just haven’t found it?

2 Likes

I ran into the same roadblocks trying to implement WebAuthn. I’d really like to get more of the OpenSSL APIs added to the stdlib eventually.

1 Like