Module: StandardFile::JwtHelper
- Defined in:
- lib/standard_file/jwt_helper.rb
Class Method Summary collapse
Class Method Details
.decode(token) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/standard_file/jwt_helper.rb', line 9 def self.decode(token) return HashWithIndifferentAccess.new(JWT.decode(token, Rails.application.secrets.secret_key_base, true, { :algorithm => 'HS256' })[0]) rescue => exception puts exception nil end |
.encode(payload) ⇒ Object
5 6 7 |
# File 'lib/standard_file/jwt_helper.rb', line 5 def self.encode(payload) JWT.encode(payload, Rails.application.secrets.secret_key_base, 'HS256') end |