@etsoo/appscript 1.1.64 → 1.1.65

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.
@@ -409,10 +409,10 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
409
409
  /**
410
410
  * Enchance secret passphrase
411
411
  * @param passphrase Secret passphrase
412
- * @param miliseconds Miliseconds
412
+ * @param timestamp Timestamp
413
413
  * @returns Enhanced passphrase
414
414
  */
415
- protected encryptionEnhance(passphrase: string, miliseconds: string): string;
415
+ protected encryptionEnhance(passphrase: string, timestamp: string): string;
416
416
  /**
417
417
  * Format date to string
418
418
  * @param input Input date
@@ -204,9 +204,9 @@ class CoreApp {
204
204
  */
205
205
  decrypt(messageEncrypted, passphrase) {
206
206
  const pos = messageEncrypted.indexOf('+');
207
- const miliseconds = messageEncrypted.substring(0, pos);
207
+ const timestamp = messageEncrypted.substring(0, pos);
208
208
  const message = messageEncrypted.substring(pos + 1);
209
- return crypto_js_1.AES.decrypt(message, this.encryptionEnhance(passphrase, miliseconds)).toString();
209
+ return crypto_js_1.AES.decrypt(message, this.encryptionEnhance(passphrase, timestamp)).toString();
210
210
  }
211
211
  /**
212
212
  * Detect IP data, call only one time
@@ -248,20 +248,20 @@ class CoreApp {
248
248
  * @returns Result
249
249
  */
250
250
  encrypt(message, passphrase) {
251
- const miliseconds = shared_1.Utils.numberToChars(new Date().getTime());
252
- return (miliseconds +
251
+ const timestamp = shared_1.Utils.numberToChars(new Date().getTime());
252
+ return (timestamp +
253
253
  '+' +
254
- crypto_js_1.AES.encrypt(message, this.encryptionEnhance(passphrase, miliseconds)).toString());
254
+ crypto_js_1.AES.encrypt(message, this.encryptionEnhance(passphrase, timestamp)).toString());
255
255
  }
256
256
  /**
257
257
  * Enchance secret passphrase
258
258
  * @param passphrase Secret passphrase
259
- * @param miliseconds Miliseconds
259
+ * @param timestamp Timestamp
260
260
  * @returns Enhanced passphrase
261
261
  */
