Class: Sumsub::MessageSigner

Inherits:
Object
  • Object
show all
Defined in:
lib/sumsub/message_signer.rb

Overview

Class Method Summary collapse

Class Method Details

.sign(time:, resource:, method:, body: nil, secret_key: Sumsub.configuration.secret_key) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/sumsub/message_signer.rb', line 6

def self.sign(
  time:, 
  resource:, 
  method:, 
  body: nil, 
  secret_key: Sumsub.configuration.secret_key
)
  data = time.to_s + method + '/resources/' + resource + body.to_s
  digest = OpenSSL::Digest.new('sha256')

  OpenSSL::HMAC.hexdigest(digest, secret_key, data)
end