cloud-ide-lms-model 1.0.132 → 1.0.134

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.
@@ -37,5 +37,9 @@ declare const coreRoutesUrl: {
37
37
  * @description Endpoint to get the currency (currency)
38
38
  */
39
39
  currency: string;
40
+ /**
41
+ * @description Endpoint to get the country (country)
42
+ */
43
+ country: string;
40
44
  };
41
45
  export { coreRoutesUrl };
@@ -39,7 +39,11 @@ const coreRoutesUrl = {
39
39
  /**
40
40
  * @description Endpoint to get the currency (currency)
41
41
  */
42
- currency: "currency"
42
+ currency: "currency",
43
+ /**
44
+ * @description Endpoint to get the country (country)
45
+ */
46
+ country: "country"
43
47
  };
44
48
  exports.coreRoutesUrl = coreRoutesUrl;
45
49
  Object.freeze(coreRoutesUrl);
@@ -186,19 +186,21 @@ exports.generateRandomAlphanumericString = generateRandomAlphanumericString;
186
186
  // method to generate string from object this should be encripted and decript json from string
187
187
  const generateStringFromObject = (object) => {
188
188
  let string = JSON.stringify(object);
189
- // create won encription method
190
- let encryptedString = "";
191
- for (let i = 0; i < string.length; i++) {
192
- encryptedString += String.fromCharCode(string.charCodeAt(i) + 1);
193
- }
189
+ // Use URL-safe base64 encoding
190
+ let encryptedString = btoa(string);
191
+ // Replace URL-unsafe characters with safe alternatives
192
+ encryptedString = encryptedString.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
194
193
  return encryptedString;
195
194
  };
196
195
  exports.generateStringFromObject = generateStringFromObject;
197
196
  const generateObjectFromString = (string) => {
198
- let decryptedString = "";
199
- for (let i = 0; i < string.length; i++) {
200
- decryptedString += String.fromCharCode(string.charCodeAt(i) - 1);
197
+ // Restore base64 padding and replace safe characters back
198
+ let paddedString = string.replace(/-/g, '+').replace(/_/g, '/');
199
+ // Add padding if needed
200
+ while (paddedString.length % 4) {
201
+ paddedString += '=';
201
202
  }
203
+ let decryptedString = atob(paddedString);
202
204
  let object = JSON.parse(decryptedString);
203
205
  return object;
204
206
  };
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "typescript": "^5.4.2"
6
6
  },
7
7
  "name": "cloud-ide-lms-model",
8
- "version": "1.0.132",
8
+ "version": "1.0.134",
9
9
  "description": "Package for Model management of Cloud IDEsys LMS",
10
10
  "main": "lib/index.js",
11
11
  "types": "lib/index.d.ts",