update hsm-services-websocket

This commit is contained in:
2022-08-23 14:04:12 +07:00
parent 8ae47510f9
commit 38c516623e
+35 -23
View File
@@ -15,11 +15,11 @@ let options = {
};
// init server hsm
let serverNutechPCI = "NUTECH_PCI";
let serverKCIPCI = "KCI_PCI";
let serverKCIHSM = "KCI_HSM";
let serverJepangHSM = "JEPANG_HSM";
let url;
var serverNutechPCI = "NUTECH_PCI";
var serverKCIPCI = "KCI_PCI";
var serverKCIHSM = "KCI_HSM";
var serverJepangHSM = "JEPANG_HSM";
var url;
if (process.env.HSM_SERVER == serverNutechPCI) {
url = "ws://117.102.86.186/feliqserver/v1/wsapi"; // server nutech tetra
@@ -165,25 +165,37 @@ class WebSocketClient {
// Set system code (when 0x0000)
authHead[0] = 0x93;
authHead[1] = 0x9e;
// Set API key
//const apiKeyBytes = Buffer.from('82002732-9148-34e5-843b-c639a0c88cc5-0TC') // T4
// const apiKeyBytes = Buffer.from(
// "4c6dd075-dbcb-375f-81f7-62990a5d7000-0TC"
// ); // Nutech Server Jepang
// // Secret setting
// //const secretBytes = Buffer.from('TdtSo/i5ZmbwPr82gt4fElK96lV9ClVo7votHKMIUuo='); // T4
// const secretBytes = Buffer.from(
// "U5xs7nVonhtbQ+XiYATRSg8Nk5sPu1IpVx7X40KyWiw="
// ); // Nutech Server Jepang
const apiKeyBytes = Buffer.from(
"d54ff5c4-9709-3bac-9a6e-04b2f4deebae-0TC"
); // Nutech Server Nutech Tetra
// Secret setting
//const secretBytes = Buffer.from('TdtSo/i5ZmbwPr82gt4fElK96lV9ClVo7votHKMIUuo='); // T4
const secretBytes = Buffer.from(
"W8ZiN1o2tNkb1svNlj5Kl8PNohhujaTxeNaGEq2rOWY="
); // Nutech Server Nutech Tetra
// Set API key
var apiKeyBytes;
var secretBytes;
if (process.env.HSM_SERVER == serverNutechPCI) {
apiKeyBytes = Buffer.from("d54ff5c4-9709-3bac-9a6e-04b2f4deebae-0TC"); // Nutech Server Nutech Tetra
// Secret setting
//const secretBytes = Buffer.from('TdtSo/i5ZmbwPr82gt4fElK96lV9ClVo7votHKMIUuo='); // T4
secretBytes = Buffer.from(
"W8ZiN1o2tNkb1svNlj5Kl8PNohhujaTxeNaGEq2rOWY="
); // Nutech Server Nutech Tetra
} else if (process.env.HSM_SERVER == serverKCIPCI) {
apiKeyBytes = "";
secretBytes = "";
} else if (process.env.HSM_SERVER == serverKCIHSM) {
apiKeyBytes = "";
secretBytes = "";
} else if (process.env.HSM_SERVER == serverJepangHSM) {
//const apiKeyBytes = Buffer.from('82002732-9148-34e5-843b-c639a0c88cc5-0TC') // T4
apiKeyBytes = Buffer.from("4c6dd075-dbcb-375f-81f7-62990a5d7000-0TC"); // Nutech Server Jepang
// // Secret setting
// //const secretBytes = Buffer.from('TdtSo/i5ZmbwPr82gt4fElK96lV9ClVo7votHKMIUuo='); // T4
secretBytes = Buffer.from(
"U5xs7nVonhtbQ+XiYATRSg8Nk5sPu1IpVx7X40KyWiw="
); // Nutech Server Jepang
} else {
// create log
winston.logger.error(`PLEASE SET HSM SERVER ON THE ENVIRONMENT!`);
}
const authData = Buffer.concat([authHead, apiKeyBytes, secretBytes]);