Skip to content
JSON Web Token implementation in mruby
Ruby
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
mrblib
test
.travis.yml
.travis_build_config.rb
LICENSE
README.md
mrbgem.rake
mruby-jwt.gem

README.md

mruby-jwt Build Status

A mruby implementation of JSON Web Token draft 06.

Install by mrbgems

  • 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

Usage

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)

Caveats

  • encryption only supports SHA256 algorithm
  • this module is written in only mruby; not c implementation yet.

License

Under the MIT License:

  • see LICENSE file

Reference

  • progrium/ruby-jwt
    • mruby-jwt is the modified version from progium/ruby-jwt for working in mruby environment.
You can’t perform that action at this time.