How to use the bfx-api-node-util.genAuthSig function in bfx-api-node-util

To help you get started, we’ve selected a few bfx-api-node-util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bitfinexcom / bitfinex-api-node / lib / transports / ws2.js View on Github external
auth (calc = 0, dms = 0) {
    if (!this._isOpen) return Promise.reject(new Error('not open'))
    if (this._isAuthenticated) {
      return Promise.reject(new Error('already authenticated'))
    }

    const authNonce = nonce()
    const authPayload = `AUTH${authNonce}${authNonce}`
    const { sig } = genAuthSig(this._apiSecret, authPayload)

    return new Promise((resolve, reject) => {
      this.once('auth', () => {
        debug('authenticated')
        resolve()
      })

      this.send({
        event: 'auth',
        apiKey: this._apiKey,
        authSig: sig,
        authPayload,
        authNonce,
        dms,
        calc
      })

bfx-api-node-util

Utilities for the Bitfinex node API

MIT
Latest version published 3 months ago

Package Health Score

60 / 100
Full package analysis

Popular bfx-api-node-util functions