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.

Parameters:

  • unsigned_request (Net::HTTPRequest)
  • path (String)
  • payload (#to_json, String) (defaults to: {})


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

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

#signNet::HTTPRequest

Returns:

  • (Net::HTTPRequest)


21
22
23
24
25
26
# File 'lib/yoti/http/signed_request.rb', line 21

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