Class: Yoti::SignedRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/yoti/http/signed_request.rb

Overview

Converts a basic Net::HTTP request into a Yoti Signed Request

Instance Method Summary collapse

Constructor Details

#initialize(unsigned_request, path, payload = {}) ⇒ SignedRequest

Returns a new instance of SignedRequest.



6
7
8
9
10
11
# File 'lib/yoti/http/signed_request.rb', line 6

def initialize(unsigned_request, path, payload = {})
  @http_req = unsigned_request
  @path = path
  @payload = payload
  @auth_key = Yoti::SSL.auth_key_from_pem
end

Instance Method Details

#signObject



13
14
15
16
17
18
# File 'lib/yoti/http/signed_request.rb', line 13

def sign
  @http_req['X-Yoti-Auth-Digest'] = message_signature
  @http_req['X-Yoti-SDK'] = Yoti.configuration.sdk_identifier
  @http_req['X-Yoti-SDK-Version'] = "#{Yoti.configuration.sdk_identifier}-#{Yoti::VERSION}"
  @http_req
end