Class: Binance::Utils::Faraday::Middleware::Signature

Inherits:
Struct
  • Object
show all
Defined in:
lib/binance/utils/faraday/middleware/signature.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#appObject

Returns the value of attribute app

Returns:

  • (Object)

    the current value of app



9
10
11
# File 'lib/binance/utils/faraday/middleware/signature.rb', line 9

def app
  @app
end

#secretObject

Returns the value of attribute secret

Returns:

  • (Object)

    the current value of secret



9
10
11
# File 'lib/binance/utils/faraday/middleware/signature.rb', line 9

def secret
  @secret
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/binance/utils/faraday/middleware/signature.rb', line 10

def call(env)
  hash = OpenSSL::HMAC.hexdigest(
    OpenSSL::Digest.new('sha256'), secret, env.url.query
  )
  env.url.query = Url.add_param(env.url.query, 'signature', hash)
  app.call env
end