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

NotImplementedError for ES256 encode #109

Closed
mohamedhafez opened this issue Oct 24, 2016 · 1 comment
Closed

NotImplementedError for ES256 encode #109

mohamedhafez opened this issue Oct 24, 2016 · 1 comment

Comments

@mohamedhafez
Copy link
Contributor

mohamedhafez commented Oct 24, 2016

The following code fails in JRuby:

 #gem install webpush
require 'webpush' 

vapid_key = Webpush.generate_key
JWT.encode({bar: "foo"}, vapid_key.curve, 'ES256')

The last line fails with NotImplementedError: Unsupported signing method

This isn't crazy urgent or anything, since its still possible to use the Web Push API without signing your payload thanks to #90


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@MSNexploder
Copy link
Contributor

This appears to be working at least on 9.1.9.0 and later.

require 'webpush'

vapid_key = Webpush.generate_key
# => #<Webpush::VapidKey:7d0 :public_key=BPb-p8NAj6ixrEQaU5weHGeRlnC5ZNRPWX2yt4EsJLGmakJP33zfljTO59AqJkRz_M5UOfZVqmF8EwOUnIteSjo= :private_key=H6l3YWwRlFqSBK060Sb6ZhNTvG-ISfhyMawtI1U5u4k=>
JWT.encode({bar: "foo"}, vapid_key.curve, 'ES256')
# => "eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJiYXIiOiJmb28ifQ.cPDmzQq213t_nJHmmCwWvPBKp-Wyfk_Ogp9zNy-T2O5AKEjpA_mUeU8Rvsr27oUYqu9MtnxjGwHjXX9O7bGu4w"

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

No branches or pull requests

2 participants