aotrautils-srv 0.0.161 → 0.0.164

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-04:26:28)»*/
3
+ /*utils COMMONS library associated with aotra version : «1.0.0.000 (17/07/2022-14:14:39)»*/
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-04:26:28)»*/
4831
+ /*utils SERVER library associated with aotra version : «1.0.0.000 (17/07/2022-14:14:39)»*/
4832
4832
  /*-----------------------------------------------------------------------------*/
4833
4833
 
4834
4834
 
@@ -5767,7 +5767,7 @@ WebsocketImplementation={
5767
5767
 
5768
5768
  launchNodeHTTPServer=function(port, doOnConnect=null, doOnFinalizeServer=null, /*OPTIONAL*/sslOptions=null){
5769
5769
 
5770
- const EXCLUDED_FILENAMES_PARTS=[".saltkey."];
5770
+ const EXCLUDED_FILENAMES_PARTS=[".keyHash."];
5771
5771
 
5772
5772
 
5773
5773
  if(typeof(https)==="undefined"){
@@ -5807,7 +5807,7 @@ launchNodeHTTPServer=function(port, doOnConnect=null, doOnFinalizeServer=null, /
5807
5807
  const urlFile="." + url;
5808
5808
 
5809
5809
  let filePath=urlFile.indexOf("?")!==-1?urlFile.split("?")[0]:urlFile;
5810
- if(filePath == "./") filePath="./index.html";
5810
+ if(filePath=="./") filePath="./index.html";
5811
5811
 
5812
5812
  let extname=path.extname(filePath);
5813
5813
  let contentType="text/html";
@@ -5815,7 +5815,7 @@ launchNodeHTTPServer=function(port, doOnConnect=null, doOnFinalizeServer=null, /
5815
5815
 
5816
5816
  fs.readFile(filePath, function(error, fileContent){
5817
5817
  if(error){
5818
- if(error.code == "ENOENT"){
5818
+ if(error.code=="ENOENT"){
5819
5819
  // TRACE
5820
5820
  console.log("ERROR 404 file not found :"+filePath);
5821
5821
 
@@ -5902,7 +5902,7 @@ initNodeServer=function(doOnClientConnection=null, doOnFinalizeServer=null, /*OP
5902
5902
  console.log("Server launched.");
5903
5903
  console.log("Usage : node <server.js> conf {port:[port], sslCertPath:[ssl certificate path | unsecure ], sslKeyPath:[ssl key path], serverConfig:[JSON server configuration]}");
5904
5904
  console.log("Or (to generate password hash) : node <server.js> hash <clientId@repositoryName> <clearTextSecretString>");
5905
- // EXAMPLE : node orita-srv.js hash orita.global@saltkey 1234567890
5905
+ // EXAMPLE : node orita-srv.js hash orita.global@keyHash 1234567890
5906
5906
  console.log("Server launched.");
5907
5907
 
5908
5908
  // We read the command-line arguments if needed :
@@ -5947,41 +5947,41 @@ initNodeServer=function(doOnClientConnection=null, doOnFinalizeServer=null, /*OP
5947
5947
  aotraNodeServer.serverManager={ start:()=>{/*DEFAULT START FUNCTION, WILL BE OVERRIDEN LATER*/}};
5948
5948
 
5949
5949
  if(isHashAsked){
5950
- // We isntanciate a temporary persister just to read the saltkey file:
5950
+ // We instanciate a temporary persister just to read the key hash file:
5951
5951
  const persister=getPersister("./");
5952
5952
  let persisterIdSplits=persisterId.split("@");
5953
5953
  if(empty(persisterIdSplits) || persisterIdSplits.length!=2){
5954
5954
  // TRACE
5955
- console.log("ERROR : No persister repository IDs provided correctly. Cannot read saltkey. Aborting hash generation.");
5955
+ console.log("ERROR : No persister repository IDs provided correctly. Cannot read key hash. Aborting hash generation.");
5956
5956
  return aotraNodeServer;
5957
5957
  }
5958
5958
  const persisterClientId=persisterIdSplits[0];
5959
5959
  const persisterRepositoryName=persisterIdSplits[1];
5960
- let globalSaltkeyObject=persister.readTreeObjectFromFile(persisterClientId, persisterRepositoryName);
5961
- if(!globalSaltkeyObject || !globalSaltkeyObject.saltkey){
5960
+ let globalKeyHashObject=persister.readTreeObjectFromFile(persisterClientId, persisterRepositoryName);
5961
+ if(!globalKeyHashObject || !globalKeyHashObject.keyHash){
5962
5962
  // TRACE
5963
- console.log("WARN : No saltkey found. Generating one now.");
5964
- globalSaltkeyObject={saltkey:getUUID(), hashes:[]};
5965
- persister.saveDataToFileForClient(persisterClientId,persisterRepositoryName,globalSaltkeyObject,false,()=>{
5963
+ console.log("WARN : No key hash found. Generating one now.");
5964
+ globalKeyHashObject={keyHash:getUUID(), hashes:[]};
5965
+ persister.saveDataToFileForClient(persisterClientId,persisterRepositoryName,globalKeyHashObject,false,()=>{
5966
5966
  // TRACE
5967
- console.log("INFO : Saltkey generated and saved successfully.");
5967
+ console.log("INFO : Key hash generated and saved successfully.");
5968
5968
  });
5969
5969
  }
5970
- const globalSaltkey=globalSaltkeyObject.saltkey;
5970
+ const globalKeyHash=globalKeyHashObject.keyHash;
5971
5971
 
5972
5972
  let firstHash=getHashedString(clearTextParam);
5973
5973
 
5974
- let generatedHash=getHashedString( firstHash + globalSaltkey, true);// (we use the heavy treatment thing.)
5975
- globalSaltkeyObject.hashes.push(generatedHash);
5974
+ let generatedHash=getHashedString( firstHash + globalKeyHash, true);// (we use the heavy treatment thing.)
5975
+ globalKeyHashObject.hashes.push(generatedHash);
5976
5976
 
5977
5977
  // We update the repository :
5978
- persister.saveDataToFileForClient(persisterClientId,persisterRepositoryName,globalSaltkeyObject,false,()=>{
5978
+ persister.saveDataToFileForClient(persisterClientId,persisterRepositoryName,globalKeyHashObject,false,()=>{
5979
5979
  // TRACE
5980
5980
  console.log("INFO : Hash added to repository and saved successfully.");
5981
5981
  });
5982
5982
 
5983
5983
  // OUTPUT
5984
- 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");
5985
5985
 
5986
5986
  return aotraNodeServer;
5987
5987
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.161",
3
+ "version": "0.0.164",
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)",