-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Confirmed LibJWT encoded EDDSA keys can be decoded by ruby-jwt
Included test script Signed-off-by: Ben Collins <[email protected]>
1 parent
bb4a8d6
commit 49a4ea0
Showing
4 changed files
with
24 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env ruby | ||
|
||
# gem install jwt-eddsa | ||
require "jwt/eddsa" | ||
|
||
# EDDSA Token generated by LibJWT | ||
# Key generated by OpenSSL (keys/eddsa_key_ed25519-pub.pem) | ||
# The pub key was converted to 32-bytes with some openssl and CLI magic | ||
|
||
token = "eyJhbGciOiJFRERTQSIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE0NzU5ODA1NDUsImlzc" + | ||
"yI6ImZpbGVzLm1hY2xhcmEtbGxjLmNvbSIsInJlZiI6IlhYWFgtWVlZWS1aWlpaLUF" + | ||
"BQUEtQ0NDQyIsInN1YiI6InVzZXIwIn0.19ip2DFFjaZ_UFVCo0OtdwuzSmOYModle" + | ||
"JVeFcAjb_4hrAAf0pZSf8O78pivbXLJenEIsaZ9REFOauBeDxbTBw" | ||
|
||
pub_key = "\x1d\x48\xfe\xd7\x89\x0d\xe8\xde\x22\xe6\xa3\x55\x91\xf1\x21\xc0" + | ||
"\xa8\x82\x7f\xeb\x52\xae\xf4\x47\xb2\xd4\x1d\xb5\x5f\x1a\xe5\x03" | ||
|
||
verify_key = Ed25519::VerifyKey.new(pub_key) | ||
|
||
payload, header = JWT.decode(token, verify_key, true, algorithm: "EdDSA") | ||
puts payload | ||
puts header |