Class: Tinytokenauth::JsonWebToken
- Inherits:
-
Object
- Object
- Tinytokenauth::JsonWebToken
- Defined in:
- lib/tinytokenauth/json_web_token.rb
Class Method Summary collapse
Class Method Details
.decode(secret, token) ⇒ Object
10 11 12 13 |
# File 'lib/tinytokenauth/json_web_token.rb', line 10 def self.decode(secret, token) decoded = JWT.decode(token, secret)[0] HashWithIndifferentAccess.new decoded end |
.encode(exp, secret, payload) ⇒ Object
5 6 7 8 |
# File 'lib/tinytokenauth/json_web_token.rb', line 5 def self.encode(exp, secret, payload) payload[:exp] = exp.to_i JWT.encode(payload, secret) end |