@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.
- package/lib/cjs/app/CoreApp.d.ts +2 -2
- package/lib/cjs/app/CoreApp.js +9 -8
- package/lib/cjs/state/User.d.ts +4 -0
- package/lib/mjs/app/CoreApp.d.ts +2 -2
- package/lib/mjs/app/CoreApp.js +9 -8
- package/lib/mjs/state/User.d.ts +4 -0
- package/package.json +1 -1
- package/src/app/CoreApp.ts +9 -8
- package/src/state/User.ts +5 -0
package/lib/cjs/app/CoreApp.d.ts
CHANGED
|
@@ -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
|
|
412
|
+
* @param timestamp Timestamp
|
|
413
413
|
* @returns Enhanced passphrase
|
|
414
414
|
*/
|
|
415
|
-
protected encryptionEnhance(passphrase: string,
|
|
415
|
+
protected encryptionEnhance(passphrase: string, timestamp: string): string;
|
|
416
416
|
/**
|
|
417
417
|
* Format date to string
|
|
418
418
|
* @param input Input date
|
package/lib/cjs/app/CoreApp.js
CHANGED
|
@@ -204,9 +204,9 @@ class CoreApp {
|
|
|
204
204
|
*/
|
|
205
205
|
decrypt(messageEncrypted, passphrase) {
|
|
206
206
|
const pos = messageEncrypted.indexOf('+');
|
|
207
|
-
const
|
|
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,
|
|
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
|
|
252
|
-
return (
|
|
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,
|
|
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
|
|
259
|
+
* @param timestamp Timestamp
|
|
260
260
|
* @returns Enhanced passphrase
|
|
261
261
|
*/
|
|
262
|
-
encryptionEnhance(passphrase,
|
|
262
|
+
encryptionEnhance(passphrase, timestamp) {
|
|
263
263
|
var _a;
|
|
264
|
-
passphrase +=
|
|
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
|
/**
|
package/lib/cjs/state/User.d.ts
CHANGED
package/lib/mjs/app/CoreApp.d.ts
CHANGED
|
@@ -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
|
|
412
|
+
* @param timestamp Timestamp
|
|
413
413
|
* @returns Enhanced passphrase
|
|
414
414
|
*/
|
|
415
|
-
protected encryptionEnhance(passphrase: string,
|
|
415
|
+
protected encryptionEnhance(passphrase: string, timestamp: string): string;
|
|
416
416
|
/**
|
|
417
417
|
* Format date to string
|
|
418
418
|
* @param input Input date
|
package/lib/mjs/app/CoreApp.js
CHANGED
|
@@ -201,9 +201,9 @@ export class CoreApp {
|
|
|
201
201
|
*/
|
|
202
202
|
decrypt(messageEncrypted, passphrase) {
|
|
203
203
|
const pos = messageEncrypted.indexOf('+');
|
|
204
|
-
const
|
|
204
|
+
const timestamp = messageEncrypted.substring(0, pos);
|
|
205
205
|
const message = messageEncrypted.substring(pos + 1);
|
|
206
|
-
return AES.decrypt(message, this.encryptionEnhance(passphrase,
|
|
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
|
|
249
|
-
return (
|
|
248
|
+
const timestamp = Utils.numberToChars(new Date().getTime());
|
|
249
|
+
return (timestamp +
|
|
250
250
|
'+' +
|
|
251
|
-
AES.encrypt(message, this.encryptionEnhance(passphrase,
|
|
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
|
|
256
|
+
* @param timestamp Timestamp
|
|
257
257
|
* @returns Enhanced passphrase
|
|
258
258
|
*/
|
|
259
|
-
encryptionEnhance(passphrase,
|
|
259
|
+
encryptionEnhance(passphrase, timestamp) {
|
|
260
260
|
var _a;
|
|
261
|
-
passphrase +=
|
|
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
|
/**
|
package/lib/mjs/state/User.d.ts
CHANGED
package/package.json
CHANGED
package/src/app/CoreApp.ts
CHANGED
|
@@ -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
|
|
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,
|
|
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
|
|
719
|
+
const timestamp = Utils.numberToChars(new Date().getTime());
|
|
720
720
|
return (
|
|
721
|
-
|
|
721
|
+
timestamp +
|
|
722
722
|
'+' +
|
|
723
723
|
AES.encrypt(
|
|
724
724
|
message,
|
|
725
|
-
this.encryptionEnhance(passphrase,
|
|
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
|
|
733
|
+
* @param timestamp Timestamp
|
|
734
734
|
* @returns Enhanced passphrase
|
|
735
735
|
*/
|
|
736
|
-
protected encryptionEnhance(passphrase: string,
|
|
737
|
-
passphrase +=
|
|
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
|
|