@tdxvolt/volt-client-grpc 0.11.4 → 0.11.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.cjs +8 -8
- package/package.json +2 -1
- package/src/grpc-utils.js +1 -1
- package/src/volt-client-internal.js +5 -5
- package/src/volt-client.js +2 -2
package/lib/index.cjs
CHANGED
|
@@ -241,7 +241,7 @@ function createClient(
|
|
|
241
241
|
) {
|
|
242
242
|
let grpcCredentials;
|
|
243
243
|
if (credentials) {
|
|
244
|
-
const ca = credentials.config?.relay?.ca_pem || credentials.cache.ca;
|
|
244
|
+
const ca = credentials.config?.volt?.relay?.ca_pem || credentials.cache.ca;
|
|
245
245
|
const cert = credentials.cache.cloud_cert || credentials.cache.cert;
|
|
246
246
|
const { key } = credentials.cache;
|
|
247
247
|
|
|
@@ -1376,9 +1376,9 @@ async function bindInternal() {
|
|
|
1376
1376
|
}
|
|
1377
1377
|
|
|
1378
1378
|
// For remote connections, add our cloud-issued certificate as an additional credential.
|
|
1379
|
-
if (this.
|
|
1379
|
+
if (this._voltConfig?.relay?.ca_pem && this._credential.cache.cloud_cert) {
|
|
1380
1380
|
bindRequest.x509_credential = bindRequest.x509_credential.concat(
|
|
1381
|
-
this._credential.cache.cloud_cert + this.
|
|
1381
|
+
this._credential.cache.cloud_cert + this._voltConfig.relay.ca_pem,
|
|
1382
1382
|
);
|
|
1383
1383
|
}
|
|
1384
1384
|
|
|
@@ -1469,7 +1469,7 @@ function connectInternal() {
|
|
|
1469
1469
|
function getVoltAPIClientInternal() {
|
|
1470
1470
|
if (!this._cachedClient) {
|
|
1471
1471
|
const serviceAddress = this.isRemote
|
|
1472
|
-
? this.
|
|
1472
|
+
? this._voltConfig.relay.address
|
|
1473
1473
|
: this._voltConfig.address;
|
|
1474
1474
|
log$1("creating cached VoltAPI service client on %s", serviceAddress);
|
|
1475
1475
|
let serviceDescriptors = {};
|
|
@@ -1484,8 +1484,8 @@ function getVoltAPIClientInternal() {
|
|
|
1484
1484
|
serviceAddress,
|
|
1485
1485
|
this._credential,
|
|
1486
1486
|
this.isRemote && !this.isVoltRelay,
|
|
1487
|
-
this.
|
|
1488
|
-
this.
|
|
1487
|
+
this._voltConfig?.relay?.cloud ? this._voltConfig.id : "",
|
|
1488
|
+
this._voltConfig?.relay?.cloud ? this._voltConfig.id : "",
|
|
1489
1489
|
);
|
|
1490
1490
|
}
|
|
1491
1491
|
|
|
@@ -1827,11 +1827,11 @@ class VoltClient extends EventEmitter__default["default"] {
|
|
|
1827
1827
|
}
|
|
1828
1828
|
|
|
1829
1829
|
get isRemote() {
|
|
1830
|
-
return !!(this.
|
|
1830
|
+
return !!(this._voltConfig?.relay && this._voltConfig.id);
|
|
1831
1831
|
}
|
|
1832
1832
|
|
|
1833
1833
|
get isVoltRelay() {
|
|
1834
|
-
return this.isRemote && !this.
|
|
1834
|
+
return this.isRemote && !this._voltConfig?.relay.cloud;
|
|
1835
1835
|
}
|
|
1836
1836
|
|
|
1837
1837
|
connect() {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.11.
|
|
6
|
+
"version": "0.11.5",
|
|
7
7
|
"description": "tdx Volt library for nodejs clients",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"exports": {
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"@grpc/proto-loader": "^0.6.4",
|
|
40
40
|
"bent": "^7.3.12",
|
|
41
41
|
"bs58": "^4.0.1",
|
|
42
|
+
"builtin-modules": "^3.3.0",
|
|
42
43
|
"debug": "^4.1.1",
|
|
43
44
|
"ip": "^1.1.5",
|
|
44
45
|
"jsonwebtoken": "^8.5.1",
|
package/src/grpc-utils.js
CHANGED
|
@@ -20,7 +20,7 @@ export function createClient(
|
|
|
20
20
|
) {
|
|
21
21
|
let grpcCredentials;
|
|
22
22
|
if (credentials) {
|
|
23
|
-
const ca = credentials.config?.relay?.ca_pem || credentials.cache.ca;
|
|
23
|
+
const ca = credentials.config?.volt?.relay?.ca_pem || credentials.cache.ca;
|
|
24
24
|
const cert = credentials.cache.cloud_cert || credentials.cache.cert;
|
|
25
25
|
const { key } = credentials.cache;
|
|
26
26
|
|
|
@@ -150,9 +150,9 @@ export async function bindInternal() {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
// For remote connections, add our cloud-issued certificate as an additional credential.
|
|
153
|
-
if (this.
|
|
153
|
+
if (this._voltConfig?.relay?.ca_pem && this._credential.cache.cloud_cert) {
|
|
154
154
|
bindRequest.x509_credential = bindRequest.x509_credential.concat(
|
|
155
|
-
this._credential.cache.cloud_cert + this.
|
|
155
|
+
this._credential.cache.cloud_cert + this._voltConfig.relay.ca_pem,
|
|
156
156
|
);
|
|
157
157
|
}
|
|
158
158
|
|
|
@@ -243,7 +243,7 @@ export function connectInternal() {
|
|
|
243
243
|
export function getVoltAPIClientInternal() {
|
|
244
244
|
if (!this._cachedClient) {
|
|
245
245
|
const serviceAddress = this.isRemote
|
|
246
|
-
? this.
|
|
246
|
+
? this._voltConfig.relay.address
|
|
247
247
|
: this._voltConfig.address;
|
|
248
248
|
log("creating cached VoltAPI service client on %s", serviceAddress);
|
|
249
249
|
let serviceDescriptors = {};
|
|
@@ -258,8 +258,8 @@ export function getVoltAPIClientInternal() {
|
|
|
258
258
|
serviceAddress,
|
|
259
259
|
this._credential,
|
|
260
260
|
this.isRemote && !this.isVoltRelay,
|
|
261
|
-
this.
|
|
262
|
-
this.
|
|
261
|
+
this._voltConfig?.relay?.cloud ? this._voltConfig.id : "",
|
|
262
|
+
this._voltConfig?.relay?.cloud ? this._voltConfig.id : "",
|
|
263
263
|
);
|
|
264
264
|
}
|
|
265
265
|
|
package/src/volt-client.js
CHANGED
|
@@ -258,11 +258,11 @@ export class VoltClient extends EventEmitter {
|
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
get isRemote() {
|
|
261
|
-
return !!(this.
|
|
261
|
+
return !!(this._voltConfig?.relay && this._voltConfig.id);
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
get isVoltRelay() {
|
|
265
|
-
return this.isRemote && !this.
|
|
265
|
+
return this.isRemote && !this._voltConfig?.relay.cloud;
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
connect() {
|