secure-ls2 2.1.5 → 2.1.7
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/coverage/clover.xml +2 -2
- package/coverage/coverage-final.json +1 -1
- package/coverage/lcov-report/index.html +1 -1
- package/coverage/lcov.info +2 -2
- package/dist/secure-ls2.js +1037 -1031
- package/dist/secure-ls2.js.map +1 -1
- package/dist/secure-ls2.min.js +2 -2
- package/dist/secure-ls2.min.js.map +1 -1
- package/package.json +11 -11
package/dist/secure-ls2.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* secure-ls2 - v2.1.
|
|
2
|
+
* secure-ls2 - v2.1.7
|
|
3
3
|
* URL - https://github.com/softvar/secure-ls
|
|
4
4
|
*
|
|
5
5
|
* The MIT License (MIT)
|
|
@@ -46,293 +46,877 @@
|
|
|
46
46
|
return /******/ (() => { // webpackBootstrap
|
|
47
47
|
/******/ var __webpack_modules__ = ({
|
|
48
48
|
|
|
49
|
-
/***/ "./
|
|
50
|
-
|
|
51
|
-
!*** ./
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
/***/ "./src/Base64.js"
|
|
50
|
+
/*!***********************!*\
|
|
51
|
+
!*** ./src/Base64.js ***!
|
|
52
|
+
\***********************/
|
|
53
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
54
54
|
|
|
55
|
-
;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
"use strict";
|
|
56
|
+
__webpack_require__.r(__webpack_exports__);
|
|
57
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
58
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
59
|
+
/* harmony export */ });
|
|
60
|
+
const Base64 = {
|
|
61
|
+
_keyStr: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
|
|
62
|
+
encode: function (e) {
|
|
63
|
+
let t = '';
|
|
64
|
+
let n, r, i, s, o, u, a;
|
|
65
|
+
let f = 0;
|
|
66
|
+
e = Base64._utf8Encode(e);
|
|
67
|
+
while (f < e.length) {
|
|
68
|
+
n = e.charCodeAt(f++);
|
|
69
|
+
r = e.charCodeAt(f++);
|
|
70
|
+
i = e.charCodeAt(f++);
|
|
71
|
+
s = n >> 2;
|
|
72
|
+
o = (n & 3) << 4 | r >> 4;
|
|
73
|
+
u = (r & 15) << 2 | i >> 6;
|
|
74
|
+
a = i & 63;
|
|
75
|
+
if (isNaN(r)) {
|
|
76
|
+
u = a = 64;
|
|
77
|
+
} else if (isNaN(i)) {
|
|
78
|
+
a = 64;
|
|
79
|
+
}
|
|
80
|
+
t = t + this._keyStr.charAt(s) + this._keyStr.charAt(o) + this._keyStr.charAt(u) + this._keyStr.charAt(a);
|
|
81
|
+
}
|
|
82
|
+
return t;
|
|
83
|
+
},
|
|
84
|
+
decode: function (e) {
|
|
85
|
+
let t = '';
|
|
86
|
+
let n, r, i;
|
|
87
|
+
let s, o, u, a;
|
|
88
|
+
let f = 0;
|
|
89
|
+
e = e.replace(/[^A-Za-z0-9+/=]/g, '');
|
|
90
|
+
while (f < e.length) {
|
|
91
|
+
s = this._keyStr.indexOf(e.charAt(f++));
|
|
92
|
+
o = this._keyStr.indexOf(e.charAt(f++));
|
|
93
|
+
u = this._keyStr.indexOf(e.charAt(f++));
|
|
94
|
+
a = this._keyStr.indexOf(e.charAt(f++));
|
|
95
|
+
n = s << 2 | o >> 4;
|
|
96
|
+
r = (o & 15) << 4 | u >> 2;
|
|
97
|
+
i = (u & 3) << 6 | a;
|
|
98
|
+
t = t + String.fromCharCode(n);
|
|
99
|
+
if (u !== 64) {
|
|
100
|
+
t = t + String.fromCharCode(r);
|
|
101
|
+
}
|
|
102
|
+
if (a !== 64) {
|
|
103
|
+
t = t + String.fromCharCode(i);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
t = Base64._utf8Decode(t);
|
|
107
|
+
return t;
|
|
108
|
+
},
|
|
109
|
+
_utf8Encode: function (e) {
|
|
110
|
+
e = e.replace(/\r\n/g, '\n');
|
|
111
|
+
let t = '';
|
|
112
|
+
for (let n = 0; n < e.length; n++) {
|
|
113
|
+
let r = e.charCodeAt(n);
|
|
114
|
+
if (r < 128) {
|
|
115
|
+
t += String.fromCharCode(r);
|
|
116
|
+
} else if (r > 127 && r < 2048) {
|
|
117
|
+
t += String.fromCharCode(r >> 6 | 192);
|
|
118
|
+
t += String.fromCharCode(r & 63 | 128);
|
|
119
|
+
} else {
|
|
120
|
+
t += String.fromCharCode(r >> 12 | 224);
|
|
121
|
+
t += String.fromCharCode(r >> 6 & 63 | 128);
|
|
122
|
+
t += String.fromCharCode(r & 63 | 128);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return t;
|
|
126
|
+
},
|
|
127
|
+
_utf8Decode: function (e) {
|
|
128
|
+
let t = '';
|
|
129
|
+
let n = 0;
|
|
130
|
+
let r, c2, c3;
|
|
131
|
+
r = c2 = 0;
|
|
132
|
+
while (n < e.length) {
|
|
133
|
+
r = e.charCodeAt(n);
|
|
134
|
+
if (r < 128) {
|
|
135
|
+
t += String.fromCharCode(r);
|
|
136
|
+
n++;
|
|
137
|
+
} else if (r > 191 && r < 224) {
|
|
138
|
+
c2 = e.charCodeAt(n + 1);
|
|
139
|
+
t += String.fromCharCode((r & 31) << 6 | c2 & 63);
|
|
140
|
+
n += 2;
|
|
141
|
+
} else {
|
|
142
|
+
c2 = e.charCodeAt(n + 1);
|
|
143
|
+
c3 = e.charCodeAt(n + 2);
|
|
144
|
+
t += String.fromCharCode((r & 15) << 12 | (c2 & 63) << 6 | c3 & 63);
|
|
145
|
+
n += 3;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return t;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Base64);
|
|
63
152
|
|
|
64
|
-
|
|
65
|
-
// Shortcuts
|
|
66
|
-
var C = CryptoJS;
|
|
67
|
-
var C_lib = C.lib;
|
|
68
|
-
var BlockCipher = C_lib.BlockCipher;
|
|
69
|
-
var C_algo = C.algo;
|
|
153
|
+
/***/ },
|
|
70
154
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
var SUB_MIX_2 = [];
|
|
77
|
-
var SUB_MIX_3 = [];
|
|
78
|
-
var INV_SUB_MIX_0 = [];
|
|
79
|
-
var INV_SUB_MIX_1 = [];
|
|
80
|
-
var INV_SUB_MIX_2 = [];
|
|
81
|
-
var INV_SUB_MIX_3 = [];
|
|
155
|
+
/***/ "./src/SecureLS.js"
|
|
156
|
+
/*!*************************!*\
|
|
157
|
+
!*** ./src/SecureLS.js ***!
|
|
158
|
+
\*************************/
|
|
159
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
82
160
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
161
|
+
"use strict";
|
|
162
|
+
__webpack_require__.r(__webpack_exports__);
|
|
163
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
164
|
+
/* harmony export */ SecureLS: () => (/* binding */ SecureLS)
|
|
165
|
+
/* harmony export */ });
|
|
166
|
+
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants */ "./src/constants.js");
|
|
167
|
+
/* harmony import */ var _enc_utf8__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./enc-utf8 */ "./src/enc-utf8.js");
|
|
168
|
+
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ "./src/utils.js");
|
|
169
|
+
/* harmony import */ var crypto_js_aes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! crypto-js/aes */ "./node_modules/crypto-js/aes.js");
|
|
170
|
+
/* harmony import */ var crypto_js_aes__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(crypto_js_aes__WEBPACK_IMPORTED_MODULE_3__);
|
|
171
|
+
/* harmony import */ var crypto_js_rabbit__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! crypto-js/rabbit */ "./node_modules/crypto-js/rabbit.js");
|
|
172
|
+
/* harmony import */ var crypto_js_rabbit__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(crypto_js_rabbit__WEBPACK_IMPORTED_MODULE_4__);
|
|
173
|
+
/* harmony import */ var crypto_js_rc4__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! crypto-js/rc4 */ "./node_modules/crypto-js/rc4.js");
|
|
174
|
+
/* harmony import */ var crypto_js_rc4__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(crypto_js_rc4__WEBPACK_IMPORTED_MODULE_5__);
|
|
175
|
+
/* harmony import */ var crypto_js_tripledes__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! crypto-js/tripledes */ "./node_modules/crypto-js/tripledes.js");
|
|
176
|
+
/* harmony import */ var crypto_js_tripledes__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(crypto_js_tripledes__WEBPACK_IMPORTED_MODULE_6__);
|
|
177
|
+
/* harmony import */ var lz_string_libs_lz_string__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! lz-string/libs/lz-string */ "./node_modules/lz-string/libs/lz-string.js");
|
|
178
|
+
/* harmony import */ var lz_string_libs_lz_string__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(lz_string_libs_lz_string__WEBPACK_IMPORTED_MODULE_7__);
|
|
179
|
+
/* harmony import */ var _Base64__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Base64 */ "./src/Base64.js");
|
|
94
180
|
|
|
95
|
-
// Walk GF(2^8)
|
|
96
|
-
var x = 0;
|
|
97
|
-
var xi = 0;
|
|
98
|
-
for (var i = 0; i < 256; i++) {
|
|
99
|
-
// Compute sbox
|
|
100
|
-
var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);
|
|
101
|
-
sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;
|
|
102
|
-
SBOX[x] = sx;
|
|
103
|
-
INV_SBOX[sx] = x;
|
|
104
181
|
|
|
105
|
-
// Compute multiplication
|
|
106
|
-
var x2 = d[x];
|
|
107
|
-
var x4 = d[x2];
|
|
108
|
-
var x8 = d[x4];
|
|
109
182
|
|
|
110
|
-
// Compute sub bytes, mix columns tables
|
|
111
|
-
var t = (d[sx] * 0x101) ^ (sx * 0x1010100);
|
|
112
|
-
SUB_MIX_0[x] = (t << 24) | (t >>> 8);
|
|
113
|
-
SUB_MIX_1[x] = (t << 16) | (t >>> 16);
|
|
114
|
-
SUB_MIX_2[x] = (t << 8) | (t >>> 24);
|
|
115
|
-
SUB_MIX_3[x] = t;
|
|
116
183
|
|
|
117
|
-
// Compute inv sub bytes, inv mix columns tables
|
|
118
|
-
var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);
|
|
119
|
-
INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);
|
|
120
|
-
INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);
|
|
121
|
-
INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24);
|
|
122
|
-
INV_SUB_MIX_3[sx] = t;
|
|
123
184
|
|
|
124
|
-
// Compute next counter
|
|
125
|
-
if (!x) {
|
|
126
|
-
x = xi = 1;
|
|
127
|
-
} else {
|
|
128
|
-
x = x2 ^ d[d[d[x8 ^ x2]]];
|
|
129
|
-
xi ^= d[d[xi]];
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}());
|
|
133
185
|
|
|
134
|
-
// Precomputed Rcon lookup
|
|
135
|
-
var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
|
|
136
186
|
|
|
137
|
-
/**
|
|
138
|
-
* AES block cipher algorithm.
|
|
139
|
-
*/
|
|
140
|
-
var AES = C_algo.AES = BlockCipher.extend({
|
|
141
|
-
_doReset: function () {
|
|
142
|
-
var t;
|
|
143
187
|
|
|
144
|
-
// Skip reset of nRounds has been set before and key did not change
|
|
145
|
-
if (this._nRounds && this._keyPriorReset === this._key) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
188
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
189
|
+
const encryptors = {
|
|
190
|
+
[_constants__WEBPACK_IMPORTED_MODULE_0__["default"].EncrytionTypes.AES]: (crypto_js_aes__WEBPACK_IMPORTED_MODULE_3___default()),
|
|
191
|
+
[_constants__WEBPACK_IMPORTED_MODULE_0__["default"].EncrytionTypes.DES]: (crypto_js_tripledes__WEBPACK_IMPORTED_MODULE_6___default()),
|
|
192
|
+
[_constants__WEBPACK_IMPORTED_MODULE_0__["default"].EncrytionTypes.RABBIT]: (crypto_js_rabbit__WEBPACK_IMPORTED_MODULE_4___default()),
|
|
193
|
+
[_constants__WEBPACK_IMPORTED_MODULE_0__["default"].EncrytionTypes.RC4]: (crypto_js_rc4__WEBPACK_IMPORTED_MODULE_5___default())
|
|
194
|
+
};
|
|
195
|
+
class SecureLS {
|
|
196
|
+
constructor({
|
|
197
|
+
encryptionSecret = '',
|
|
198
|
+
encryptionNamespace = '',
|
|
199
|
+
isCompression = true,
|
|
200
|
+
encodingType = _constants__WEBPACK_IMPORTED_MODULE_0__["default"].EncrytionTypes.BASE64,
|
|
201
|
+
storage = localStorage,
|
|
202
|
+
metaKey = _constants__WEBPACK_IMPORTED_MODULE_0__["default"].metaKey
|
|
203
|
+
} = {}) {
|
|
204
|
+
// Assign libraries and utilities
|
|
205
|
+
Object.assign(this, {
|
|
206
|
+
_name: 'secure-ls',
|
|
207
|
+
Base64: _Base64__WEBPACK_IMPORTED_MODULE_8__["default"],
|
|
208
|
+
LZString: {
|
|
209
|
+
compressToUTF16: lz_string_libs_lz_string__WEBPACK_IMPORTED_MODULE_7__.compressToUTF16,
|
|
210
|
+
decompressFromUTF16: lz_string_libs_lz_string__WEBPACK_IMPORTED_MODULE_7__.decompressFromUTF16
|
|
211
|
+
},
|
|
212
|
+
AES: (crypto_js_aes__WEBPACK_IMPORTED_MODULE_3___default()),
|
|
213
|
+
DES: (crypto_js_tripledes__WEBPACK_IMPORTED_MODULE_6___default()),
|
|
214
|
+
RABBIT: (crypto_js_rabbit__WEBPACK_IMPORTED_MODULE_4___default()),
|
|
215
|
+
RC4: (crypto_js_rc4__WEBPACK_IMPORTED_MODULE_5___default()),
|
|
216
|
+
enc: _enc_utf8__WEBPACK_IMPORTED_MODULE_1__["default"]
|
|
217
|
+
});
|
|
153
218
|
|
|
154
|
-
|
|
155
|
-
|
|
219
|
+
// Configuration and property assignment
|
|
220
|
+
this.config = {
|
|
221
|
+
encryptionSecret,
|
|
222
|
+
encryptionNamespace,
|
|
223
|
+
isCompression,
|
|
224
|
+
encodingType: encodingType.toLowerCase(),
|
|
225
|
+
storage,
|
|
226
|
+
metaKey
|
|
227
|
+
};
|
|
228
|
+
this.encryptionSecret = encryptionSecret;
|
|
229
|
+
this.storage = storage;
|
|
230
|
+
this.metaKey = metaKey;
|
|
156
231
|
|
|
157
|
-
|
|
158
|
-
|
|
232
|
+
// Initialize the class
|
|
233
|
+
this.init();
|
|
234
|
+
}
|
|
235
|
+
init() {
|
|
236
|
+
let metaData = this.getMetaData();
|
|
237
|
+
this._isBase64 = this._isBase64EncryptionType();
|
|
238
|
+
this._isAES = this._isAESEncryptionType();
|
|
239
|
+
this._isDES = this._isDESEncryptionType();
|
|
240
|
+
this._isRabbit = this._isRabbitEncryptionType();
|
|
241
|
+
this._isRC4 = this._isRC4EncryptionType();
|
|
242
|
+
this._isCompression = this._isDataCompressionEnabled();
|
|
159
243
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
244
|
+
// fill the already present keys to the list of keys being used by secure-ls
|
|
245
|
+
this.allKeys = metaData.keys || this.resetAllKeys();
|
|
246
|
+
}
|
|
247
|
+
_isBase64EncryptionType() {
|
|
248
|
+
return _Base64__WEBPACK_IMPORTED_MODULE_8__["default"] && (typeof this.config.encodingType === 'undefined' || this.config.encodingType === _constants__WEBPACK_IMPORTED_MODULE_0__["default"].EncrytionTypes.BASE64);
|
|
249
|
+
}
|
|
250
|
+
_isAESEncryptionType() {
|
|
251
|
+
return (crypto_js_aes__WEBPACK_IMPORTED_MODULE_3___default()) && this.config.encodingType === _constants__WEBPACK_IMPORTED_MODULE_0__["default"].EncrytionTypes.AES;
|
|
252
|
+
}
|
|
253
|
+
_isDESEncryptionType() {
|
|
254
|
+
return (crypto_js_tripledes__WEBPACK_IMPORTED_MODULE_6___default()) && this.config.encodingType === _constants__WEBPACK_IMPORTED_MODULE_0__["default"].EncrytionTypes.DES;
|
|
255
|
+
}
|
|
256
|
+
_isRabbitEncryptionType() {
|
|
257
|
+
return (crypto_js_rabbit__WEBPACK_IMPORTED_MODULE_4___default()) && this.config.encodingType === _constants__WEBPACK_IMPORTED_MODULE_0__["default"].EncrytionTypes.RABBIT;
|
|
258
|
+
}
|
|
259
|
+
_isRC4EncryptionType() {
|
|
260
|
+
return (crypto_js_rc4__WEBPACK_IMPORTED_MODULE_5___default()) && this.config.encodingType === _constants__WEBPACK_IMPORTED_MODULE_0__["default"].EncrytionTypes.RC4;
|
|
261
|
+
}
|
|
262
|
+
_isDataCompressionEnabled() {
|
|
263
|
+
return this.config.isCompression;
|
|
264
|
+
}
|
|
265
|
+
getEncryptionSecret(key) {
|
|
266
|
+
let metaData = this.getMetaData();
|
|
267
|
+
let obj = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].getObjectFromKey(metaData.keys, key);
|
|
268
|
+
if (!obj) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
if (this._isAES || this._isDES || this._isRabbit || this._isRC4) {
|
|
272
|
+
if (typeof this.config.encryptionSecret === 'undefined') {
|
|
273
|
+
this.encryptionSecret = obj.s;
|
|
274
|
+
if (!this.encryptionSecret) {
|
|
275
|
+
this.encryptionSecret = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].generateSecretKey();
|
|
276
|
+
this.setMetaData();
|
|
277
|
+
}
|
|
278
|
+
} else {
|
|
279
|
+
this.encryptionSecret = this.config.encryptionSecret || obj.s || '';
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
getEncryptionType() {
|
|
284
|
+
const encodingType = this.config.encodingType;
|
|
285
|
+
return encodingType ? encodingType.toLowerCase() : _constants__WEBPACK_IMPORTED_MODULE_0__["default"].EncrytionTypes.BASE64;
|
|
286
|
+
}
|
|
287
|
+
getDataFromLocalStorage(key) {
|
|
288
|
+
return this.storage.getItem(key, true);
|
|
289
|
+
}
|
|
290
|
+
setDataToLocalStorage(key, data) {
|
|
291
|
+
this.storage.setItem(key, data);
|
|
292
|
+
}
|
|
293
|
+
setMetaData() {
|
|
294
|
+
let dataToStore = this.processData({
|
|
295
|
+
keys: this.allKeys
|
|
296
|
+
}, true);
|
|
167
297
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
298
|
+
// Store the data to localStorage
|
|
299
|
+
this.setDataToLocalStorage(this.getMetaKey(), dataToStore);
|
|
300
|
+
}
|
|
301
|
+
getMetaData() {
|
|
302
|
+
return this.get(this.getMetaKey(), true) || {};
|
|
303
|
+
}
|
|
304
|
+
getMetaKey() {
|
|
305
|
+
return this.metaKey + (this.config.encryptionNamespace ? '__' + this.config.encryptionNamespace : '');
|
|
306
|
+
}
|
|
307
|
+
resetAllKeys() {
|
|
308
|
+
this.allKeys = [];
|
|
309
|
+
return [];
|
|
310
|
+
}
|
|
311
|
+
processData(data, isAllKeysData) {
|
|
312
|
+
if (data === null || data === undefined || data === '') {
|
|
313
|
+
return '';
|
|
314
|
+
}
|
|
315
|
+
let jsonData;
|
|
316
|
+
try {
|
|
317
|
+
jsonData = JSON.stringify(data);
|
|
318
|
+
} catch (err) {
|
|
319
|
+
throw new Error('Could not stringify data', err);
|
|
320
|
+
}
|
|
171
321
|
|
|
172
|
-
|
|
173
|
-
|
|
322
|
+
// Encode Based on encoding type
|
|
323
|
+
// If not set, default to Base64 for securing data
|
|
324
|
+
let encodedData = jsonData;
|
|
325
|
+
if (this._isBase64 || isAllKeysData) {
|
|
326
|
+
encodedData = _Base64__WEBPACK_IMPORTED_MODULE_8__["default"].encode(jsonData);
|
|
327
|
+
} else {
|
|
328
|
+
const encryptor = encryptors[this.getEncryptionType()];
|
|
329
|
+
if (encryptor) {
|
|
330
|
+
encodedData = encryptor.encrypt(jsonData, this.encryptionSecret);
|
|
331
|
+
}
|
|
332
|
+
encodedData = encodedData && encodedData.toString();
|
|
333
|
+
}
|
|
174
334
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
335
|
+
// Compress data if set to true
|
|
336
|
+
let compressedData = encodedData;
|
|
337
|
+
if (this._isCompression || isAllKeysData) {
|
|
338
|
+
compressedData = this.LZString.compressToUTF16(encodedData);
|
|
339
|
+
}
|
|
340
|
+
return compressedData;
|
|
341
|
+
}
|
|
181
342
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
343
|
+
// PUBLIC APIs
|
|
344
|
+
getAllKeys() {
|
|
345
|
+
let data = this.getMetaData();
|
|
346
|
+
return _utils__WEBPACK_IMPORTED_MODULE_2__["default"].extractKeyNames(data) || [];
|
|
347
|
+
}
|
|
348
|
+
get(key, isAllKeysData) {
|
|
349
|
+
let decodedData = '';
|
|
350
|
+
let jsonData = '';
|
|
351
|
+
if (!_utils__WEBPACK_IMPORTED_MODULE_2__["default"].is(key)) {
|
|
352
|
+
_utils__WEBPACK_IMPORTED_MODULE_2__["default"].warn(_constants__WEBPACK_IMPORTED_MODULE_0__["default"].WarningEnum.KEY_NOT_PROVIDED);
|
|
353
|
+
return jsonData;
|
|
354
|
+
}
|
|
355
|
+
let data = this.getDataFromLocalStorage(key);
|
|
356
|
+
if (!data) {
|
|
357
|
+
return jsonData;
|
|
358
|
+
}
|
|
359
|
+
let deCompressedData = data; // saves else
|
|
360
|
+
if (this._isCompression || isAllKeysData) {
|
|
361
|
+
// meta data always compressed
|
|
362
|
+
deCompressedData = this.LZString.decompressFromUTF16(data);
|
|
363
|
+
}
|
|
364
|
+
decodedData = deCompressedData; // saves else
|
|
365
|
+
if (this._isBase64 || isAllKeysData) {
|
|
366
|
+
// meta data always Base64
|
|
367
|
+
decodedData = _Base64__WEBPACK_IMPORTED_MODULE_8__["default"].decode(deCompressedData);
|
|
368
|
+
} else {
|
|
369
|
+
this.getEncryptionSecret(key);
|
|
370
|
+
const encryptor = encryptors[this.getEncryptionType()];
|
|
371
|
+
if (encryptor) {
|
|
372
|
+
const bytes = encryptor.decrypt(deCompressedData.toString(), this.encryptionSecret);
|
|
373
|
+
if (bytes) {
|
|
374
|
+
decodedData = bytes.toString(_enc_utf8__WEBPACK_IMPORTED_MODULE_1__["default"]._Utf8);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
try {
|
|
379
|
+
jsonData = JSON.parse(decodedData);
|
|
380
|
+
} catch (err) {
|
|
381
|
+
throw new Error('Could not parse JSON', err);
|
|
382
|
+
}
|
|
383
|
+
return jsonData;
|
|
384
|
+
}
|
|
385
|
+
set(key, data) {
|
|
386
|
+
let dataToStore = '';
|
|
387
|
+
if (!_utils__WEBPACK_IMPORTED_MODULE_2__["default"].is(key)) {
|
|
388
|
+
_utils__WEBPACK_IMPORTED_MODULE_2__["default"].warn(_constants__WEBPACK_IMPORTED_MODULE_0__["default"].WarningEnum.KEY_NOT_PROVIDED);
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
this.getEncryptionSecret(key);
|
|
185
392
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
393
|
+
// add key(s) to Array if not already added, only for keys other than meta key
|
|
394
|
+
if (!(String(key) === String(this.metaKey))) {
|
|
395
|
+
if (!_utils__WEBPACK_IMPORTED_MODULE_2__["default"].isKeyPresent(this.allKeys, key)) {
|
|
396
|
+
this.allKeys.push({
|
|
397
|
+
k: key,
|
|
398
|
+
s: this.encryptionSecret
|
|
399
|
+
});
|
|
400
|
+
this.setMetaData();
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
dataToStore = this.processData(data);
|
|
404
|
+
// Store the data to localStorage
|
|
405
|
+
this.setDataToLocalStorage(key, dataToStore);
|
|
406
|
+
}
|
|
407
|
+
remove(key) {
|
|
408
|
+
if (!_utils__WEBPACK_IMPORTED_MODULE_2__["default"].is(key)) {
|
|
409
|
+
_utils__WEBPACK_IMPORTED_MODULE_2__["default"].warn(_constants__WEBPACK_IMPORTED_MODULE_0__["default"].WarningEnum.KEY_NOT_PROVIDED);
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
if (key === this.metaKey && this.getAllKeys().length) {
|
|
413
|
+
_utils__WEBPACK_IMPORTED_MODULE_2__["default"].warn(_constants__WEBPACK_IMPORTED_MODULE_0__["default"].WarningEnum.META_KEY_REMOVE);
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
if (_utils__WEBPACK_IMPORTED_MODULE_2__["default"].isKeyPresent(this.allKeys, key)) {
|
|
417
|
+
_utils__WEBPACK_IMPORTED_MODULE_2__["default"].removeFromKeysList(this.allKeys, key);
|
|
418
|
+
this.setMetaData();
|
|
419
|
+
}
|
|
420
|
+
this.storage.removeItem(key);
|
|
421
|
+
}
|
|
422
|
+
removeAll() {
|
|
423
|
+
let keys = this.getAllKeys();
|
|
424
|
+
for (let i = 0; i < keys.length; i++) {
|
|
425
|
+
this.storage.removeItem(keys[i]);
|
|
426
|
+
}
|
|
427
|
+
this.storage.removeItem(this.metaKey);
|
|
428
|
+
this.resetAllKeys();
|
|
429
|
+
}
|
|
430
|
+
clear() {
|
|
431
|
+
this.storage.clear();
|
|
432
|
+
this.resetAllKeys();
|
|
433
|
+
}
|
|
434
|
+
}
|
|
190
435
|
|
|
191
|
-
|
|
192
|
-
var t = keySchedule[ksRow];
|
|
193
|
-
} else {
|
|
194
|
-
var t = keySchedule[ksRow - 4];
|
|
195
|
-
}
|
|
436
|
+
/***/ },
|
|
196
437
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
},
|
|
438
|
+
/***/ "./src/WordArray.js"
|
|
439
|
+
/*!**************************!*\
|
|
440
|
+
!*** ./src/WordArray.js ***!
|
|
441
|
+
\**************************/
|
|
442
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
205
443
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
444
|
+
"use strict";
|
|
445
|
+
__webpack_require__.r(__webpack_exports__);
|
|
446
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
447
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
448
|
+
/* harmony export */ });
|
|
449
|
+
/*
|
|
450
|
+
ES6 compatible port of CryptoJS - WordArray for PBKDF2 password key generation
|
|
209
451
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
M[offset + 1] = M[offset + 3];
|
|
214
|
-
M[offset + 3] = t;
|
|
452
|
+
Source: https://github.com/brix/crypto-js
|
|
453
|
+
LICENSE: MIT
|
|
454
|
+
*/
|
|
215
455
|
|
|
216
|
-
|
|
456
|
+
let CryptoJSWordArray = {
|
|
457
|
+
random: function (nBytes) {
|
|
458
|
+
let words = [];
|
|
459
|
+
let r = function (mw) {
|
|
460
|
+
let mz = 0x3ade68b1;
|
|
461
|
+
let mask = 0xffffffff;
|
|
462
|
+
return function () {
|
|
463
|
+
mz = 0x9069 * (mz & 0xffff) + (mz >> 0x10) & mask;
|
|
464
|
+
mw = 0x4650 * (mw & 0xffff) + (mw >> 0x10) & mask;
|
|
465
|
+
let result = (mz << 0x10) + mw & mask;
|
|
466
|
+
result /= 0x100000000;
|
|
467
|
+
result += 0.5;
|
|
468
|
+
return result * (Math.random() > 0.5 ? 1 : -1);
|
|
469
|
+
};
|
|
470
|
+
};
|
|
471
|
+
for (let i = 0, rcache; i < nBytes; i += 4) {
|
|
472
|
+
let _r = r((rcache || Math.random()) * 0x100000000);
|
|
473
|
+
rcache = _r() * 0x3ade67b7;
|
|
474
|
+
words.push(_r() * 0x100000000 | 0);
|
|
475
|
+
}
|
|
476
|
+
return new CryptoJSWordArray.Set(words, nBytes);
|
|
477
|
+
},
|
|
478
|
+
Set: function (words, sigBytes) {
|
|
479
|
+
words = this.words = words || [];
|
|
480
|
+
if (sigBytes !== undefined) {
|
|
481
|
+
this.sigBytes = sigBytes;
|
|
482
|
+
} else {
|
|
483
|
+
this.sigBytes = words.length * 8;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CryptoJSWordArray);
|
|
217
488
|
|
|
218
|
-
|
|
219
|
-
var t = M[offset + 1];
|
|
220
|
-
M[offset + 1] = M[offset + 3];
|
|
221
|
-
M[offset + 3] = t;
|
|
222
|
-
},
|
|
489
|
+
/***/ },
|
|
223
490
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
491
|
+
/***/ "./src/constants.js"
|
|
492
|
+
/*!**************************!*\
|
|
493
|
+
!*** ./src/constants.js ***!
|
|
494
|
+
\**************************/
|
|
495
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
227
496
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
497
|
+
"use strict";
|
|
498
|
+
__webpack_require__.r(__webpack_exports__);
|
|
499
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
500
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
501
|
+
/* harmony export */ });
|
|
502
|
+
const WarningEnum = {
|
|
503
|
+
KEY_NOT_PROVIDED: 'keyNotProvided',
|
|
504
|
+
META_KEY_REMOVE: 'metaKeyRemove',
|
|
505
|
+
DEFAULT_TEXT: 'defaultText'
|
|
506
|
+
};
|
|
507
|
+
const WarningTypes = {};
|
|
508
|
+
WarningTypes[WarningEnum.KEY_NOT_PROVIDED] = 'Secure LS: Key not provided. Aborting operation!';
|
|
509
|
+
WarningTypes[WarningEnum.META_KEY_REMOVE] = `Secure LS: Meta key can not be removed
|
|
510
|
+
unless all keys created by Secure LS are removed!`;
|
|
511
|
+
WarningTypes[WarningEnum.DEFAULT_TEXT] = `Unexpected output`;
|
|
512
|
+
const constants = {
|
|
513
|
+
WarningEnum: WarningEnum,
|
|
514
|
+
WarningTypes: WarningTypes,
|
|
515
|
+
EncrytionTypes: {
|
|
516
|
+
BASE64: 'base64',
|
|
517
|
+
AES: 'aes',
|
|
518
|
+
DES: 'des',
|
|
519
|
+
RABBIT: 'rabbit',
|
|
520
|
+
RC4: 'rc4'
|
|
521
|
+
},
|
|
522
|
+
metaKey: '_secure__ls__metadata',
|
|
523
|
+
secretPhrase: 's3cr3t$#@135^&*246'
|
|
524
|
+
};
|
|
525
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (constants);
|
|
233
526
|
|
|
234
|
-
|
|
235
|
-
var ksRow = 4;
|
|
527
|
+
/***/ },
|
|
236
528
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++];
|
|
243
|
-
var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++];
|
|
529
|
+
/***/ "./src/enc-utf8.js"
|
|
530
|
+
/*!*************************!*\
|
|
531
|
+
!*** ./src/enc-utf8.js ***!
|
|
532
|
+
\*************************/
|
|
533
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
244
534
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
535
|
+
"use strict";
|
|
536
|
+
__webpack_require__.r(__webpack_exports__);
|
|
537
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
538
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
539
|
+
/* harmony export */ });
|
|
540
|
+
/*
|
|
541
|
+
ES6 compatible port of CryptoJS - encoding
|
|
251
542
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
543
|
+
Source: https://github.com/brix/crypto-js
|
|
544
|
+
LICENSE: MIT
|
|
545
|
+
*/
|
|
546
|
+
const enc = {
|
|
547
|
+
Latin1: {
|
|
548
|
+
stringify: wordArray => {
|
|
549
|
+
// Shortcuts
|
|
550
|
+
let words = wordArray.words;
|
|
551
|
+
let sigBytes = wordArray.sigBytes;
|
|
552
|
+
let latin1Chars = [],
|
|
553
|
+
i,
|
|
554
|
+
bite;
|
|
257
555
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
556
|
+
// Convert
|
|
557
|
+
for (i = 0; i < sigBytes; i++) {
|
|
558
|
+
bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
|
|
559
|
+
latin1Chars.push(String.fromCharCode(bite));
|
|
560
|
+
}
|
|
561
|
+
return latin1Chars.join('');
|
|
562
|
+
}
|
|
563
|
+
},
|
|
564
|
+
_Utf8: {
|
|
565
|
+
stringify: wordArray => {
|
|
566
|
+
try {
|
|
567
|
+
return decodeURIComponent(escape(enc.Latin1.stringify(wordArray)));
|
|
568
|
+
} catch (err) {
|
|
569
|
+
throw new Error('Malformed UTF-8 data', err);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (enc);
|
|
264
575
|
|
|
265
|
-
|
|
266
|
-
});
|
|
576
|
+
/***/ },
|
|
267
577
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
* var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);
|
|
274
|
-
* var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg);
|
|
275
|
-
*/
|
|
276
|
-
C.AES = BlockCipher._createHelper(AES);
|
|
277
|
-
}());
|
|
578
|
+
/***/ "./src/utils.js"
|
|
579
|
+
/*!**********************!*\
|
|
580
|
+
!*** ./src/utils.js ***!
|
|
581
|
+
\**********************/
|
|
582
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
278
583
|
|
|
584
|
+
"use strict";
|
|
585
|
+
__webpack_require__.r(__webpack_exports__);
|
|
586
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
587
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
588
|
+
/* harmony export */ });
|
|
589
|
+
/* harmony import */ var crypto_js_pbkdf2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! crypto-js/pbkdf2 */ "./node_modules/crypto-js/pbkdf2.js");
|
|
590
|
+
/* harmony import */ var crypto_js_pbkdf2__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(crypto_js_pbkdf2__WEBPACK_IMPORTED_MODULE_0__);
|
|
591
|
+
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants */ "./src/constants.js");
|
|
592
|
+
/* harmony import */ var _WordArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./WordArray */ "./src/WordArray.js");
|
|
279
593
|
|
|
280
|
-
return CryptoJS.AES;
|
|
281
594
|
|
|
282
|
-
}));
|
|
283
595
|
|
|
284
|
-
|
|
596
|
+
const utils = {
|
|
597
|
+
is: key => !!key,
|
|
598
|
+
warn: (reason = _constants__WEBPACK_IMPORTED_MODULE_1__["default"].WarningEnum.DEFAULT_TEXT) => {
|
|
599
|
+
console.warn(_constants__WEBPACK_IMPORTED_MODULE_1__["default"].WarningTypes[reason]);
|
|
600
|
+
},
|
|
601
|
+
generateSecretKey: () => {
|
|
602
|
+
const salt = _WordArray__WEBPACK_IMPORTED_MODULE_2__["default"].random(128 / 8);
|
|
603
|
+
const key128Bits = crypto_js_pbkdf2__WEBPACK_IMPORTED_MODULE_0___default()(_constants__WEBPACK_IMPORTED_MODULE_1__["default"].secretPhrase, salt, {
|
|
604
|
+
keySize: 128 / 32
|
|
605
|
+
});
|
|
606
|
+
return key128Bits.toString();
|
|
607
|
+
},
|
|
608
|
+
getObjectFromKey: (data = [], key) => {
|
|
609
|
+
return data.find(item => item.k === key) || {};
|
|
610
|
+
},
|
|
611
|
+
extractKeyNames: ({
|
|
612
|
+
keys = []
|
|
613
|
+
} = {}) => {
|
|
614
|
+
return keys.map(({
|
|
615
|
+
k
|
|
616
|
+
}) => k);
|
|
617
|
+
},
|
|
618
|
+
isKeyPresent: (allKeys = [], key) => {
|
|
619
|
+
return allKeys.some(item => String(item.k) === String(key));
|
|
620
|
+
},
|
|
621
|
+
removeFromKeysList: (allKeys = [], key) => {
|
|
622
|
+
const index = allKeys.findIndex(item => item.k === key);
|
|
623
|
+
if (index !== -1) {
|
|
624
|
+
allKeys.splice(index, 1);
|
|
625
|
+
}
|
|
626
|
+
return index;
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (utils);
|
|
630
|
+
|
|
631
|
+
/***/ },
|
|
285
632
|
|
|
286
|
-
/***/ "./node_modules/crypto-js/
|
|
287
|
-
|
|
288
|
-
!*** ./node_modules/crypto-js/
|
|
289
|
-
|
|
290
|
-
|
|
633
|
+
/***/ "./node_modules/crypto-js/aes.js"
|
|
634
|
+
/*!***************************************!*\
|
|
635
|
+
!*** ./node_modules/crypto-js/aes.js ***!
|
|
636
|
+
\***************************************/
|
|
637
|
+
(module, exports, __webpack_require__) {
|
|
291
638
|
|
|
292
639
|
;(function (root, factory, undef) {
|
|
293
640
|
if (true) {
|
|
294
641
|
// CommonJS
|
|
295
|
-
module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./evpkdf */ "./node_modules/crypto-js/evpkdf.js"));
|
|
642
|
+
module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./enc-base64 */ "./node_modules/crypto-js/enc-base64.js"), __webpack_require__(/*! ./md5 */ "./node_modules/crypto-js/md5.js"), __webpack_require__(/*! ./evpkdf */ "./node_modules/crypto-js/evpkdf.js"), __webpack_require__(/*! ./cipher-core */ "./node_modules/crypto-js/cipher-core.js"));
|
|
296
643
|
}
|
|
297
644
|
else // removed by dead control flow
|
|
298
645
|
{}
|
|
299
646
|
}(this, function (CryptoJS) {
|
|
300
647
|
|
|
301
|
-
|
|
302
|
-
* Cipher core components.
|
|
303
|
-
*/
|
|
304
|
-
CryptoJS.lib.Cipher || (function (undefined) {
|
|
648
|
+
(function () {
|
|
305
649
|
// Shortcuts
|
|
306
650
|
var C = CryptoJS;
|
|
307
651
|
var C_lib = C.lib;
|
|
308
|
-
var
|
|
309
|
-
var WordArray = C_lib.WordArray;
|
|
310
|
-
var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
|
|
311
|
-
var C_enc = C.enc;
|
|
312
|
-
var Utf8 = C_enc.Utf8;
|
|
313
|
-
var Base64 = C_enc.Base64;
|
|
652
|
+
var BlockCipher = C_lib.BlockCipher;
|
|
314
653
|
var C_algo = C.algo;
|
|
315
|
-
var EvpKDF = C_algo.EvpKDF;
|
|
316
654
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
var
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
*
|
|
329
|
-
* @property {WordArray} iv The IV to use for this operation.
|
|
330
|
-
*/
|
|
331
|
-
cfg: Base.extend(),
|
|
655
|
+
// Lookup tables
|
|
656
|
+
var SBOX = [];
|
|
657
|
+
var INV_SBOX = [];
|
|
658
|
+
var SUB_MIX_0 = [];
|
|
659
|
+
var SUB_MIX_1 = [];
|
|
660
|
+
var SUB_MIX_2 = [];
|
|
661
|
+
var SUB_MIX_3 = [];
|
|
662
|
+
var INV_SUB_MIX_0 = [];
|
|
663
|
+
var INV_SUB_MIX_1 = [];
|
|
664
|
+
var INV_SUB_MIX_2 = [];
|
|
665
|
+
var INV_SUB_MIX_3 = [];
|
|
332
666
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
667
|
+
// Compute lookup tables
|
|
668
|
+
(function () {
|
|
669
|
+
// Compute double table
|
|
670
|
+
var d = [];
|
|
671
|
+
for (var i = 0; i < 256; i++) {
|
|
672
|
+
if (i < 128) {
|
|
673
|
+
d[i] = i << 1;
|
|
674
|
+
} else {
|
|
675
|
+
d[i] = (i << 1) ^ 0x11b;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// Walk GF(2^8)
|
|
680
|
+
var x = 0;
|
|
681
|
+
var xi = 0;
|
|
682
|
+
for (var i = 0; i < 256; i++) {
|
|
683
|
+
// Compute sbox
|
|
684
|
+
var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);
|
|
685
|
+
sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;
|
|
686
|
+
SBOX[x] = sx;
|
|
687
|
+
INV_SBOX[sx] = x;
|
|
688
|
+
|
|
689
|
+
// Compute multiplication
|
|
690
|
+
var x2 = d[x];
|
|
691
|
+
var x4 = d[x2];
|
|
692
|
+
var x8 = d[x4];
|
|
693
|
+
|
|
694
|
+
// Compute sub bytes, mix columns tables
|
|
695
|
+
var t = (d[sx] * 0x101) ^ (sx * 0x1010100);
|
|
696
|
+
SUB_MIX_0[x] = (t << 24) | (t >>> 8);
|
|
697
|
+
SUB_MIX_1[x] = (t << 16) | (t >>> 16);
|
|
698
|
+
SUB_MIX_2[x] = (t << 8) | (t >>> 24);
|
|
699
|
+
SUB_MIX_3[x] = t;
|
|
700
|
+
|
|
701
|
+
// Compute inv sub bytes, inv mix columns tables
|
|
702
|
+
var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);
|
|
703
|
+
INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);
|
|
704
|
+
INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);
|
|
705
|
+
INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24);
|
|
706
|
+
INV_SUB_MIX_3[sx] = t;
|
|
707
|
+
|
|
708
|
+
// Compute next counter
|
|
709
|
+
if (!x) {
|
|
710
|
+
x = xi = 1;
|
|
711
|
+
} else {
|
|
712
|
+
x = x2 ^ d[d[d[x8 ^ x2]]];
|
|
713
|
+
xi ^= d[d[xi]];
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
}());
|
|
717
|
+
|
|
718
|
+
// Precomputed Rcon lookup
|
|
719
|
+
var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* AES block cipher algorithm.
|
|
723
|
+
*/
|
|
724
|
+
var AES = C_algo.AES = BlockCipher.extend({
|
|
725
|
+
_doReset: function () {
|
|
726
|
+
var t;
|
|
727
|
+
|
|
728
|
+
// Skip reset of nRounds has been set before and key did not change
|
|
729
|
+
if (this._nRounds && this._keyPriorReset === this._key) {
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
// Shortcuts
|
|
734
|
+
var key = this._keyPriorReset = this._key;
|
|
735
|
+
var keyWords = key.words;
|
|
736
|
+
var keySize = key.sigBytes / 4;
|
|
737
|
+
|
|
738
|
+
// Compute number of rounds
|
|
739
|
+
var nRounds = this._nRounds = keySize + 6;
|
|
740
|
+
|
|
741
|
+
// Compute number of key schedule rows
|
|
742
|
+
var ksRows = (nRounds + 1) * 4;
|
|
743
|
+
|
|
744
|
+
// Compute key schedule
|
|
745
|
+
var keySchedule = this._keySchedule = [];
|
|
746
|
+
for (var ksRow = 0; ksRow < ksRows; ksRow++) {
|
|
747
|
+
if (ksRow < keySize) {
|
|
748
|
+
keySchedule[ksRow] = keyWords[ksRow];
|
|
749
|
+
} else {
|
|
750
|
+
t = keySchedule[ksRow - 1];
|
|
751
|
+
|
|
752
|
+
if (!(ksRow % keySize)) {
|
|
753
|
+
// Rot word
|
|
754
|
+
t = (t << 8) | (t >>> 24);
|
|
755
|
+
|
|
756
|
+
// Sub word
|
|
757
|
+
t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
|
|
758
|
+
|
|
759
|
+
// Mix Rcon
|
|
760
|
+
t ^= RCON[(ksRow / keySize) | 0] << 24;
|
|
761
|
+
} else if (keySize > 6 && ksRow % keySize == 4) {
|
|
762
|
+
// Sub word
|
|
763
|
+
t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
// Compute inv key schedule
|
|
771
|
+
var invKeySchedule = this._invKeySchedule = [];
|
|
772
|
+
for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {
|
|
773
|
+
var ksRow = ksRows - invKsRow;
|
|
774
|
+
|
|
775
|
+
if (invKsRow % 4) {
|
|
776
|
+
var t = keySchedule[ksRow];
|
|
777
|
+
} else {
|
|
778
|
+
var t = keySchedule[ksRow - 4];
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
if (invKsRow < 4 || ksRow <= 4) {
|
|
782
|
+
invKeySchedule[invKsRow] = t;
|
|
783
|
+
} else {
|
|
784
|
+
invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^
|
|
785
|
+
INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
},
|
|
789
|
+
|
|
790
|
+
encryptBlock: function (M, offset) {
|
|
791
|
+
this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
|
|
792
|
+
},
|
|
793
|
+
|
|
794
|
+
decryptBlock: function (M, offset) {
|
|
795
|
+
// Swap 2nd and 4th rows
|
|
796
|
+
var t = M[offset + 1];
|
|
797
|
+
M[offset + 1] = M[offset + 3];
|
|
798
|
+
M[offset + 3] = t;
|
|
799
|
+
|
|
800
|
+
this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);
|
|
801
|
+
|
|
802
|
+
// Inv swap 2nd and 4th rows
|
|
803
|
+
var t = M[offset + 1];
|
|
804
|
+
M[offset + 1] = M[offset + 3];
|
|
805
|
+
M[offset + 3] = t;
|
|
806
|
+
},
|
|
807
|
+
|
|
808
|
+
_doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {
|
|
809
|
+
// Shortcut
|
|
810
|
+
var nRounds = this._nRounds;
|
|
811
|
+
|
|
812
|
+
// Get input, add round key
|
|
813
|
+
var s0 = M[offset] ^ keySchedule[0];
|
|
814
|
+
var s1 = M[offset + 1] ^ keySchedule[1];
|
|
815
|
+
var s2 = M[offset + 2] ^ keySchedule[2];
|
|
816
|
+
var s3 = M[offset + 3] ^ keySchedule[3];
|
|
817
|
+
|
|
818
|
+
// Key schedule row counter
|
|
819
|
+
var ksRow = 4;
|
|
820
|
+
|
|
821
|
+
// Rounds
|
|
822
|
+
for (var round = 1; round < nRounds; round++) {
|
|
823
|
+
// Shift rows, sub bytes, mix columns, add round key
|
|
824
|
+
var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++];
|
|
825
|
+
var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++];
|
|
826
|
+
var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++];
|
|
827
|
+
var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++];
|
|
828
|
+
|
|
829
|
+
// Update state
|
|
830
|
+
s0 = t0;
|
|
831
|
+
s1 = t1;
|
|
832
|
+
s2 = t2;
|
|
833
|
+
s3 = t3;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
// Shift rows, sub bytes, add round key
|
|
837
|
+
var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];
|
|
838
|
+
var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];
|
|
839
|
+
var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];
|
|
840
|
+
var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];
|
|
841
|
+
|
|
842
|
+
// Set output
|
|
843
|
+
M[offset] = t0;
|
|
844
|
+
M[offset + 1] = t1;
|
|
845
|
+
M[offset + 2] = t2;
|
|
846
|
+
M[offset + 3] = t3;
|
|
847
|
+
},
|
|
848
|
+
|
|
849
|
+
keySize: 256/32
|
|
850
|
+
});
|
|
851
|
+
|
|
852
|
+
/**
|
|
853
|
+
* Shortcut functions to the cipher's object interface.
|
|
854
|
+
*
|
|
855
|
+
* @example
|
|
856
|
+
*
|
|
857
|
+
* var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);
|
|
858
|
+
* var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg);
|
|
859
|
+
*/
|
|
860
|
+
C.AES = BlockCipher._createHelper(AES);
|
|
861
|
+
}());
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
return CryptoJS.AES;
|
|
865
|
+
|
|
866
|
+
}));
|
|
867
|
+
|
|
868
|
+
/***/ },
|
|
869
|
+
|
|
870
|
+
/***/ "./node_modules/crypto-js/cipher-core.js"
|
|
871
|
+
/*!***********************************************!*\
|
|
872
|
+
!*** ./node_modules/crypto-js/cipher-core.js ***!
|
|
873
|
+
\***********************************************/
|
|
874
|
+
(module, exports, __webpack_require__) {
|
|
875
|
+
|
|
876
|
+
;(function (root, factory, undef) {
|
|
877
|
+
if (true) {
|
|
878
|
+
// CommonJS
|
|
879
|
+
module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./evpkdf */ "./node_modules/crypto-js/evpkdf.js"));
|
|
880
|
+
}
|
|
881
|
+
else // removed by dead control flow
|
|
882
|
+
{}
|
|
883
|
+
}(this, function (CryptoJS) {
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* Cipher core components.
|
|
887
|
+
*/
|
|
888
|
+
CryptoJS.lib.Cipher || (function (undefined) {
|
|
889
|
+
// Shortcuts
|
|
890
|
+
var C = CryptoJS;
|
|
891
|
+
var C_lib = C.lib;
|
|
892
|
+
var Base = C_lib.Base;
|
|
893
|
+
var WordArray = C_lib.WordArray;
|
|
894
|
+
var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
|
|
895
|
+
var C_enc = C.enc;
|
|
896
|
+
var Utf8 = C_enc.Utf8;
|
|
897
|
+
var Base64 = C_enc.Base64;
|
|
898
|
+
var C_algo = C.algo;
|
|
899
|
+
var EvpKDF = C_algo.EvpKDF;
|
|
900
|
+
|
|
901
|
+
/**
|
|
902
|
+
* Abstract base cipher template.
|
|
903
|
+
*
|
|
904
|
+
* @property {number} keySize This cipher's key size. Default: 4 (128 bits)
|
|
905
|
+
* @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)
|
|
906
|
+
* @property {number} _ENC_XFORM_MODE A constant representing encryption mode.
|
|
907
|
+
* @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
|
|
908
|
+
*/
|
|
909
|
+
var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
|
|
910
|
+
/**
|
|
911
|
+
* Configuration options.
|
|
912
|
+
*
|
|
913
|
+
* @property {WordArray} iv The IV to use for this operation.
|
|
914
|
+
*/
|
|
915
|
+
cfg: Base.extend(),
|
|
916
|
+
|
|
917
|
+
/**
|
|
918
|
+
* Creates this cipher in encryption mode.
|
|
919
|
+
*
|
|
336
920
|
* @param {WordArray} key The key.
|
|
337
921
|
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
|
338
922
|
*
|
|
@@ -1179,13 +1763,13 @@ return /******/ (() => { // webpackBootstrap
|
|
|
1179
1763
|
|
|
1180
1764
|
}));
|
|
1181
1765
|
|
|
1182
|
-
/***/ }
|
|
1766
|
+
/***/ },
|
|
1183
1767
|
|
|
1184
|
-
/***/ "./node_modules/crypto-js/core.js"
|
|
1768
|
+
/***/ "./node_modules/crypto-js/core.js"
|
|
1185
1769
|
/*!****************************************!*\
|
|
1186
1770
|
!*** ./node_modules/crypto-js/core.js ***!
|
|
1187
1771
|
\****************************************/
|
|
1188
|
-
|
|
1772
|
+
(module, exports, __webpack_require__) {
|
|
1189
1773
|
|
|
1190
1774
|
;(function (root, factory) {
|
|
1191
1775
|
if (true) {
|
|
@@ -1989,13 +2573,13 @@ return /******/ (() => { // webpackBootstrap
|
|
|
1989
2573
|
|
|
1990
2574
|
}));
|
|
1991
2575
|
|
|
1992
|
-
/***/ }
|
|
2576
|
+
/***/ },
|
|
1993
2577
|
|
|
1994
|
-
/***/ "./node_modules/crypto-js/enc-base64.js"
|
|
2578
|
+
/***/ "./node_modules/crypto-js/enc-base64.js"
|
|
1995
2579
|
/*!**********************************************!*\
|
|
1996
2580
|
!*** ./node_modules/crypto-js/enc-base64.js ***!
|
|
1997
2581
|
\**********************************************/
|
|
1998
|
-
|
|
2582
|
+
(module, exports, __webpack_require__) {
|
|
1999
2583
|
|
|
2000
2584
|
;(function (root, factory) {
|
|
2001
2585
|
if (true) {
|
|
@@ -2128,13 +2712,13 @@ return /******/ (() => { // webpackBootstrap
|
|
|
2128
2712
|
|
|
2129
2713
|
}));
|
|
2130
2714
|
|
|
2131
|
-
/***/ }
|
|
2715
|
+
/***/ },
|
|
2132
2716
|
|
|
2133
|
-
/***/ "./node_modules/crypto-js/evpkdf.js"
|
|
2717
|
+
/***/ "./node_modules/crypto-js/evpkdf.js"
|
|
2134
2718
|
/*!******************************************!*\
|
|
2135
2719
|
!*** ./node_modules/crypto-js/evpkdf.js ***!
|
|
2136
2720
|
\******************************************/
|
|
2137
|
-
|
|
2721
|
+
(module, exports, __webpack_require__) {
|
|
2138
2722
|
|
|
2139
2723
|
;(function (root, factory, undef) {
|
|
2140
2724
|
if (true) {
|
|
@@ -2265,13 +2849,13 @@ return /******/ (() => { // webpackBootstrap
|
|
|
2265
2849
|
|
|
2266
2850
|
}));
|
|
2267
2851
|
|
|
2268
|
-
/***/ }
|
|
2852
|
+
/***/ },
|
|
2269
2853
|
|
|
2270
|
-
/***/ "./node_modules/crypto-js/hmac.js"
|
|
2854
|
+
/***/ "./node_modules/crypto-js/hmac.js"
|
|
2271
2855
|
/*!****************************************!*\
|
|
2272
2856
|
!*** ./node_modules/crypto-js/hmac.js ***!
|
|
2273
2857
|
\****************************************/
|
|
2274
|
-
|
|
2858
|
+
(module, exports, __webpack_require__) {
|
|
2275
2859
|
|
|
2276
2860
|
;(function (root, factory) {
|
|
2277
2861
|
if (true) {
|
|
@@ -2411,13 +2995,13 @@ return /******/ (() => { // webpackBootstrap
|
|
|
2411
2995
|
|
|
2412
2996
|
}));
|
|
2413
2997
|
|
|
2414
|
-
/***/ }
|
|
2998
|
+
/***/ },
|
|
2415
2999
|
|
|
2416
|
-
/***/ "./node_modules/crypto-js/md5.js"
|
|
3000
|
+
/***/ "./node_modules/crypto-js/md5.js"
|
|
2417
3001
|
/*!***************************************!*\
|
|
2418
3002
|
!*** ./node_modules/crypto-js/md5.js ***!
|
|
2419
3003
|
\***************************************/
|
|
2420
|
-
|
|
3004
|
+
(module, exports, __webpack_require__) {
|
|
2421
3005
|
|
|
2422
3006
|
;(function (root, factory) {
|
|
2423
3007
|
if (true) {
|
|
@@ -2682,13 +3266,13 @@ return /******/ (() => { // webpackBootstrap
|
|
|
2682
3266
|
|
|
2683
3267
|
}));
|
|
2684
3268
|
|
|
2685
|
-
/***/ }
|
|
3269
|
+
/***/ },
|
|
2686
3270
|
|
|
2687
|
-
/***/ "./node_modules/crypto-js/pbkdf2.js"
|
|
3271
|
+
/***/ "./node_modules/crypto-js/pbkdf2.js"
|
|
2688
3272
|
/*!******************************************!*\
|
|
2689
3273
|
!*** ./node_modules/crypto-js/pbkdf2.js ***!
|
|
2690
3274
|
\******************************************/
|
|
2691
|
-
|
|
3275
|
+
(module, exports, __webpack_require__) {
|
|
2692
3276
|
|
|
2693
3277
|
;(function (root, factory, undef) {
|
|
2694
3278
|
if (true) {
|
|
@@ -2830,13 +3414,13 @@ return /******/ (() => { // webpackBootstrap
|
|
|
2830
3414
|
|
|
2831
3415
|
}));
|
|
2832
3416
|
|
|
2833
|
-
/***/ }
|
|
3417
|
+
/***/ },
|
|
2834
3418
|
|
|
2835
|
-
/***/ "./node_modules/crypto-js/rabbit.js"
|
|
3419
|
+
/***/ "./node_modules/crypto-js/rabbit.js"
|
|
2836
3420
|
/*!******************************************!*\
|
|
2837
3421
|
!*** ./node_modules/crypto-js/rabbit.js ***!
|
|
2838
3422
|
\******************************************/
|
|
2839
|
-
|
|
3423
|
+
(module, exports, __webpack_require__) {
|
|
2840
3424
|
|
|
2841
3425
|
;(function (root, factory, undef) {
|
|
2842
3426
|
if (true) {
|
|
@@ -3025,13 +3609,13 @@ return /******/ (() => { // webpackBootstrap
|
|
|
3025
3609
|
|
|
3026
3610
|
}));
|
|
3027
3611
|
|
|
3028
|
-
/***/ }
|
|
3612
|
+
/***/ },
|
|
3029
3613
|
|
|
3030
|
-
/***/ "./node_modules/crypto-js/rc4.js"
|
|
3614
|
+
/***/ "./node_modules/crypto-js/rc4.js"
|
|
3031
3615
|
/*!***************************************!*\
|
|
3032
3616
|
!*** ./node_modules/crypto-js/rc4.js ***!
|
|
3033
3617
|
\***************************************/
|
|
3034
|
-
|
|
3618
|
+
(module, exports, __webpack_require__) {
|
|
3035
3619
|
|
|
3036
3620
|
;(function (root, factory, undef) {
|
|
3037
3621
|
if (true) {
|
|
@@ -3167,13 +3751,13 @@ return /******/ (() => { // webpackBootstrap
|
|
|
3167
3751
|
|
|
3168
3752
|
}));
|
|
3169
3753
|
|
|
3170
|
-
/***/ }
|
|
3754
|
+
/***/ },
|
|
3171
3755
|
|
|
3172
|
-
/***/ "./node_modules/crypto-js/sha1.js"
|
|
3756
|
+
/***/ "./node_modules/crypto-js/sha1.js"
|
|
3173
3757
|
/*!****************************************!*\
|
|
3174
3758
|
!*** ./node_modules/crypto-js/sha1.js ***!
|
|
3175
3759
|
\****************************************/
|
|
3176
|
-
|
|
3760
|
+
(module, exports, __webpack_require__) {
|
|
3177
3761
|
|
|
3178
3762
|
;(function (root, factory) {
|
|
3179
3763
|
if (true) {
|
|
@@ -3320,13 +3904,13 @@ return /******/ (() => { // webpackBootstrap
|
|
|
3320
3904
|
|
|
3321
3905
|
}));
|
|
3322
3906
|
|
|
3323
|
-
/***/ }
|
|
3907
|
+
/***/ },
|
|
3324
3908
|
|
|
3325
|
-
/***/ "./node_modules/crypto-js/sha256.js"
|
|
3909
|
+
/***/ "./node_modules/crypto-js/sha256.js"
|
|
3326
3910
|
/*!******************************************!*\
|
|
3327
3911
|
!*** ./node_modules/crypto-js/sha256.js ***!
|
|
3328
3912
|
\******************************************/
|
|
3329
|
-
|
|
3913
|
+
(module, exports, __webpack_require__) {
|
|
3330
3914
|
|
|
3331
3915
|
;(function (root, factory) {
|
|
3332
3916
|
if (true) {
|
|
@@ -3522,13 +4106,13 @@ return /******/ (() => { // webpackBootstrap
|
|
|
3522
4106
|
|
|
3523
4107
|
}));
|
|
3524
4108
|
|
|
3525
|
-
/***/ }
|
|
4109
|
+
/***/ },
|
|
3526
4110
|
|
|
3527
|
-
/***/ "./node_modules/crypto-js/tripledes.js"
|
|
4111
|
+
/***/ "./node_modules/crypto-js/tripledes.js"
|
|
3528
4112
|
/*!*********************************************!*\
|
|
3529
4113
|
!*** ./node_modules/crypto-js/tripledes.js ***!
|
|
3530
4114
|
\*********************************************/
|
|
3531
|
-
|
|
4115
|
+
(module, exports, __webpack_require__) {
|
|
3532
4116
|
|
|
3533
4117
|
;(function (root, factory, undef) {
|
|
3534
4118
|
if (true) {
|
|
@@ -4304,13 +4888,13 @@ return /******/ (() => { // webpackBootstrap
|
|
|
4304
4888
|
|
|
4305
4889
|
}));
|
|
4306
4890
|
|
|
4307
|
-
/***/ }
|
|
4891
|
+
/***/ },
|
|
4308
4892
|
|
|
4309
|
-
/***/ "./node_modules/lz-string/libs/lz-string.js"
|
|
4893
|
+
/***/ "./node_modules/lz-string/libs/lz-string.js"
|
|
4310
4894
|
/*!**************************************************!*\
|
|
4311
4895
|
!*** ./node_modules/lz-string/libs/lz-string.js ***!
|
|
4312
4896
|
\**************************************************/
|
|
4313
|
-
|
|
4897
|
+
(module, exports, __webpack_require__) {
|
|
4314
4898
|
|
|
4315
4899
|
var __WEBPACK_AMD_DEFINE_RESULT__;// Copyright (c) 2013 Pieroxy <pieroxy@pieroxy.net>
|
|
4316
4900
|
// This work is free. You can redistribute it and/or modify it
|
|
@@ -4622,794 +5206,210 @@ var LZString = {
|
|
|
4622
5206
|
} else {
|
|
4623
5207
|
context_data_position++;
|
|
4624
5208
|
}
|
|
4625
|
-
value = value >> 1;
|
|
4626
|
-
}
|
|
4627
|
-
|
|
4628
|
-
// Flush the last char
|
|
4629
|
-
while (true) {
|
|
4630
|
-
context_data_val = (context_data_val << 1);
|
|
4631
|
-
if (context_data_position == bitsPerChar-1) {
|
|
4632
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
4633
|
-
break;
|
|
4634
|
-
}
|
|
4635
|
-
else context_data_position++;
|
|
4636
|
-
}
|
|
4637
|
-
return context_data.join('');
|
|
4638
|
-
},
|
|
4639
|
-
|
|
4640
|
-
decompress: function (compressed) {
|
|
4641
|
-
if (compressed == null) return "";
|
|
4642
|
-
if (compressed == "") return null;
|
|
4643
|
-
return LZString._decompress(compressed.length, 32768, function(index) { return compressed.charCodeAt(index); });
|
|
4644
|
-
},
|
|
4645
|
-
|
|
4646
|
-
_decompress: function (length, resetValue, getNextValue) {
|
|
4647
|
-
var dictionary = [],
|
|
4648
|
-
next,
|
|
4649
|
-
enlargeIn = 4,
|
|
4650
|
-
dictSize = 4,
|
|
4651
|
-
numBits = 3,
|
|
4652
|
-
entry = "",
|
|
4653
|
-
result = [],
|
|
4654
|
-
i,
|
|
4655
|
-
w,
|
|
4656
|
-
bits, resb, maxpower, power,
|
|
4657
|
-
c,
|
|
4658
|
-
data = {val:getNextValue(0), position:resetValue, index:1};
|
|
4659
|
-
|
|
4660
|
-
for (i = 0; i < 3; i += 1) {
|
|
4661
|
-
dictionary[i] = i;
|
|
4662
|
-
}
|
|
4663
|
-
|
|
4664
|
-
bits = 0;
|
|
4665
|
-
maxpower = Math.pow(2,2);
|
|
4666
|
-
power=1;
|
|
4667
|
-
while (power!=maxpower) {
|
|
4668
|
-
resb = data.val & data.position;
|
|
4669
|
-
data.position >>= 1;
|
|
4670
|
-
if (data.position == 0) {
|
|
4671
|
-
data.position = resetValue;
|
|
4672
|
-
data.val = getNextValue(data.index++);
|
|
4673
|
-
}
|
|
4674
|
-
bits |= (resb>0 ? 1 : 0) * power;
|
|
4675
|
-
power <<= 1;
|
|
4676
|
-
}
|
|
4677
|
-
|
|
4678
|
-
switch (next = bits) {
|
|
4679
|
-
case 0:
|
|
4680
|
-
bits = 0;
|
|
4681
|
-
maxpower = Math.pow(2,8);
|
|
4682
|
-
power=1;
|
|
4683
|
-
while (power!=maxpower) {
|
|
4684
|
-
resb = data.val & data.position;
|
|
4685
|
-
data.position >>= 1;
|
|
4686
|
-
if (data.position == 0) {
|
|
4687
|
-
data.position = resetValue;
|
|
4688
|
-
data.val = getNextValue(data.index++);
|
|
4689
|
-
}
|
|
4690
|
-
bits |= (resb>0 ? 1 : 0) * power;
|
|
4691
|
-
power <<= 1;
|
|
4692
|
-
}
|
|
4693
|
-
c = f(bits);
|
|
4694
|
-
break;
|
|
4695
|
-
case 1:
|
|
4696
|
-
bits = 0;
|
|
4697
|
-
maxpower = Math.pow(2,16);
|
|
4698
|
-
power=1;
|
|
4699
|
-
while (power!=maxpower) {
|
|
4700
|
-
resb = data.val & data.position;
|
|
4701
|
-
data.position >>= 1;
|
|
4702
|
-
if (data.position == 0) {
|
|
4703
|
-
data.position = resetValue;
|
|
4704
|
-
data.val = getNextValue(data.index++);
|
|
4705
|
-
}
|
|
4706
|
-
bits |= (resb>0 ? 1 : 0) * power;
|
|
4707
|
-
power <<= 1;
|
|
4708
|
-
}
|
|
4709
|
-
c = f(bits);
|
|
4710
|
-
break;
|
|
4711
|
-
case 2:
|
|
4712
|
-
return "";
|
|
4713
|
-
}
|
|
4714
|
-
dictionary[3] = c;
|
|
4715
|
-
w = c;
|
|
4716
|
-
result.push(c);
|
|
4717
|
-
while (true) {
|
|
4718
|
-
if (data.index > length) {
|
|
4719
|
-
return "";
|
|
4720
|
-
}
|
|
4721
|
-
|
|
4722
|
-
bits = 0;
|
|
4723
|
-
maxpower = Math.pow(2,numBits);
|
|
4724
|
-
power=1;
|
|
4725
|
-
while (power!=maxpower) {
|
|
4726
|
-
resb = data.val & data.position;
|
|
4727
|
-
data.position >>= 1;
|
|
4728
|
-
if (data.position == 0) {
|
|
4729
|
-
data.position = resetValue;
|
|
4730
|
-
data.val = getNextValue(data.index++);
|
|
4731
|
-
}
|
|
4732
|
-
bits |= (resb>0 ? 1 : 0) * power;
|
|
4733
|
-
power <<= 1;
|
|
4734
|
-
}
|
|
4735
|
-
|
|
4736
|
-
switch (c = bits) {
|
|
4737
|
-
case 0:
|
|
4738
|
-
bits = 0;
|
|
4739
|
-
maxpower = Math.pow(2,8);
|
|
4740
|
-
power=1;
|
|
4741
|
-
while (power!=maxpower) {
|
|
4742
|
-
resb = data.val & data.position;
|
|
4743
|
-
data.position >>= 1;
|
|
4744
|
-
if (data.position == 0) {
|
|
4745
|
-
data.position = resetValue;
|
|
4746
|
-
data.val = getNextValue(data.index++);
|
|
4747
|
-
}
|
|
4748
|
-
bits |= (resb>0 ? 1 : 0) * power;
|
|
4749
|
-
power <<= 1;
|
|
4750
|
-
}
|
|
4751
|
-
|
|
4752
|
-
dictionary[dictSize++] = f(bits);
|
|
4753
|
-
c = dictSize-1;
|
|
4754
|
-
enlargeIn--;
|
|
4755
|
-
break;
|
|
4756
|
-
case 1:
|
|
4757
|
-
bits = 0;
|
|
4758
|
-
maxpower = Math.pow(2,16);
|
|
4759
|
-
power=1;
|
|
4760
|
-
while (power!=maxpower) {
|
|
4761
|
-
resb = data.val & data.position;
|
|
4762
|
-
data.position >>= 1;
|
|
4763
|
-
if (data.position == 0) {
|
|
4764
|
-
data.position = resetValue;
|
|
4765
|
-
data.val = getNextValue(data.index++);
|
|
4766
|
-
}
|
|
4767
|
-
bits |= (resb>0 ? 1 : 0) * power;
|
|
4768
|
-
power <<= 1;
|
|
4769
|
-
}
|
|
4770
|
-
dictionary[dictSize++] = f(bits);
|
|
4771
|
-
c = dictSize-1;
|
|
4772
|
-
enlargeIn--;
|
|
4773
|
-
break;
|
|
4774
|
-
case 2:
|
|
4775
|
-
return result.join('');
|
|
4776
|
-
}
|
|
4777
|
-
|
|
4778
|
-
if (enlargeIn == 0) {
|
|
4779
|
-
enlargeIn = Math.pow(2, numBits);
|
|
4780
|
-
numBits++;
|
|
4781
|
-
}
|
|
4782
|
-
|
|
4783
|
-
if (dictionary[c]) {
|
|
4784
|
-
entry = dictionary[c];
|
|
4785
|
-
} else {
|
|
4786
|
-
if (c === dictSize) {
|
|
4787
|
-
entry = w + w.charAt(0);
|
|
4788
|
-
} else {
|
|
4789
|
-
return null;
|
|
4790
|
-
}
|
|
4791
|
-
}
|
|
4792
|
-
result.push(entry);
|
|
4793
|
-
|
|
4794
|
-
// Add w+entry[0] to the dictionary.
|
|
4795
|
-
dictionary[dictSize++] = w + entry.charAt(0);
|
|
4796
|
-
enlargeIn--;
|
|
4797
|
-
|
|
4798
|
-
w = entry;
|
|
4799
|
-
|
|
4800
|
-
if (enlargeIn == 0) {
|
|
4801
|
-
enlargeIn = Math.pow(2, numBits);
|
|
4802
|
-
numBits++;
|
|
4803
|
-
}
|
|
4804
|
-
|
|
4805
|
-
}
|
|
4806
|
-
}
|
|
4807
|
-
};
|
|
4808
|
-
return LZString;
|
|
4809
|
-
})();
|
|
4810
|
-
|
|
4811
|
-
if (true) {
|
|
4812
|
-
!(__WEBPACK_AMD_DEFINE_RESULT__ = (function () { return LZString; }).call(exports, __webpack_require__, exports, module),
|
|
4813
|
-
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
4814
|
-
} else // removed by dead control flow
|
|
4815
|
-
{}
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
/***/ }),
|
|
4819
|
-
|
|
4820
|
-
/***/ "./src/Base64.js":
|
|
4821
|
-
/*!***********************!*\
|
|
4822
|
-
!*** ./src/Base64.js ***!
|
|
4823
|
-
\***********************/
|
|
4824
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4825
|
-
|
|
4826
|
-
"use strict";
|
|
4827
|
-
__webpack_require__.r(__webpack_exports__);
|
|
4828
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4829
|
-
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
4830
|
-
/* harmony export */ });
|
|
4831
|
-
const Base64 = {
|
|
4832
|
-
_keyStr: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
|
|
4833
|
-
encode: function (e) {
|
|
4834
|
-
let t = '';
|
|
4835
|
-
let n, r, i, s, o, u, a;
|
|
4836
|
-
let f = 0;
|
|
4837
|
-
e = Base64._utf8Encode(e);
|
|
4838
|
-
while (f < e.length) {
|
|
4839
|
-
n = e.charCodeAt(f++);
|
|
4840
|
-
r = e.charCodeAt(f++);
|
|
4841
|
-
i = e.charCodeAt(f++);
|
|
4842
|
-
s = n >> 2;
|
|
4843
|
-
o = (n & 3) << 4 | r >> 4;
|
|
4844
|
-
u = (r & 15) << 2 | i >> 6;
|
|
4845
|
-
a = i & 63;
|
|
4846
|
-
if (isNaN(r)) {
|
|
4847
|
-
u = a = 64;
|
|
4848
|
-
} else if (isNaN(i)) {
|
|
4849
|
-
a = 64;
|
|
4850
|
-
}
|
|
4851
|
-
t = t + this._keyStr.charAt(s) + this._keyStr.charAt(o) + this._keyStr.charAt(u) + this._keyStr.charAt(a);
|
|
4852
|
-
}
|
|
4853
|
-
return t;
|
|
4854
|
-
},
|
|
4855
|
-
decode: function (e) {
|
|
4856
|
-
let t = '';
|
|
4857
|
-
let n, r, i;
|
|
4858
|
-
let s, o, u, a;
|
|
4859
|
-
let f = 0;
|
|
4860
|
-
e = e.replace(/[^A-Za-z0-9+/=]/g, '');
|
|
4861
|
-
while (f < e.length) {
|
|
4862
|
-
s = this._keyStr.indexOf(e.charAt(f++));
|
|
4863
|
-
o = this._keyStr.indexOf(e.charAt(f++));
|
|
4864
|
-
u = this._keyStr.indexOf(e.charAt(f++));
|
|
4865
|
-
a = this._keyStr.indexOf(e.charAt(f++));
|
|
4866
|
-
n = s << 2 | o >> 4;
|
|
4867
|
-
r = (o & 15) << 4 | u >> 2;
|
|
4868
|
-
i = (u & 3) << 6 | a;
|
|
4869
|
-
t = t + String.fromCharCode(n);
|
|
4870
|
-
if (u !== 64) {
|
|
4871
|
-
t = t + String.fromCharCode(r);
|
|
4872
|
-
}
|
|
4873
|
-
if (a !== 64) {
|
|
4874
|
-
t = t + String.fromCharCode(i);
|
|
4875
|
-
}
|
|
4876
|
-
}
|
|
4877
|
-
t = Base64._utf8Decode(t);
|
|
4878
|
-
return t;
|
|
4879
|
-
},
|
|
4880
|
-
_utf8Encode: function (e) {
|
|
4881
|
-
e = e.replace(/\r\n/g, '\n');
|
|
4882
|
-
let t = '';
|
|
4883
|
-
for (let n = 0; n < e.length; n++) {
|
|
4884
|
-
let r = e.charCodeAt(n);
|
|
4885
|
-
if (r < 128) {
|
|
4886
|
-
t += String.fromCharCode(r);
|
|
4887
|
-
} else if (r > 127 && r < 2048) {
|
|
4888
|
-
t += String.fromCharCode(r >> 6 | 192);
|
|
4889
|
-
t += String.fromCharCode(r & 63 | 128);
|
|
4890
|
-
} else {
|
|
4891
|
-
t += String.fromCharCode(r >> 12 | 224);
|
|
4892
|
-
t += String.fromCharCode(r >> 6 & 63 | 128);
|
|
4893
|
-
t += String.fromCharCode(r & 63 | 128);
|
|
4894
|
-
}
|
|
4895
|
-
}
|
|
4896
|
-
return t;
|
|
4897
|
-
},
|
|
4898
|
-
_utf8Decode: function (e) {
|
|
4899
|
-
let t = '';
|
|
4900
|
-
let n = 0;
|
|
4901
|
-
let r, c2, c3;
|
|
4902
|
-
r = c2 = 0;
|
|
4903
|
-
while (n < e.length) {
|
|
4904
|
-
r = e.charCodeAt(n);
|
|
4905
|
-
if (r < 128) {
|
|
4906
|
-
t += String.fromCharCode(r);
|
|
4907
|
-
n++;
|
|
4908
|
-
} else if (r > 191 && r < 224) {
|
|
4909
|
-
c2 = e.charCodeAt(n + 1);
|
|
4910
|
-
t += String.fromCharCode((r & 31) << 6 | c2 & 63);
|
|
4911
|
-
n += 2;
|
|
4912
|
-
} else {
|
|
4913
|
-
c2 = e.charCodeAt(n + 1);
|
|
4914
|
-
c3 = e.charCodeAt(n + 2);
|
|
4915
|
-
t += String.fromCharCode((r & 15) << 12 | (c2 & 63) << 6 | c3 & 63);
|
|
4916
|
-
n += 3;
|
|
4917
|
-
}
|
|
4918
|
-
}
|
|
4919
|
-
return t;
|
|
4920
|
-
}
|
|
4921
|
-
};
|
|
4922
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Base64);
|
|
4923
|
-
|
|
4924
|
-
/***/ }),
|
|
4925
|
-
|
|
4926
|
-
/***/ "./src/SecureLS.js":
|
|
4927
|
-
/*!*************************!*\
|
|
4928
|
-
!*** ./src/SecureLS.js ***!
|
|
4929
|
-
\*************************/
|
|
4930
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4931
|
-
|
|
4932
|
-
"use strict";
|
|
4933
|
-
__webpack_require__.r(__webpack_exports__);
|
|
4934
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4935
|
-
/* harmony export */ SecureLS: () => (/* binding */ SecureLS)
|
|
4936
|
-
/* harmony export */ });
|
|
4937
|
-
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants */ "./src/constants.js");
|
|
4938
|
-
/* harmony import */ var _enc_utf8__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./enc-utf8 */ "./src/enc-utf8.js");
|
|
4939
|
-
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ "./src/utils.js");
|
|
4940
|
-
/* harmony import */ var crypto_js_aes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! crypto-js/aes */ "./node_modules/crypto-js/aes.js");
|
|
4941
|
-
/* harmony import */ var crypto_js_aes__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(crypto_js_aes__WEBPACK_IMPORTED_MODULE_3__);
|
|
4942
|
-
/* harmony import */ var crypto_js_rabbit__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! crypto-js/rabbit */ "./node_modules/crypto-js/rabbit.js");
|
|
4943
|
-
/* harmony import */ var crypto_js_rabbit__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(crypto_js_rabbit__WEBPACK_IMPORTED_MODULE_4__);
|
|
4944
|
-
/* harmony import */ var crypto_js_rc4__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! crypto-js/rc4 */ "./node_modules/crypto-js/rc4.js");
|
|
4945
|
-
/* harmony import */ var crypto_js_rc4__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(crypto_js_rc4__WEBPACK_IMPORTED_MODULE_5__);
|
|
4946
|
-
/* harmony import */ var crypto_js_tripledes__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! crypto-js/tripledes */ "./node_modules/crypto-js/tripledes.js");
|
|
4947
|
-
/* harmony import */ var crypto_js_tripledes__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(crypto_js_tripledes__WEBPACK_IMPORTED_MODULE_6__);
|
|
4948
|
-
/* harmony import */ var lz_string_libs_lz_string__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! lz-string/libs/lz-string */ "./node_modules/lz-string/libs/lz-string.js");
|
|
4949
|
-
/* harmony import */ var lz_string_libs_lz_string__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(lz_string_libs_lz_string__WEBPACK_IMPORTED_MODULE_7__);
|
|
4950
|
-
/* harmony import */ var _Base64__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Base64 */ "./src/Base64.js");
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
const encryptors = {
|
|
4961
|
-
[_constants__WEBPACK_IMPORTED_MODULE_0__["default"].EncrytionTypes.AES]: (crypto_js_aes__WEBPACK_IMPORTED_MODULE_3___default()),
|
|
4962
|
-
[_constants__WEBPACK_IMPORTED_MODULE_0__["default"].EncrytionTypes.DES]: (crypto_js_tripledes__WEBPACK_IMPORTED_MODULE_6___default()),
|
|
4963
|
-
[_constants__WEBPACK_IMPORTED_MODULE_0__["default"].EncrytionTypes.RABBIT]: (crypto_js_rabbit__WEBPACK_IMPORTED_MODULE_4___default()),
|
|
4964
|
-
[_constants__WEBPACK_IMPORTED_MODULE_0__["default"].EncrytionTypes.RC4]: (crypto_js_rc4__WEBPACK_IMPORTED_MODULE_5___default())
|
|
4965
|
-
};
|
|
4966
|
-
class SecureLS {
|
|
4967
|
-
constructor({
|
|
4968
|
-
encryptionSecret = '',
|
|
4969
|
-
encryptionNamespace = '',
|
|
4970
|
-
isCompression = true,
|
|
4971
|
-
encodingType = _constants__WEBPACK_IMPORTED_MODULE_0__["default"].EncrytionTypes.BASE64,
|
|
4972
|
-
storage = localStorage,
|
|
4973
|
-
metaKey = _constants__WEBPACK_IMPORTED_MODULE_0__["default"].metaKey
|
|
4974
|
-
} = {}) {
|
|
4975
|
-
// Assign libraries and utilities
|
|
4976
|
-
Object.assign(this, {
|
|
4977
|
-
_name: 'secure-ls',
|
|
4978
|
-
Base64: _Base64__WEBPACK_IMPORTED_MODULE_8__["default"],
|
|
4979
|
-
LZString: {
|
|
4980
|
-
compressToUTF16: lz_string_libs_lz_string__WEBPACK_IMPORTED_MODULE_7__.compressToUTF16,
|
|
4981
|
-
decompressFromUTF16: lz_string_libs_lz_string__WEBPACK_IMPORTED_MODULE_7__.decompressFromUTF16
|
|
4982
|
-
},
|
|
4983
|
-
AES: (crypto_js_aes__WEBPACK_IMPORTED_MODULE_3___default()),
|
|
4984
|
-
DES: (crypto_js_tripledes__WEBPACK_IMPORTED_MODULE_6___default()),
|
|
4985
|
-
RABBIT: (crypto_js_rabbit__WEBPACK_IMPORTED_MODULE_4___default()),
|
|
4986
|
-
RC4: (crypto_js_rc4__WEBPACK_IMPORTED_MODULE_5___default()),
|
|
4987
|
-
enc: _enc_utf8__WEBPACK_IMPORTED_MODULE_1__["default"]
|
|
4988
|
-
});
|
|
4989
|
-
|
|
4990
|
-
// Configuration and property assignment
|
|
4991
|
-
this.config = {
|
|
4992
|
-
encryptionSecret,
|
|
4993
|
-
encryptionNamespace,
|
|
4994
|
-
isCompression,
|
|
4995
|
-
encodingType: encodingType.toLowerCase(),
|
|
4996
|
-
storage,
|
|
4997
|
-
metaKey
|
|
4998
|
-
};
|
|
4999
|
-
this.encryptionSecret = encryptionSecret;
|
|
5000
|
-
this.storage = storage;
|
|
5001
|
-
this.metaKey = metaKey;
|
|
5002
|
-
|
|
5003
|
-
// Initialize the class
|
|
5004
|
-
this.init();
|
|
5005
|
-
}
|
|
5006
|
-
init() {
|
|
5007
|
-
let metaData = this.getMetaData();
|
|
5008
|
-
this._isBase64 = this._isBase64EncryptionType();
|
|
5009
|
-
this._isAES = this._isAESEncryptionType();
|
|
5010
|
-
this._isDES = this._isDESEncryptionType();
|
|
5011
|
-
this._isRabbit = this._isRabbitEncryptionType();
|
|
5012
|
-
this._isRC4 = this._isRC4EncryptionType();
|
|
5013
|
-
this._isCompression = this._isDataCompressionEnabled();
|
|
5014
|
-
|
|
5015
|
-
// fill the already present keys to the list of keys being used by secure-ls
|
|
5016
|
-
this.allKeys = metaData.keys || this.resetAllKeys();
|
|
5017
|
-
}
|
|
5018
|
-
_isBase64EncryptionType() {
|
|
5019
|
-
return _Base64__WEBPACK_IMPORTED_MODULE_8__["default"] && (typeof this.config.encodingType === 'undefined' || this.config.encodingType === _constants__WEBPACK_IMPORTED_MODULE_0__["default"].EncrytionTypes.BASE64);
|
|
5020
|
-
}
|
|
5021
|
-
_isAESEncryptionType() {
|
|
5022
|
-
return (crypto_js_aes__WEBPACK_IMPORTED_MODULE_3___default()) && this.config.encodingType === _constants__WEBPACK_IMPORTED_MODULE_0__["default"].EncrytionTypes.AES;
|
|
5023
|
-
}
|
|
5024
|
-
_isDESEncryptionType() {
|
|
5025
|
-
return (crypto_js_tripledes__WEBPACK_IMPORTED_MODULE_6___default()) && this.config.encodingType === _constants__WEBPACK_IMPORTED_MODULE_0__["default"].EncrytionTypes.DES;
|
|
5026
|
-
}
|
|
5027
|
-
_isRabbitEncryptionType() {
|
|
5028
|
-
return (crypto_js_rabbit__WEBPACK_IMPORTED_MODULE_4___default()) && this.config.encodingType === _constants__WEBPACK_IMPORTED_MODULE_0__["default"].EncrytionTypes.RABBIT;
|
|
5029
|
-
}
|
|
5030
|
-
_isRC4EncryptionType() {
|
|
5031
|
-
return (crypto_js_rc4__WEBPACK_IMPORTED_MODULE_5___default()) && this.config.encodingType === _constants__WEBPACK_IMPORTED_MODULE_0__["default"].EncrytionTypes.RC4;
|
|
5032
|
-
}
|
|
5033
|
-
_isDataCompressionEnabled() {
|
|
5034
|
-
return this.config.isCompression;
|
|
5035
|
-
}
|
|
5036
|
-
getEncryptionSecret(key) {
|
|
5037
|
-
let metaData = this.getMetaData();
|
|
5038
|
-
let obj = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].getObjectFromKey(metaData.keys, key);
|
|
5039
|
-
if (!obj) {
|
|
5040
|
-
return;
|
|
5041
|
-
}
|
|
5042
|
-
if (this._isAES || this._isDES || this._isRabbit || this._isRC4) {
|
|
5043
|
-
if (typeof this.config.encryptionSecret === 'undefined') {
|
|
5044
|
-
this.encryptionSecret = obj.s;
|
|
5045
|
-
if (!this.encryptionSecret) {
|
|
5046
|
-
this.encryptionSecret = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].generateSecretKey();
|
|
5047
|
-
this.setMetaData();
|
|
5048
|
-
}
|
|
5049
|
-
} else {
|
|
5050
|
-
this.encryptionSecret = this.config.encryptionSecret || obj.s || '';
|
|
5051
|
-
}
|
|
5052
|
-
}
|
|
5053
|
-
}
|
|
5054
|
-
getEncryptionType() {
|
|
5055
|
-
const encodingType = this.config.encodingType;
|
|
5056
|
-
return encodingType ? encodingType.toLowerCase() : _constants__WEBPACK_IMPORTED_MODULE_0__["default"].EncrytionTypes.BASE64;
|
|
5057
|
-
}
|
|
5058
|
-
getDataFromLocalStorage(key) {
|
|
5059
|
-
return this.storage.getItem(key, true);
|
|
5060
|
-
}
|
|
5061
|
-
setDataToLocalStorage(key, data) {
|
|
5062
|
-
this.storage.setItem(key, data);
|
|
5063
|
-
}
|
|
5064
|
-
setMetaData() {
|
|
5065
|
-
let dataToStore = this.processData({
|
|
5066
|
-
keys: this.allKeys
|
|
5067
|
-
}, true);
|
|
5068
|
-
|
|
5069
|
-
// Store the data to localStorage
|
|
5070
|
-
this.setDataToLocalStorage(this.getMetaKey(), dataToStore);
|
|
5071
|
-
}
|
|
5072
|
-
getMetaData() {
|
|
5073
|
-
return this.get(this.getMetaKey(), true) || {};
|
|
5074
|
-
}
|
|
5075
|
-
getMetaKey() {
|
|
5076
|
-
return this.metaKey + (this.config.encryptionNamespace ? '__' + this.config.encryptionNamespace : '');
|
|
5077
|
-
}
|
|
5078
|
-
resetAllKeys() {
|
|
5079
|
-
this.allKeys = [];
|
|
5080
|
-
return [];
|
|
5081
|
-
}
|
|
5082
|
-
processData(data, isAllKeysData) {
|
|
5083
|
-
if (data === null || data === undefined || data === '') {
|
|
5084
|
-
return '';
|
|
5085
|
-
}
|
|
5086
|
-
let jsonData;
|
|
5087
|
-
try {
|
|
5088
|
-
jsonData = JSON.stringify(data);
|
|
5089
|
-
} catch (err) {
|
|
5090
|
-
throw new Error('Could not stringify data', err);
|
|
5091
|
-
}
|
|
5092
|
-
|
|
5093
|
-
// Encode Based on encoding type
|
|
5094
|
-
// If not set, default to Base64 for securing data
|
|
5095
|
-
let encodedData = jsonData;
|
|
5096
|
-
if (this._isBase64 || isAllKeysData) {
|
|
5097
|
-
encodedData = _Base64__WEBPACK_IMPORTED_MODULE_8__["default"].encode(jsonData);
|
|
5098
|
-
} else {
|
|
5099
|
-
const encryptor = encryptors[this.getEncryptionType()];
|
|
5100
|
-
if (encryptor) {
|
|
5101
|
-
encodedData = encryptor.encrypt(jsonData, this.encryptionSecret);
|
|
5102
|
-
}
|
|
5103
|
-
encodedData = encodedData && encodedData.toString();
|
|
5104
|
-
}
|
|
5105
|
-
|
|
5106
|
-
// Compress data if set to true
|
|
5107
|
-
let compressedData = encodedData;
|
|
5108
|
-
if (this._isCompression || isAllKeysData) {
|
|
5109
|
-
compressedData = this.LZString.compressToUTF16(encodedData);
|
|
5110
|
-
}
|
|
5111
|
-
return compressedData;
|
|
5112
|
-
}
|
|
5113
|
-
|
|
5114
|
-
// PUBLIC APIs
|
|
5115
|
-
getAllKeys() {
|
|
5116
|
-
let data = this.getMetaData();
|
|
5117
|
-
return _utils__WEBPACK_IMPORTED_MODULE_2__["default"].extractKeyNames(data) || [];
|
|
5118
|
-
}
|
|
5119
|
-
get(key, isAllKeysData) {
|
|
5120
|
-
let decodedData = '';
|
|
5121
|
-
let jsonData = '';
|
|
5122
|
-
if (!_utils__WEBPACK_IMPORTED_MODULE_2__["default"].is(key)) {
|
|
5123
|
-
_utils__WEBPACK_IMPORTED_MODULE_2__["default"].warn(_constants__WEBPACK_IMPORTED_MODULE_0__["default"].WarningEnum.KEY_NOT_PROVIDED);
|
|
5124
|
-
return jsonData;
|
|
5125
|
-
}
|
|
5126
|
-
let data = this.getDataFromLocalStorage(key);
|
|
5127
|
-
if (!data) {
|
|
5128
|
-
return jsonData;
|
|
5129
|
-
}
|
|
5130
|
-
let deCompressedData = data; // saves else
|
|
5131
|
-
if (this._isCompression || isAllKeysData) {
|
|
5132
|
-
// meta data always compressed
|
|
5133
|
-
deCompressedData = this.LZString.decompressFromUTF16(data);
|
|
5134
|
-
}
|
|
5135
|
-
decodedData = deCompressedData; // saves else
|
|
5136
|
-
if (this._isBase64 || isAllKeysData) {
|
|
5137
|
-
// meta data always Base64
|
|
5138
|
-
decodedData = _Base64__WEBPACK_IMPORTED_MODULE_8__["default"].decode(deCompressedData);
|
|
5139
|
-
} else {
|
|
5140
|
-
this.getEncryptionSecret(key);
|
|
5141
|
-
const encryptor = encryptors[this.getEncryptionType()];
|
|
5142
|
-
if (encryptor) {
|
|
5143
|
-
const bytes = encryptor.decrypt(deCompressedData.toString(), this.encryptionSecret);
|
|
5144
|
-
if (bytes) {
|
|
5145
|
-
decodedData = bytes.toString(_enc_utf8__WEBPACK_IMPORTED_MODULE_1__["default"]._Utf8);
|
|
5146
|
-
}
|
|
5147
|
-
}
|
|
5148
|
-
}
|
|
5149
|
-
try {
|
|
5150
|
-
jsonData = JSON.parse(decodedData);
|
|
5151
|
-
} catch (err) {
|
|
5152
|
-
throw new Error('Could not parse JSON', err);
|
|
5153
|
-
}
|
|
5154
|
-
return jsonData;
|
|
5155
|
-
}
|
|
5156
|
-
set(key, data) {
|
|
5157
|
-
let dataToStore = '';
|
|
5158
|
-
if (!_utils__WEBPACK_IMPORTED_MODULE_2__["default"].is(key)) {
|
|
5159
|
-
_utils__WEBPACK_IMPORTED_MODULE_2__["default"].warn(_constants__WEBPACK_IMPORTED_MODULE_0__["default"].WarningEnum.KEY_NOT_PROVIDED);
|
|
5160
|
-
return;
|
|
5161
|
-
}
|
|
5162
|
-
this.getEncryptionSecret(key);
|
|
5163
|
-
|
|
5164
|
-
// add key(s) to Array if not already added, only for keys other than meta key
|
|
5165
|
-
if (!(String(key) === String(this.metaKey))) {
|
|
5166
|
-
if (!_utils__WEBPACK_IMPORTED_MODULE_2__["default"].isKeyPresent(this.allKeys, key)) {
|
|
5167
|
-
this.allKeys.push({
|
|
5168
|
-
k: key,
|
|
5169
|
-
s: this.encryptionSecret
|
|
5170
|
-
});
|
|
5171
|
-
this.setMetaData();
|
|
5172
|
-
}
|
|
5173
|
-
}
|
|
5174
|
-
dataToStore = this.processData(data);
|
|
5175
|
-
// Store the data to localStorage
|
|
5176
|
-
this.setDataToLocalStorage(key, dataToStore);
|
|
5177
|
-
}
|
|
5178
|
-
remove(key) {
|
|
5179
|
-
if (!_utils__WEBPACK_IMPORTED_MODULE_2__["default"].is(key)) {
|
|
5180
|
-
_utils__WEBPACK_IMPORTED_MODULE_2__["default"].warn(_constants__WEBPACK_IMPORTED_MODULE_0__["default"].WarningEnum.KEY_NOT_PROVIDED);
|
|
5181
|
-
return;
|
|
5182
|
-
}
|
|
5183
|
-
if (key === this.metaKey && this.getAllKeys().length) {
|
|
5184
|
-
_utils__WEBPACK_IMPORTED_MODULE_2__["default"].warn(_constants__WEBPACK_IMPORTED_MODULE_0__["default"].WarningEnum.META_KEY_REMOVE);
|
|
5185
|
-
return;
|
|
5186
|
-
}
|
|
5187
|
-
if (_utils__WEBPACK_IMPORTED_MODULE_2__["default"].isKeyPresent(this.allKeys, key)) {
|
|
5188
|
-
_utils__WEBPACK_IMPORTED_MODULE_2__["default"].removeFromKeysList(this.allKeys, key);
|
|
5189
|
-
this.setMetaData();
|
|
5190
|
-
}
|
|
5191
|
-
this.storage.removeItem(key);
|
|
5192
|
-
}
|
|
5193
|
-
removeAll() {
|
|
5194
|
-
let keys = this.getAllKeys();
|
|
5195
|
-
for (let i = 0; i < keys.length; i++) {
|
|
5196
|
-
this.storage.removeItem(keys[i]);
|
|
5197
|
-
}
|
|
5198
|
-
this.storage.removeItem(this.metaKey);
|
|
5199
|
-
this.resetAllKeys();
|
|
5200
|
-
}
|
|
5201
|
-
clear() {
|
|
5202
|
-
this.storage.clear();
|
|
5203
|
-
this.resetAllKeys();
|
|
5204
|
-
}
|
|
5205
|
-
}
|
|
5206
|
-
|
|
5207
|
-
/***/ }),
|
|
5208
|
-
|
|
5209
|
-
/***/ "./src/WordArray.js":
|
|
5210
|
-
/*!**************************!*\
|
|
5211
|
-
!*** ./src/WordArray.js ***!
|
|
5212
|
-
\**************************/
|
|
5213
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
5214
|
-
|
|
5215
|
-
"use strict";
|
|
5216
|
-
__webpack_require__.r(__webpack_exports__);
|
|
5217
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5218
|
-
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
5219
|
-
/* harmony export */ });
|
|
5220
|
-
/*
|
|
5221
|
-
ES6 compatible port of CryptoJS - WordArray for PBKDF2 password key generation
|
|
5222
|
-
|
|
5223
|
-
Source: https://github.com/brix/crypto-js
|
|
5224
|
-
LICENSE: MIT
|
|
5225
|
-
*/
|
|
5226
|
-
|
|
5227
|
-
let CryptoJSWordArray = {
|
|
5228
|
-
random: function (nBytes) {
|
|
5229
|
-
let words = [];
|
|
5230
|
-
let r = function (mw) {
|
|
5231
|
-
let mz = 0x3ade68b1;
|
|
5232
|
-
let mask = 0xffffffff;
|
|
5233
|
-
return function () {
|
|
5234
|
-
mz = 0x9069 * (mz & 0xffff) + (mz >> 0x10) & mask;
|
|
5235
|
-
mw = 0x4650 * (mw & 0xffff) + (mw >> 0x10) & mask;
|
|
5236
|
-
let result = (mz << 0x10) + mw & mask;
|
|
5237
|
-
result /= 0x100000000;
|
|
5238
|
-
result += 0.5;
|
|
5239
|
-
return result * (Math.random() > 0.5 ? 1 : -1);
|
|
5240
|
-
};
|
|
5241
|
-
};
|
|
5242
|
-
for (let i = 0, rcache; i < nBytes; i += 4) {
|
|
5243
|
-
let _r = r((rcache || Math.random()) * 0x100000000);
|
|
5244
|
-
rcache = _r() * 0x3ade67b7;
|
|
5245
|
-
words.push(_r() * 0x100000000 | 0);
|
|
5246
|
-
}
|
|
5247
|
-
return new CryptoJSWordArray.Set(words, nBytes);
|
|
5248
|
-
},
|
|
5249
|
-
Set: function (words, sigBytes) {
|
|
5250
|
-
words = this.words = words || [];
|
|
5251
|
-
if (sigBytes !== undefined) {
|
|
5252
|
-
this.sigBytes = sigBytes;
|
|
5253
|
-
} else {
|
|
5254
|
-
this.sigBytes = words.length * 8;
|
|
5255
|
-
}
|
|
5256
|
-
}
|
|
5257
|
-
};
|
|
5258
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CryptoJSWordArray);
|
|
5259
|
-
|
|
5260
|
-
/***/ }),
|
|
5261
|
-
|
|
5262
|
-
/***/ "./src/constants.js":
|
|
5263
|
-
/*!**************************!*\
|
|
5264
|
-
!*** ./src/constants.js ***!
|
|
5265
|
-
\**************************/
|
|
5266
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
5267
|
-
|
|
5268
|
-
"use strict";
|
|
5269
|
-
__webpack_require__.r(__webpack_exports__);
|
|
5270
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5271
|
-
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
5272
|
-
/* harmony export */ });
|
|
5273
|
-
const WarningEnum = {
|
|
5274
|
-
KEY_NOT_PROVIDED: 'keyNotProvided',
|
|
5275
|
-
META_KEY_REMOVE: 'metaKeyRemove',
|
|
5276
|
-
DEFAULT_TEXT: 'defaultText'
|
|
5277
|
-
};
|
|
5278
|
-
const WarningTypes = {};
|
|
5279
|
-
WarningTypes[WarningEnum.KEY_NOT_PROVIDED] = 'Secure LS: Key not provided. Aborting operation!';
|
|
5280
|
-
WarningTypes[WarningEnum.META_KEY_REMOVE] = `Secure LS: Meta key can not be removed
|
|
5281
|
-
unless all keys created by Secure LS are removed!`;
|
|
5282
|
-
WarningTypes[WarningEnum.DEFAULT_TEXT] = `Unexpected output`;
|
|
5283
|
-
const constants = {
|
|
5284
|
-
WarningEnum: WarningEnum,
|
|
5285
|
-
WarningTypes: WarningTypes,
|
|
5286
|
-
EncrytionTypes: {
|
|
5287
|
-
BASE64: 'base64',
|
|
5288
|
-
AES: 'aes',
|
|
5289
|
-
DES: 'des',
|
|
5290
|
-
RABBIT: 'rabbit',
|
|
5291
|
-
RC4: 'rc4'
|
|
5292
|
-
},
|
|
5293
|
-
metaKey: '_secure__ls__metadata',
|
|
5294
|
-
secretPhrase: 's3cr3t$#@135^&*246'
|
|
5295
|
-
};
|
|
5296
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (constants);
|
|
5297
|
-
|
|
5298
|
-
/***/ }),
|
|
5209
|
+
value = value >> 1;
|
|
5210
|
+
}
|
|
5299
5211
|
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5212
|
+
// Flush the last char
|
|
5213
|
+
while (true) {
|
|
5214
|
+
context_data_val = (context_data_val << 1);
|
|
5215
|
+
if (context_data_position == bitsPerChar-1) {
|
|
5216
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
5217
|
+
break;
|
|
5218
|
+
}
|
|
5219
|
+
else context_data_position++;
|
|
5220
|
+
}
|
|
5221
|
+
return context_data.join('');
|
|
5222
|
+
},
|
|
5305
5223
|
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
/*
|
|
5312
|
-
ES6 compatible port of CryptoJS - encoding
|
|
5224
|
+
decompress: function (compressed) {
|
|
5225
|
+
if (compressed == null) return "";
|
|
5226
|
+
if (compressed == "") return null;
|
|
5227
|
+
return LZString._decompress(compressed.length, 32768, function(index) { return compressed.charCodeAt(index); });
|
|
5228
|
+
},
|
|
5313
5229
|
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
let sigBytes = wordArray.sigBytes;
|
|
5323
|
-
let latin1Chars = [],
|
|
5230
|
+
_decompress: function (length, resetValue, getNextValue) {
|
|
5231
|
+
var dictionary = [],
|
|
5232
|
+
next,
|
|
5233
|
+
enlargeIn = 4,
|
|
5234
|
+
dictSize = 4,
|
|
5235
|
+
numBits = 3,
|
|
5236
|
+
entry = "",
|
|
5237
|
+
result = [],
|
|
5324
5238
|
i,
|
|
5325
|
-
|
|
5239
|
+
w,
|
|
5240
|
+
bits, resb, maxpower, power,
|
|
5241
|
+
c,
|
|
5242
|
+
data = {val:getNextValue(0), position:resetValue, index:1};
|
|
5326
5243
|
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
|
|
5330
|
-
latin1Chars.push(String.fromCharCode(bite));
|
|
5331
|
-
}
|
|
5332
|
-
return latin1Chars.join('');
|
|
5244
|
+
for (i = 0; i < 3; i += 1) {
|
|
5245
|
+
dictionary[i] = i;
|
|
5333
5246
|
}
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5247
|
+
|
|
5248
|
+
bits = 0;
|
|
5249
|
+
maxpower = Math.pow(2,2);
|
|
5250
|
+
power=1;
|
|
5251
|
+
while (power!=maxpower) {
|
|
5252
|
+
resb = data.val & data.position;
|
|
5253
|
+
data.position >>= 1;
|
|
5254
|
+
if (data.position == 0) {
|
|
5255
|
+
data.position = resetValue;
|
|
5256
|
+
data.val = getNextValue(data.index++);
|
|
5341
5257
|
}
|
|
5258
|
+
bits |= (resb>0 ? 1 : 0) * power;
|
|
5259
|
+
power <<= 1;
|
|
5342
5260
|
}
|
|
5343
|
-
}
|
|
5344
|
-
};
|
|
5345
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (enc);
|
|
5346
5261
|
|
|
5347
|
-
|
|
5262
|
+
switch (next = bits) {
|
|
5263
|
+
case 0:
|
|
5264
|
+
bits = 0;
|
|
5265
|
+
maxpower = Math.pow(2,8);
|
|
5266
|
+
power=1;
|
|
5267
|
+
while (power!=maxpower) {
|
|
5268
|
+
resb = data.val & data.position;
|
|
5269
|
+
data.position >>= 1;
|
|
5270
|
+
if (data.position == 0) {
|
|
5271
|
+
data.position = resetValue;
|
|
5272
|
+
data.val = getNextValue(data.index++);
|
|
5273
|
+
}
|
|
5274
|
+
bits |= (resb>0 ? 1 : 0) * power;
|
|
5275
|
+
power <<= 1;
|
|
5276
|
+
}
|
|
5277
|
+
c = f(bits);
|
|
5278
|
+
break;
|
|
5279
|
+
case 1:
|
|
5280
|
+
bits = 0;
|
|
5281
|
+
maxpower = Math.pow(2,16);
|
|
5282
|
+
power=1;
|
|
5283
|
+
while (power!=maxpower) {
|
|
5284
|
+
resb = data.val & data.position;
|
|
5285
|
+
data.position >>= 1;
|
|
5286
|
+
if (data.position == 0) {
|
|
5287
|
+
data.position = resetValue;
|
|
5288
|
+
data.val = getNextValue(data.index++);
|
|
5289
|
+
}
|
|
5290
|
+
bits |= (resb>0 ? 1 : 0) * power;
|
|
5291
|
+
power <<= 1;
|
|
5292
|
+
}
|
|
5293
|
+
c = f(bits);
|
|
5294
|
+
break;
|
|
5295
|
+
case 2:
|
|
5296
|
+
return "";
|
|
5297
|
+
}
|
|
5298
|
+
dictionary[3] = c;
|
|
5299
|
+
w = c;
|
|
5300
|
+
result.push(c);
|
|
5301
|
+
while (true) {
|
|
5302
|
+
if (data.index > length) {
|
|
5303
|
+
return "";
|
|
5304
|
+
}
|
|
5348
5305
|
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5306
|
+
bits = 0;
|
|
5307
|
+
maxpower = Math.pow(2,numBits);
|
|
5308
|
+
power=1;
|
|
5309
|
+
while (power!=maxpower) {
|
|
5310
|
+
resb = data.val & data.position;
|
|
5311
|
+
data.position >>= 1;
|
|
5312
|
+
if (data.position == 0) {
|
|
5313
|
+
data.position = resetValue;
|
|
5314
|
+
data.val = getNextValue(data.index++);
|
|
5315
|
+
}
|
|
5316
|
+
bits |= (resb>0 ? 1 : 0) * power;
|
|
5317
|
+
power <<= 1;
|
|
5318
|
+
}
|
|
5354
5319
|
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5320
|
+
switch (c = bits) {
|
|
5321
|
+
case 0:
|
|
5322
|
+
bits = 0;
|
|
5323
|
+
maxpower = Math.pow(2,8);
|
|
5324
|
+
power=1;
|
|
5325
|
+
while (power!=maxpower) {
|
|
5326
|
+
resb = data.val & data.position;
|
|
5327
|
+
data.position >>= 1;
|
|
5328
|
+
if (data.position == 0) {
|
|
5329
|
+
data.position = resetValue;
|
|
5330
|
+
data.val = getNextValue(data.index++);
|
|
5331
|
+
}
|
|
5332
|
+
bits |= (resb>0 ? 1 : 0) * power;
|
|
5333
|
+
power <<= 1;
|
|
5334
|
+
}
|
|
5335
|
+
|
|
5336
|
+
dictionary[dictSize++] = f(bits);
|
|
5337
|
+
c = dictSize-1;
|
|
5338
|
+
enlargeIn--;
|
|
5339
|
+
break;
|
|
5340
|
+
case 1:
|
|
5341
|
+
bits = 0;
|
|
5342
|
+
maxpower = Math.pow(2,16);
|
|
5343
|
+
power=1;
|
|
5344
|
+
while (power!=maxpower) {
|
|
5345
|
+
resb = data.val & data.position;
|
|
5346
|
+
data.position >>= 1;
|
|
5347
|
+
if (data.position == 0) {
|
|
5348
|
+
data.position = resetValue;
|
|
5349
|
+
data.val = getNextValue(data.index++);
|
|
5350
|
+
}
|
|
5351
|
+
bits |= (resb>0 ? 1 : 0) * power;
|
|
5352
|
+
power <<= 1;
|
|
5353
|
+
}
|
|
5354
|
+
dictionary[dictSize++] = f(bits);
|
|
5355
|
+
c = dictSize-1;
|
|
5356
|
+
enlargeIn--;
|
|
5357
|
+
break;
|
|
5358
|
+
case 2:
|
|
5359
|
+
return result.join('');
|
|
5360
|
+
}
|
|
5361
|
+
|
|
5362
|
+
if (enlargeIn == 0) {
|
|
5363
|
+
enlargeIn = Math.pow(2, numBits);
|
|
5364
|
+
numBits++;
|
|
5365
|
+
}
|
|
5364
5366
|
|
|
5367
|
+
if (dictionary[c]) {
|
|
5368
|
+
entry = dictionary[c];
|
|
5369
|
+
} else {
|
|
5370
|
+
if (c === dictSize) {
|
|
5371
|
+
entry = w + w.charAt(0);
|
|
5372
|
+
} else {
|
|
5373
|
+
return null;
|
|
5374
|
+
}
|
|
5375
|
+
}
|
|
5376
|
+
result.push(entry);
|
|
5365
5377
|
|
|
5378
|
+
// Add w+entry[0] to the dictionary.
|
|
5379
|
+
dictionary[dictSize++] = w + entry.charAt(0);
|
|
5380
|
+
enlargeIn--;
|
|
5381
|
+
|
|
5382
|
+
w = entry;
|
|
5383
|
+
|
|
5384
|
+
if (enlargeIn == 0) {
|
|
5385
|
+
enlargeIn = Math.pow(2, numBits);
|
|
5386
|
+
numBits++;
|
|
5387
|
+
}
|
|
5366
5388
|
|
|
5367
|
-
const utils = {
|
|
5368
|
-
is: key => !!key,
|
|
5369
|
-
warn: (reason = _constants__WEBPACK_IMPORTED_MODULE_1__["default"].WarningEnum.DEFAULT_TEXT) => {
|
|
5370
|
-
console.warn(_constants__WEBPACK_IMPORTED_MODULE_1__["default"].WarningTypes[reason]);
|
|
5371
|
-
},
|
|
5372
|
-
generateSecretKey: () => {
|
|
5373
|
-
const salt = _WordArray__WEBPACK_IMPORTED_MODULE_2__["default"].random(128 / 8);
|
|
5374
|
-
const key128Bits = crypto_js_pbkdf2__WEBPACK_IMPORTED_MODULE_0___default()(_constants__WEBPACK_IMPORTED_MODULE_1__["default"].secretPhrase, salt, {
|
|
5375
|
-
keySize: 128 / 32
|
|
5376
|
-
});
|
|
5377
|
-
return key128Bits.toString();
|
|
5378
|
-
},
|
|
5379
|
-
getObjectFromKey: (data = [], key) => {
|
|
5380
|
-
return data.find(item => item.k === key) || {};
|
|
5381
|
-
},
|
|
5382
|
-
extractKeyNames: ({
|
|
5383
|
-
keys = []
|
|
5384
|
-
} = {}) => {
|
|
5385
|
-
return keys.map(({
|
|
5386
|
-
k
|
|
5387
|
-
}) => k);
|
|
5388
|
-
},
|
|
5389
|
-
isKeyPresent: (allKeys = [], key) => {
|
|
5390
|
-
return allKeys.some(item => String(item.k) === String(key));
|
|
5391
|
-
},
|
|
5392
|
-
removeFromKeysList: (allKeys = [], key) => {
|
|
5393
|
-
const index = allKeys.findIndex(item => item.k === key);
|
|
5394
|
-
if (index !== -1) {
|
|
5395
|
-
allKeys.splice(index, 1);
|
|
5396
5389
|
}
|
|
5397
|
-
return index;
|
|
5398
5390
|
}
|
|
5399
5391
|
};
|
|
5400
|
-
|
|
5392
|
+
return LZString;
|
|
5393
|
+
})();
|
|
5394
|
+
|
|
5395
|
+
if (true) {
|
|
5396
|
+
!(__WEBPACK_AMD_DEFINE_RESULT__ = (function () { return LZString; }).call(exports, __webpack_require__, exports, module),
|
|
5397
|
+
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
5398
|
+
} else // removed by dead control flow
|
|
5399
|
+
{}
|
|
5401
5400
|
|
|
5402
|
-
/***/ }),
|
|
5403
5401
|
|
|
5404
|
-
/***/
|
|
5402
|
+
/***/ },
|
|
5403
|
+
|
|
5404
|
+
/***/ "?9157"
|
|
5405
5405
|
/*!************************!*\
|
|
5406
5406
|
!*** crypto (ignored) ***!
|
|
5407
5407
|
\************************/
|
|
5408
|
-
|
|
5408
|
+
() {
|
|
5409
5409
|
|
|
5410
5410
|
/* (ignored) */
|
|
5411
5411
|
|
|
5412
|
-
/***/ }
|
|
5412
|
+
/***/ }
|
|
5413
5413
|
|
|
5414
5414
|
/******/ });
|
|
5415
5415
|
/************************************************************************/
|
|
@@ -5423,6 +5423,12 @@ const utils = {
|
|
|
5423
5423
|
/******/ if (cachedModule !== undefined) {
|
|
5424
5424
|
/******/ return cachedModule.exports;
|
|
5425
5425
|
/******/ }
|
|
5426
|
+
/******/ // Check if module exists (development only)
|
|
5427
|
+
/******/ if (__webpack_modules__[moduleId] === undefined) {
|
|
5428
|
+
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
5429
|
+
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
5430
|
+
/******/ throw e;
|
|
5431
|
+
/******/ }
|
|
5426
5432
|
/******/ // Create a new module (and put it into the cache)
|
|
5427
5433
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
5428
5434
|
/******/ // no module.id needed
|