Sha256: ab4eee0f121e5caed9a36934776d1d2a5a45b5374163eae3e26cf20dd5d22297
Contents?: true
Size: 361 Bytes
Versions: 3
Compression:
Stored size: 361 Bytes
Contents
module ApiPack class JsonWebToken def self.encode(payload, exp: ApiPack.exp) payload[:exp] = exp.to_i JWT.encode(payload, ApiPack::HMAC_SECRET) end def self.decode(token) JWT.decode(token, ApiPack::HMAC_SECRET).first rescue JWT::DecodeError => e raise ApiPack::Errors::Auth::InvalidToken, e.message end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
api_pack-1.1.1 | lib/api_pack/json_web_token.rb |
api_pack-1.0.1 | lib/api_pack/json_web_token.rb |
api_pack-1.0.0 | lib/api_pack/json_web_token.rb |