aotrautils-srv 0.0.159 → 0.0.162
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
/*utils COMMONS library associated with aotra version : «1.0.0.000 (17/07/2022-
|
|
3
|
+
/*utils COMMONS library associated with aotra version : «1.0.0.000 (17/07/2022-13:56:47)»*/
|
|
4
4
|
/*-----------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
6
|
|
|
@@ -4828,7 +4828,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
|
|
|
4828
4828
|
|
|
4829
4829
|
|
|
4830
4830
|
|
|
4831
|
-
/*utils SERVER library associated with aotra version : «1.0.0.000 (17/07/2022-
|
|
4831
|
+
/*utils SERVER library associated with aotra version : «1.0.0.000 (17/07/2022-13:56:47)»*/
|
|
4832
4832
|
/*-----------------------------------------------------------------------------*/
|
|
4833
4833
|
|
|
4834
4834
|
|
|
@@ -5196,8 +5196,6 @@ WebsocketImplementation={
|
|
|
5196
5196
|
const clientSocket=clientSocketParam;
|
|
5197
5197
|
|
|
5198
5198
|
|
|
5199
|
-
// DBG
|
|
5200
|
-
lognow(" receptionEntryPoint.clientsRoomsTag:",receptionEntryPoint.clientsRoomsTag);
|
|
5201
5199
|
|
|
5202
5200
|
// TODO : FIXME : Use one single interface !
|
|
5203
5201
|
// Room information is stored in client socket object :
|
|
@@ -5247,12 +5245,6 @@ WebsocketImplementation={
|
|
|
5247
5245
|
else serverClients=nodeServerInstance.serverSocket.sockets.sockets;
|
|
5248
5246
|
|
|
5249
5247
|
|
|
5250
|
-
// DBG
|
|
5251
|
-
lognow("nodeServerInstance.serverSocket:",nodeServerInstance.serverSocket);
|
|
5252
|
-
lognow("nodeServerInstance.serverSocket.sockets:",nodeServerInstance.serverSocket.sockets);
|
|
5253
|
-
lognow("serverClients:",serverClients);
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
5248
|
|
|
5257
5249
|
serverClients.forEach((clientSocket)=>{
|
|
5258
5250
|
|
|
@@ -5775,7 +5767,7 @@ WebsocketImplementation={
|
|
|
5775
5767
|
|
|
5776
5768
|
launchNodeHTTPServer=function(port, doOnConnect=null, doOnFinalizeServer=null, /*OPTIONAL*/sslOptions=null){
|
|
5777
5769
|
|
|
5778
|
-
const EXCLUDED_FILENAMES_PARTS=[".
|
|
5770
|
+
const EXCLUDED_FILENAMES_PARTS=[".keyHash."];
|
|
5779
5771
|
|
|
5780
5772
|
|
|
5781
5773
|
if(typeof(https)==="undefined"){
|
|
@@ -5910,7 +5902,7 @@ initNodeServer=function(doOnClientConnection=null, doOnFinalizeServer=null, /*OP
|
|
|
5910
5902
|
console.log("Server launched.");
|
|
5911
5903
|
console.log("Usage : node <server.js> conf {port:[port], sslCertPath:[ssl certificate path | unsecure ], sslKeyPath:[ssl key path], serverConfig:[JSON server configuration]}");
|
|
5912
5904
|
console.log("Or (to generate password hash) : node <server.js> hash <clientId@repositoryName> <clearTextSecretString>");
|
|
5913
|
-
// EXAMPLE : node orita-srv.js hash orita.global@
|
|
5905
|
+
// EXAMPLE : node orita-srv.js hash orita.global@keyHash 1234567890
|
|
5914
5906
|
console.log("Server launched.");
|
|
5915
5907
|
|
|
5916
5908
|
// We read the command-line arguments if needed :
|
|
@@ -5955,41 +5947,41 @@ initNodeServer=function(doOnClientConnection=null, doOnFinalizeServer=null, /*OP
|
|
|
5955
5947
|
aotraNodeServer.serverManager={ start:()=>{/*DEFAULT START FUNCTION, WILL BE OVERRIDEN LATER*/}};
|
|
5956
5948
|
|
|
5957
5949
|
if(isHashAsked){
|
|
5958
|
-
// We
|
|
5950
|
+
// We instanciate a temporary persister just to read the key hash file:
|
|
5959
5951
|
const persister=getPersister("./");
|
|
5960
5952
|
let persisterIdSplits=persisterId.split("@");
|
|
5961
5953
|
if(empty(persisterIdSplits) || persisterIdSplits.length!=2){
|
|
5962
5954
|
// TRACE
|
|
5963
|
-
console.log("ERROR : No persister repository IDs provided correctly. Cannot read
|
|
5955
|
+
console.log("ERROR : No persister repository IDs provided correctly. Cannot read key hash. Aborting hash generation.");
|
|
5964
5956
|
return aotraNodeServer;
|
|
5965
5957
|
}
|
|
5966
5958
|
const persisterClientId=persisterIdSplits[0];
|
|
5967
5959
|
const persisterRepositoryName=persisterIdSplits[1];
|
|
5968
|
-
let
|
|
5969
|
-
if(!
|
|
5960
|
+
let globalKeyHashObject=persister.readTreeObjectFromFile(persisterClientId, persisterRepositoryName);
|
|
5961
|
+
if(!globalKeyHashObject || !globalKeyHashObject.keyHash){
|
|
5970
5962
|
// TRACE
|
|
5971
|
-
console.log("WARN : No
|
|
5972
|
-
|
|
5973
|
-
persister.saveDataToFileForClient(persisterClientId,persisterRepositoryName,
|
|
5963
|
+
console.log("WARN : No key hash found. Generating one now.");
|
|
5964
|
+
globalKeyHashObject={keyHash:getUUID(), hashes:[]};
|
|
5965
|
+
persister.saveDataToFileForClient(persisterClientId,persisterRepositoryName,globalKeyHashObject,false,()=>{
|
|
5974
5966
|
// TRACE
|
|
5975
|
-
console.log("INFO :
|
|
5967
|
+
console.log("INFO : Key hash generated and saved successfully.");
|
|
5976
5968
|
});
|
|
5977
5969
|
}
|
|
5978
|
-
const
|
|
5970
|
+
const globalKeyHash=globalKeyHashObject.keyHash;
|
|
5979
5971
|
|
|
5980
5972
|
let firstHash=getHashedString(clearTextParam);
|
|
5981
5973
|
|
|
5982
|
-
let generatedHash=getHashedString( firstHash +
|
|
5983
|
-
|
|
5974
|
+
let generatedHash=getHashedString( firstHash + globalKeyHash, true);// (we use the heavy treatment thing.)
|
|
5975
|
+
globalKeyHashObject.hashes.push(generatedHash);
|
|
5984
5976
|
|
|
5985
5977
|
// We update the repository :
|
|
5986
|
-
persister.saveDataToFileForClient(persisterClientId,persisterRepositoryName,
|
|
5978
|
+
persister.saveDataToFileForClient(persisterClientId,persisterRepositoryName,globalKeyHashObject,false,()=>{
|
|
5987
5979
|
// TRACE
|
|
5988
5980
|
console.log("INFO : Hash added to repository and saved successfully.");
|
|
5989
5981
|
});
|
|
5990
5982
|
|
|
5991
5983
|
// OUTPUT
|
|
5992
|
-
console.log("Here is your key : share it with your clients but DO NOT LEAK IT !\n********************\n"+clearTextParam+"\n********************\n");
|
|
5984
|
+
console.log("Here is your key : share it with your main clients but DO NOT LEAK IT !\n********************\n"+clearTextParam+"\n********************\n");
|
|
5993
5985
|
|
|
5994
5986
|
return aotraNodeServer;
|
|
5995
5987
|
}
|
aotrautils-srv/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils-srv",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.162",
|
|
4
4
|
"main": "aotrautils-srv.build.js",
|
|
5
5
|
"description": "A library for vanilla javascript utils (server-side) used in aotra javascript CMS",
|
|
6
6
|
"author": "Jeremie Ratomposon <info@alqemia.com> (https://alqemia.com)",
|