Class: LightJWT::JWEHandler

Inherits:
BaseHandler show all
Defined in:
lib/light_jwt/jwt.rb

Instance Method Summary collapse

Methods inherited from BaseHandler

#base64_encode

Instance Method Details

#decode(input, key, _) ⇒ Object



82
83
84
85
86
# File 'lib/light_jwt/jwt.rb', line 82

def decode(input, key, _)
  jwe = JWE.decode_compact_serialized(input, key)
  jwe.decrypt!
  jwe
end

#encrypt(claims, alg, enc, public_key) ⇒ Object



74
75
76
77
78
79
80
# File 'lib/light_jwt/jwt.rb', line 74

def encrypt(claims, alg, enc, public_key)
  jwe = JWE.new(public_key)
  jwe.alg = alg
  jwe.enc = enc
  jwe.payload = claims
  jwe.encrypt!
end