Class: RapidApi::Auth::Support::JWT
- Inherits:
-
Object
- Object
- RapidApi::Auth::Support::JWT
- Defined in:
- lib/rapid_api/auth/support/jwt.rb
Class Method Summary collapse
Class Method Details
.decode(token) ⇒ Object
19 20 21 22 |
# 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) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# 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 |