Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
// 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)
}
}
// 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)
}