262
- encryptionEnhance(passphrase, miliseconds) {
262
+ encryptionEnhance(passphrase, timestamp) {
263
263
  var _a;
264
- passphrase += miliseconds;
264
+ passphrase += timestamp;
265
265
  passphrase += passphrase.length.toString();
266
266
  return passphrase + ((_a = this.passphrase) !== null && _a !== void 0 ? _a : '');
267
267
  }
@@ -540,6 +540,7 @@ class CoreApp {
540
540
  */
541
541
  userLogin(user, refreshToken, keep = false) {
542
542
  this.userData = user;
543
+ this.passphrase = user.passphrase;
543
544
  this.authorize(user.token, refreshToken, keep);
544
545
  }
545
546
  /**
@@ -27,6 +27,10 @@ export interface IUserData {
27
27
  * Access token
28
28
  */
29
29
  readonly token: string;
30
+ /**
31
+ * Secret passphrase
32
+ */
33
+ readonly passphrase: string;
30
34
  }
31
35
  /**
32
36
  * User interface
@@ -409,10 +409,10 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
409
409
  /**
410
410
  * Enchance secret passphrase
411
411
  * @param passphrase Secret passphrase
412
- * @param miliseconds Miliseconds
412
+ * @param timestamp Timestamp
413
413
  * @returns Enhanced passphrase
414
414
  */
415
- protected encryptionEnhance(passphrase: string, miliseconds: string): string;
415
+ protected encryptionEnhance(passphrase: string, timestamp: string): string;
416
416
  /**
417
417
  * Format date to string
418
418
  * @param input Input date
@@ -201,9 +201,9 @@ export class CoreApp {
201
201
  */
202
202
  decrypt(messageEncrypted, passphrase) {
203
203
  const pos = messageEncrypted.indexOf('+');
204
- const miliseconds = messageEncrypted.substring(0, pos);
204
+ const timestamp = messageEncrypted.substring(0, pos);
205
205
  const message = messageEncrypted.substring(pos + 1);
206
- return AES.decrypt(message, this.encryptionEnhance(passphrase, miliseconds)).toString();
206
+ return AES.decrypt(message, this.encryptionEnhance(passphrase, timestamp)).toString();
207
207
  }
208
208
  /**
209
209
  * Detect IP data, call only one time
@@ -245,20 +245,20 @@ export class CoreApp {
245
245
  * @returns Result
246
246
  */
247
247
  encrypt(message, passphrase) {
248
- const miliseconds = Utils.numberToChars(new Date().getTime());
249
- return (miliseconds +
248
+ const timestamp = Utils.numberToChars(new Date().getTime());
249
+ return (timestamp +
250
250
  '+' +
251
- AES.encrypt(message, this.encryptionEnhance(passphrase, miliseconds)).toString());
251
+ AES.encrypt(message, this.encryptionEnhance(passphrase, timestamp)).toString());
252
252
  }
253
253
  /**
254
254
  * Enchance secret passphrase
255
255
  * @param passphrase Secret passphrase
256
- * @param miliseconds Miliseconds
256
+ * @param timestamp Timestamp
257
257
  * @returns Enhanced passphrase
258
258
  */
259
- encryptionEnhance(passphrase, miliseconds) {
259
+ encryptionEnhance(passphrase, timestamp) {
260
260
  var _a;
261
- passphrase += miliseconds;
261
+ passphrase += timestamp;
262
262
  passphrase += passphrase.length.toString();
263
263
  return passphrase + ((_a = this.passphrase) !== null && _a !== void 0 ? _a : '');
264
264
  }
@@ -537,6 +537,7 @@ export class CoreApp {
537
537
  */
538
538
  userLogin(user, refreshToken, keep = false) {
539
539
  this.userData = user;
540
+ this.passphrase = user.passphrase;
540
541
  this.authorize(user.token, refreshToken, keep);
541
542
  }
542
543
  /**
@@ -27,6 +27,10 @@ export interface IUserData {
27
27
  * Access token
28
28
  */
29
29
  readonly token: string;
30
+ /**
31
+ * Secret passphrase
32
+ */
33
+ readonly passphrase: string;
30
34
  }
31
35
  /**
32
36
  * User interface
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.1.64",
3
+ "version": "1.1.65",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -661,11 +661,11 @@ export abstract class CoreApp<
661
661
  */
662
662
  decrypt(messageEncrypted: string, passphrase: string) {
663
663
  const pos = messageEncrypted.indexOf('+');
664
- const miliseconds = messageEncrypted.substring(0, pos);
664
+ const timestamp = messageEncrypted.substring(0, pos);
665
665
  const message = messageEncrypted.substring(pos + 1);
666
666
  return AES.decrypt(
667
667
  message,
668
- this.encryptionEnhance(passphrase, miliseconds)
668
+ this.encryptionEnhance(passphrase, timestamp)
669
669
  ).toString();
670
670
  }
671
671
 
@@ -716,13 +716,13 @@ export abstract class CoreApp<
716
716
  * @returns Result
717
717
  */
718
718
  encrypt(message: string, passphrase: string) {
719
- const miliseconds = Utils.numberToChars(new Date().getTime());
719
+ const timestamp = Utils.numberToChars(new Date().getTime());
720
720
  return (
721
- miliseconds +
721
+ timestamp +
722
722
  '+' +
723
723
  AES.encrypt(
724
724
  message,
725
- this.encryptionEnhance(passphrase, miliseconds)
725
+ this.encryptionEnhance(passphrase, timestamp)
726
726
  ).toString()
727
727
  );
728
728
  }
@@ -730,11 +730,11 @@ export abstract class CoreApp<
730
730
  /**
731
731
  * Enchance secret passphrase
732
732
  * @param passphrase Secret passphrase
733
- * @param miliseconds Miliseconds
733
+ * @param timestamp Timestamp
734
734
  * @returns Enhanced passphrase
735
735
  */
736
- protected encryptionEnhance(passphrase: string, miliseconds: string) {
737
- passphrase += miliseconds;
736
+ protected encryptionEnhance(passphrase: string, timestamp: string) {
737
+ passphrase += timestamp;
738
738
  passphrase += passphrase.length.toString();
739
739
  return passphrase + (this.passphrase ?? '');
740
740
  }
@@ -1065,6 +1065,7 @@ export abstract class CoreApp<
1065
1065
  */
1066
1066
  userLogin(user: IUserData, refreshToken: string, keep: boolean = false) {
1067
1067
  this.userData = user;
1068
+ this.passphrase = user.passphrase;
1068
1069
  this.authorize(user.token, refreshToken, keep);
1069
1070
  }
1070
1071
 
package/src/state/User.ts CHANGED
@@ -33,6 +33,11 @@ export interface IUserData {
33
33
  * Access token
34
34
  */
35
35
  readonly token: string;
36
+
37
+ /**
38
+ * Secret passphrase
39
+ */
40
+ readonly passphrase: string;
36
41
  }
37
42
 
38
43
  /**