class RapidApi::Auth::Support::JWT

Public Class Methods

decode(token) click to toggle source
# File lib/rapid_api/auth/support/jwt.rb, line 19
def self.decode(token)
  decrypt_key = nil;
  ::JWT.decode token, decrypt_key, false
end
encode(payload={}, ttl_in_sec=nil) click to toggle source
# File lib/rapid_api/auth/support/jwt.rb, line 9
def self.encode(payload={}, ttl_in_sec=nil)
  if ttl_in_sec.present?
    payload[:exp] = Time.current.to_i + ttl_in_sec
  end
  encrypt_key = nil; #TODO: Make this configurable
  encrypt_alg = 'none'

  ::JWT.encode payload, encrypt_key, encrypt_alg
end