Sha256: cd5e0a1f2f7e479a2e3877f8262edafa6b27955666726c56a2bbbb17a3480211
Contents?: true
Size: 511 Bytes
Versions: 6
Compression:
Stored size: 511 Bytes
Contents
module Care class JwtService def decode(token) decoded_token = JWT.decode(token, public_key, true, algorithm: 'RS256') HashWithIndifferentAccess.new(decoded_token[0]) end def encode(payload) JWT.encode(payload, secret_key, 'RS256') end private def public_key key = File.read(ENV['JWT_SECRET_PATH']) OpenSSL::PKey::RSA.new(key) end def secret_key key = File.read(ENV['JWT_SECRET_PATH']) OpenSSL::PKey::RSA.new(key) end end end
Version data entries
6 entries across 6 versions & 1 rubygems