module StandardFile::JwtHelper

Public Class Methods

decode(token) click to toggle source
# 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) click to toggle source
# File lib/standard_file/jwt_helper.rb, line 5
def self.encode(payload)
  JWT.encode(payload, Rails.application.secrets.secret_key_base, 'HS256')
end