Class: JWT::Encode
- Inherits:
-
Object
- Object
- JWT::Encode
- Defined in:
- lib/jwt/encode.rb
Overview
Encoding logic for JWT
Constant Summary collapse
- ALG_NONE =
'none'.freeze
- ALG_KEY =
'alg'.freeze
Instance Method Summary collapse
-
#initialize(options) ⇒ Encode
constructor
A new instance of Encode.
- #segments ⇒ Object
Constructor Details
#initialize(options) ⇒ Encode
Returns a new instance of Encode.
13 14 15 16 17 18 |
# File 'lib/jwt/encode.rb', line 13 def initialize() @payload = [:payload] @key = [:key] _, @algorithm = Algos.find([:algorithm]) @headers = [:headers].each_with_object({}) { |(key, value), headers| headers[key.to_s] = value } end |
Instance Method Details
#segments ⇒ Object
20 21 22 |
# File 'lib/jwt/encode.rb', line 20 def segments @segments ||= combine(encoded_header_and_payload, encoded_signature) end |