lib/json/jwt.rb in json-jwt-0.5.2 vs lib/json/jwt.rb in json-jwt-0.5.3

- old
+ new

@@ -26,14 +26,14 @@ self.header[header_key] = value end end end end - register_header_keys :typ, :cty, :alg + register_header_keys :alg, :jku, :jwk, :x5u, :x5t, :x5c, :kid, :typ, :cty, :crit alias_method :algorithm, :alg - def initialize(claims) + def initialize(claims = {}) self.typ = :JWT self.alg = :none [:exp, :nbf, :iat].each do |key| claims[key] = claims[key].to_i if claims[key] end @@ -58,9 +58,13 @@ def encrypt(public_key_or_secret, algorithm = :RSA1_5, encryption_method = :'A128CBC+HS256') jwe = JWE.new(self) jwe.alg = algorithm jwe.enc = encryption_method jwe.encrypt! public_key_or_secret + end + + def content_type + "application/#{self.class.name.split('::').last.downcase}" end def to_s [ header.to_json,