Class: HttpSignatures::Signer

Inherits:
Object
  • Object
show all
Defined in:
lib/http_signatures/signer.rb

Constant Summary collapse

AUTHORIZATION_SCHEME =
"Signature"

Instance Method Summary collapse

Constructor Details

#initialize(key:, algorithm:, header_list:) ⇒ Signer

Returns a new instance of Signer.



6
7
8
9
10
# File 'lib/http_signatures/signer.rb', line 6

def initialize(key:, algorithm:, header_list:)
  @key = key
  @algorithm = algorithm
  @header_list = header_list
end

Instance Method Details

#sign(message) ⇒ Object



12
13
14
15
16
17
# File 'lib/http_signatures/signer.rb', line 12

def sign(message)
  message.tap do |m|
    m["Signature"] = [signature_parameters(message).to_str]
    m["Authorization"] = [AUTHORIZATION_SCHEME + " " + signature_parameters(message).to_str]
  end
end