A mruby implementation of JSON Web Token draft 06.
- add conf.gem line to
build_config.rb
MRuby::Build.new do |conf|
# ... (snip) ...
conf.gem :git => 'https://github.com/ainoya/mruby-jwt.git'
end
JWT.encode({"some" => "payload"}, "secret")
Note the resulting JWT will not be encrypted, but verifiable with a secret key.
JWT.decode("someJWTstring", "secret")
If the secret is wrong, it will raise a JWT::DecodeError
telling you as such. You can still get at the payload by setting the verify argument to false.
JWT.decode("someJWTstring", nil, false)
- encryption only supports SHA256 algorithm
- this module is written in only mruby; not c implementation yet.
Under the MIT License:
- see LICENSE file
- progrium/ruby-jwt
- mruby-jwt is the modified version from
progium/ruby-jwt
for working in mruby environment.
- mruby-jwt is the modified version from