Class: Net::HTTP::Signature::Signer
- Inherits:
-
Object
- Object
- Net::HTTP::Signature::Signer
- Defined in:
- lib/net/http/signature/signer.rb
Instance Method Summary collapse
- #algorithm ⇒ Object
-
#initialize(request:, algorithm:, secret:) ⇒ Signer
constructor
A new instance of Signer.
- #to_s ⇒ Object
Constructor Details
#initialize(request:, algorithm:, secret:) ⇒ Signer
Returns a new instance of Signer.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/net/http/signature/signer.rb', line 5 def initialize(request:, algorithm:, secret:) @request = request @algorithm = algorithm @secret = secret unless @algorithm =~ /.+-.+/ fail ArgumentError, "Invalid algorithm format: {{key}}-{{digester}}" end unless key fail ArgumentError, "Crypto scheme not supported" end end |
Instance Method Details
#algorithm ⇒ Object
19 20 21 |
# File 'lib/net/http/signature/signer.rb', line 19 def algorithm @algorithm end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/net/http/signature/signer.rb', line 23 def to_s Base64.encode64(key.update(request).digest) end |