How to use the @grpc/grpc-js.credentials.createSsl function in @grpc/grpc-js

To help you get started, we’ve selected a few @grpc/grpc-js 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 LN-Zap / node-lnd-grpc / src / utils / createSslCreds.js View on Github external
}
    // If it's not a filepath, then assume it is a base64url encoded string.
    else if (certPath === basename(certPath)) {
      lndCert = decodeCert(certPath)
      lndCert = new Buffer.from(lndCert)
    }
    // Otherwise, lets treat it as a file path.
    else {
      lndCert = await readFile(untildify(certPath)).catch(e => {
        const error = new Error(`SSL cert path could not be accessed: ${e.message}`)
        error.code = 'LND_GRPC_CERT_ERROR'
        throw error
      })
    }
  }
  return credentials.createSsl(lndCert)
}
github LN-Zap / zap-desktop / lnd / util.js View on Github external
}
    // If it's not a filepath, then assume it is a base64url encoded string.
    else if (certPath === basename(certPath)) {
      lndCert = lndconnect.decodeCert(certPath)
      lndCert = new Buffer.from(lndCert)
    }
    // Otherwise, lets treat it as a file path.
    else {
      lndCert = await readFile(certPath).catch(e => {
        const error = new Error(`SSL cert path could not be accessed: ${e.message}`)
        error.code = 'LND_GRPC_CERT_ERROR'
        throw error
      })
    }
  }
  return credentials.createSsl(lndCert)
}