@wjsc/remote-config-client
Advanced tools
Comparing version 0.0.9 to 1.0.0
const assert = require('assert'); | ||
const createClientCredentials = (grpc, privateKey, caCertificate, clientCertificate) => { | ||
if(!caCertificate && !privateKey && !clientCertificate){ | ||
if(!caCertificate){ | ||
console.warn('Client connecting without SSL/TLS Authentication'); | ||
return createInsecureClientCredentials(grpc); | ||
} | ||
if(!clientCertificate){ | ||
console.warn('Client connecting without Mutual SSL/TLS'); | ||
return createSslServerCredentials(grpc, caCertificate); | ||
} | ||
assert(caCertificate, 'SSL/TLS Authentication: CA certificate is required'); | ||
assert(privateKey, 'SSL/TLS Authentication: Client private key is required'); | ||
assert(clientCertificate, 'SSL/TLS Authentication: Client certificate is required' ); | ||
return createSslClientCredentials(grpc, caCertificate, privateKey, clientCertificate, true); | ||
return createSslMutualCredentials(grpc, caCertificate, privateKey, clientCertificate); | ||
} | ||
const createSslClientCredentials = ( grpc, caCertificate, privateKey, clientCertificate ) => | ||
const createSslMutualCredentials = ( grpc, caCertificate, privateKey, clientCertificate ) => | ||
grpc.credentials.createSsl( | ||
@@ -21,2 +25,7 @@ Buffer.from(caCertificate, 'utf8'), | ||
const createSslServerCredentials = ( grpc, caCertificate, ) => | ||
grpc.credentials.createSsl( | ||
Buffer.from(caCertificate, 'utf8') | ||
); | ||
const createInsecureClientCredentials = grpc => grpc.credentials.createInsecure(); | ||
@@ -23,0 +32,0 @@ |
{ | ||
"name": "@wjsc/remote-config-client", | ||
"version": "0.0.9", | ||
"version": "1.0.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
13230
123
1