Class: JWTSignedRequest::Sign

Inherits:
Object
  • Object
show all
Defined in:
lib/jwt_signed_request/sign.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method:, path:, body: EMPTY_BODY, headers:, secret_key: nil, algorithm: nil, key_id: nil, lookup_key_id: key_id, issuer: nil, additional_headers_to_sign: nil, key_store_id: nil) ⇒ Sign

Returns a new instance of Sign.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/jwt_signed_request/sign.rb', line 11

def initialize(
  method:,
  path:,
  body: EMPTY_BODY,
  headers:,
  secret_key: nil,
  algorithm: nil,
  key_id: nil,
  lookup_key_id: key_id,
  issuer: nil,
  additional_headers_to_sign: nil,
  key_store_id: nil
)
  @method = method
  @path = path
  @body = body
  @headers = headers
  @secret_key = secret_key
  @algorithm = algorithm
  @key_id = key_id
  @lookup_key_id = lookup_key_id
  @issuer = issuer
  @additional_headers_to_sign = additional_headers_to_sign
  @key_store_id = key_store_id
end

Class Method Details

.call(**args) ⇒ Object



7
8
9
# File 'lib/jwt_signed_request/sign.rb', line 7

def self.call(**args)
  new(**args).call
end

Instance Method Details

#callObject



37
38
39
# File 'lib/jwt_signed_request/sign.rb', line 37

def call
  JWT.encode(claims, secret_key, algorithm, additional_jwt_headers)
end