Class: ZeusSdk::V1::MultiplayerJWT
- Inherits:
-
Object
- Object
- ZeusSdk::V1::MultiplayerJWT
- Defined in:
- lib/zeus_sdk/v1/multiplayer.rb
Class Method Summary collapse
Class Method Details
.decode(secret_key, token) ⇒ Object
73 74 75 76 77 78 79 80 81 |
# File 'lib/zeus_sdk/v1/multiplayer.rb', line 73 def decode(secret_key, token) decoded = JWT.decode(token, secret_key) body = decoded[0] HashWithIndifferentAccess.new JSON.parse(body) rescue Exception => e puts("ERROR DECODING TOKEN") puts(e.inspect) nil end |
.encode(secret_key, payload, exp = 6.months.from_now) ⇒ Object
67 68 69 70 71 |
# File 'lib/zeus_sdk/v1/multiplayer.rb', line 67 def encode(secret_key, payload, exp = 6.months.from_now) # payload[:exp] = exp.to_i payload = payload.to_json if payload.class != String JWT.encode(payload, secret_key) end |