@alibarbar/common 1.0.8 → 1.0.10
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/dist/{chunk-O3O67R4I.js → algorithm.cjs} +0 -2
- package/dist/algorithm.js +130 -44
- package/dist/{chunk-LOAZSPGQ.js → array.cjs} +0 -2
- package/dist/array.js +135 -84
- package/dist/{chunk-Y364QIQH.js → color.cjs} +0 -2
- package/dist/color.js +127 -40
- package/dist/{chunk-DYBSRI7V.js → crypto.cjs} +0 -2
- package/dist/crypto.js +172 -60
- package/dist/{chunk-BHCRFURU.js → data-structure.cjs} +0 -2
- package/dist/data-structure.js +481 -32
- package/dist/{chunk-I3L42475.js → date.cjs} +0 -2
- package/dist/date.js +125 -72
- package/dist/{chunk-JK2SE3I2.js → dom.cjs} +0 -2
- package/dist/dom.js +84 -56
- package/dist/{chunk-7V5UQXIO.js → file.cjs} +0 -2
- package/dist/file.js +79 -32
- package/dist/{chunk-OX5PLOWB.js → i18n.cjs} +0 -2
- package/dist/i18n.js +78 -40
- package/dist/index.cjs +4132 -0
- package/dist/index.d.mts +3 -159
- package/dist/index.d.ts +3 -159
- package/dist/index.js +3364 -17427
- package/dist/{chunk-4RGXV4SJ.js → network.cjs} +0 -2
- package/dist/network.js +97 -28
- package/dist/{chunk-3FRYJPHG.js → number.cjs} +0 -2
- package/dist/number.js +77 -56
- package/dist/{chunk-27UDDVLZ.js → object.cjs} +0 -2
- package/dist/object.js +237 -80
- package/dist/{chunk-JQZBPAPO.js → performance.cjs} +0 -2
- package/dist/performance.js +145 -40
- package/dist/services.cjs +291 -0
- package/dist/services.d.mts +161 -0
- package/dist/services.d.ts +161 -0
- package/dist/services.js +281 -0
- package/dist/{chunk-WZDOPUJW.js → storage.cjs} +216 -17
- package/dist/storage.js +550 -31
- package/dist/{chunk-D7CS5EKF.js → string.cjs} +0 -2
- package/dist/string.js +91 -68
- package/dist/{chunk-56W6YECK.js → tracking.cjs} +0 -2
- package/dist/tracking.js +359 -52
- package/dist/{chunk-ZDMFMUDR.js → transform.cjs} +0 -2
- package/dist/transform.js +299 -32
- package/dist/{chunk-NJARVI6X.mjs → upload.cjs} +41 -14
- package/dist/upload.js +402 -20
- package/dist/{chunk-KGFTD255.js → url.cjs} +0 -2
- package/dist/url.js +91 -44
- package/dist/{chunk-TQN37HIN.js → validation.cjs} +0 -2
- package/dist/validation.js +77 -60
- package/package.json +12 -2
- package/dist/algorithm.js.map +0 -1
- package/dist/algorithm.mjs +0 -4
- package/dist/algorithm.mjs.map +0 -1
- package/dist/array.js.map +0 -1
- package/dist/array.mjs +0 -4
- package/dist/array.mjs.map +0 -1
- package/dist/chunk-27UDDVLZ.js.map +0 -1
- package/dist/chunk-2R2QWFJC.mjs +0 -138
- package/dist/chunk-2R2QWFJC.mjs.map +0 -1
- package/dist/chunk-3FRYJPHG.js.map +0 -1
- package/dist/chunk-4RGXV4SJ.js.map +0 -1
- package/dist/chunk-56W6YECK.js.map +0 -1
- package/dist/chunk-5BGSUGTI.mjs +0 -128
- package/dist/chunk-5BGSUGTI.mjs.map +0 -1
- package/dist/chunk-7E6GELHJ.mjs +0 -302
- package/dist/chunk-7E6GELHJ.mjs.map +0 -1
- package/dist/chunk-7V5UQXIO.js.map +0 -1
- package/dist/chunk-A4SWQXX7.mjs +0 -484
- package/dist/chunk-A4SWQXX7.mjs.map +0 -1
- package/dist/chunk-BHCRFURU.js.map +0 -1
- package/dist/chunk-CDSGEAOK.mjs +0 -80
- package/dist/chunk-CDSGEAOK.mjs.map +0 -1
- package/dist/chunk-D7CS5EKF.js.map +0 -1
- package/dist/chunk-DYBSRI7V.js.map +0 -1
- package/dist/chunk-FEBKPX5A.js +0 -386
- package/dist/chunk-FEBKPX5A.js.map +0 -1
- package/dist/chunk-FJ6ZGZIA.mjs +0 -39
- package/dist/chunk-FJ6ZGZIA.mjs.map +0 -1
- package/dist/chunk-HLDFI7R2.mjs +0 -175
- package/dist/chunk-HLDFI7R2.mjs.map +0 -1
- package/dist/chunk-I3L42475.js.map +0 -1
- package/dist/chunk-JBLX27WD.mjs +0 -240
- package/dist/chunk-JBLX27WD.mjs.map +0 -1
- package/dist/chunk-JHZ7M2MR.mjs +0 -133
- package/dist/chunk-JHZ7M2MR.mjs.map +0 -1
- package/dist/chunk-JK2SE3I2.js.map +0 -1
- package/dist/chunk-JQZBPAPO.js.map +0 -1
- package/dist/chunk-JXYGC2C5.mjs +0 -100
- package/dist/chunk-JXYGC2C5.mjs.map +0 -1
- package/dist/chunk-KGFTD255.js.map +0 -1
- package/dist/chunk-LBHBNPNJ.mjs +0 -148
- package/dist/chunk-LBHBNPNJ.mjs.map +0 -1
- package/dist/chunk-LF4CILQS.mjs +0 -87
- package/dist/chunk-LF4CILQS.mjs.map +0 -1
- package/dist/chunk-LOAZSPGQ.js.map +0 -1
- package/dist/chunk-NJARVI6X.mjs.map +0 -1
- package/dist/chunk-NSSDYX2U.mjs +0 -80
- package/dist/chunk-NSSDYX2U.mjs.map +0 -1
- package/dist/chunk-O3O67R4I.js.map +0 -1
- package/dist/chunk-OIXQ3E6W.mjs +0 -354
- package/dist/chunk-OIXQ3E6W.mjs.map +0 -1
- package/dist/chunk-OX5PLOWB.js.map +0 -1
- package/dist/chunk-PJ7UCTX4.mjs +0 -362
- package/dist/chunk-PJ7UCTX4.mjs.map +0 -1
- package/dist/chunk-PR4QN5HX.js +0 -44
- package/dist/chunk-PR4QN5HX.js.map +0 -1
- package/dist/chunk-QIBE7GVN.mjs +0 -81
- package/dist/chunk-QIBE7GVN.mjs.map +0 -1
- package/dist/chunk-QIOC54LQ.mjs +0 -130
- package/dist/chunk-QIOC54LQ.mjs.map +0 -1
- package/dist/chunk-TQN37HIN.js.map +0 -1
- package/dist/chunk-WZDOPUJW.js.map +0 -1
- package/dist/chunk-XJTZDXSR.mjs +0 -94
- package/dist/chunk-XJTZDXSR.mjs.map +0 -1
- package/dist/chunk-Y364QIQH.js.map +0 -1
- package/dist/chunk-YXM6Q4JS.mjs +0 -94
- package/dist/chunk-YXM6Q4JS.mjs.map +0 -1
- package/dist/chunk-ZDMFMUDR.js.map +0 -1
- package/dist/chunk-ZVJ6NQUM.mjs +0 -82
- package/dist/chunk-ZVJ6NQUM.mjs.map +0 -1
- package/dist/color.js.map +0 -1
- package/dist/color.mjs +0 -4
- package/dist/color.mjs.map +0 -1
- package/dist/crypto.js.map +0 -1
- package/dist/crypto.mjs +0 -4
- package/dist/crypto.mjs.map +0 -1
- package/dist/data-structure.js.map +0 -1
- package/dist/data-structure.mjs +0 -4
- package/dist/data-structure.mjs.map +0 -1
- package/dist/date.js.map +0 -1
- package/dist/date.mjs +0 -4
- package/dist/date.mjs.map +0 -1
- package/dist/dom.js.map +0 -1
- package/dist/dom.mjs +0 -4
- package/dist/dom.mjs.map +0 -1
- package/dist/file.js.map +0 -1
- package/dist/file.mjs +0 -4
- package/dist/file.mjs.map +0 -1
- package/dist/i18n.js.map +0 -1
- package/dist/i18n.mjs +0 -4
- package/dist/i18n.mjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -17155
- package/dist/index.mjs.map +0 -1
- package/dist/network.js.map +0 -1
- package/dist/network.mjs +0 -4
- package/dist/network.mjs.map +0 -1
- package/dist/number.js.map +0 -1
- package/dist/number.mjs +0 -4
- package/dist/number.mjs.map +0 -1
- package/dist/object.js.map +0 -1
- package/dist/object.mjs +0 -4
- package/dist/object.mjs.map +0 -1
- package/dist/performance.js.map +0 -1
- package/dist/performance.mjs +0 -4
- package/dist/performance.mjs.map +0 -1
- package/dist/storage.js.map +0 -1
- package/dist/storage.mjs +0 -5
- package/dist/storage.mjs.map +0 -1
- package/dist/string.js.map +0 -1
- package/dist/string.mjs +0 -4
- package/dist/string.mjs.map +0 -1
- package/dist/tracking.js.map +0 -1
- package/dist/tracking.mjs +0 -4
- package/dist/tracking.mjs.map +0 -1
- package/dist/transform.js.map +0 -1
- package/dist/transform.mjs +0 -4
- package/dist/transform.mjs.map +0 -1
- package/dist/upload.js.map +0 -1
- package/dist/upload.mjs +0 -5
- package/dist/upload.mjs.map +0 -1
- package/dist/url.js.map +0 -1
- package/dist/url.mjs +0 -4
- package/dist/url.mjs.map +0 -1
- package/dist/validation.js.map +0 -1
- package/dist/validation.mjs +0 -4
- package/dist/validation.mjs.map +0 -1
|
@@ -1,8 +1,209 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __esm = (fn, res) => function __init() {
|
|
6
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
7
|
+
};
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// src/helper/crypto.ts
|
|
14
|
+
var crypto_exports = {};
|
|
15
|
+
__export(crypto_exports, {
|
|
16
|
+
base64Decode: () => base64Decode,
|
|
17
|
+
base64Encode: () => base64Encode,
|
|
18
|
+
exportPrivateKey: () => exportPrivateKey,
|
|
19
|
+
exportPublicKey: () => exportPublicKey,
|
|
20
|
+
generateRSAKeyPair: () => generateRSAKeyPair,
|
|
21
|
+
generateRandomString: () => generateRandomString,
|
|
22
|
+
generateUUID: () => generateUUID,
|
|
23
|
+
hash: () => hash,
|
|
24
|
+
importPrivateKey: () => importPrivateKey,
|
|
25
|
+
importPublicKey: () => importPublicKey,
|
|
26
|
+
rsaDecrypt: () => rsaDecrypt,
|
|
27
|
+
rsaEncrypt: () => rsaEncrypt,
|
|
28
|
+
sha256: () => sha256
|
|
29
|
+
});
|
|
30
|
+
async function sha256(data) {
|
|
31
|
+
const buffer = typeof data === "string" ? new TextEncoder().encode(data) : data;
|
|
32
|
+
const hashBuffer = await crypto.subtle.digest("SHA-256", buffer);
|
|
33
|
+
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
34
|
+
return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
35
|
+
}
|
|
36
|
+
function base64Encode(data) {
|
|
37
|
+
if (typeof data === "string") {
|
|
38
|
+
return btoa(unescape(encodeURIComponent(data)));
|
|
39
|
+
}
|
|
40
|
+
const bytes = new Uint8Array(data);
|
|
41
|
+
let binary = "";
|
|
42
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
43
|
+
binary += String.fromCharCode(bytes[i]);
|
|
44
|
+
}
|
|
45
|
+
return btoa(binary);
|
|
46
|
+
}
|
|
47
|
+
function base64Decode(data) {
|
|
48
|
+
try {
|
|
49
|
+
return decodeURIComponent(escape(atob(data)));
|
|
50
|
+
} catch {
|
|
51
|
+
throw new Error("Invalid Base64 string");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function generateUUID() {
|
|
55
|
+
if (typeof crypto !== "undefined" && crypto.randomUUID) {
|
|
56
|
+
return crypto.randomUUID();
|
|
57
|
+
}
|
|
58
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
59
|
+
const r = Math.random() * 16 | 0;
|
|
60
|
+
const v = c === "x" ? r : r & 3 | 8;
|
|
61
|
+
return v.toString(16);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function generateRandomString(length, charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {
|
|
65
|
+
let result = "";
|
|
66
|
+
for (let i = 0; i < length; i++) {
|
|
67
|
+
result += charset.charAt(Math.floor(Math.random() * charset.length));
|
|
68
|
+
}
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
function hash(data) {
|
|
72
|
+
let hashValue = 0;
|
|
73
|
+
for (let i = 0; i < data.length; i++) {
|
|
74
|
+
const char = data.charCodeAt(i);
|
|
75
|
+
hashValue = (hashValue << 5) - hashValue + char;
|
|
76
|
+
hashValue = hashValue & hashValue;
|
|
77
|
+
}
|
|
78
|
+
return Math.abs(hashValue);
|
|
79
|
+
}
|
|
80
|
+
async function generateRSAKeyPair(modulusLength = 2048) {
|
|
81
|
+
if (typeof crypto === "undefined" || !crypto.subtle) {
|
|
82
|
+
throw new Error("Web Crypto API is not available");
|
|
83
|
+
}
|
|
84
|
+
const keyPair = await crypto.subtle.generateKey(
|
|
85
|
+
{
|
|
86
|
+
name: "RSA-OAEP",
|
|
87
|
+
modulusLength,
|
|
88
|
+
publicExponent: new Uint8Array([1, 0, 1]),
|
|
89
|
+
hash: "SHA-256"
|
|
90
|
+
},
|
|
91
|
+
true,
|
|
92
|
+
["encrypt", "decrypt"]
|
|
93
|
+
);
|
|
94
|
+
return {
|
|
95
|
+
publicKey: keyPair.publicKey,
|
|
96
|
+
privateKey: keyPair.privateKey
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
async function rsaEncrypt(data, publicKey) {
|
|
100
|
+
if (typeof crypto === "undefined" || !crypto.subtle) {
|
|
101
|
+
throw new Error("Web Crypto API is not available");
|
|
102
|
+
}
|
|
103
|
+
const encoder = new TextEncoder();
|
|
104
|
+
const dataBuffer = encoder.encode(data);
|
|
105
|
+
const maxChunkSize = 245;
|
|
106
|
+
const chunks = [];
|
|
107
|
+
for (let i = 0; i < dataBuffer.length; i += maxChunkSize) {
|
|
108
|
+
const chunk = dataBuffer.slice(i, i + maxChunkSize);
|
|
109
|
+
const encrypted = await crypto.subtle.encrypt(
|
|
110
|
+
{
|
|
111
|
+
name: "RSA-OAEP"
|
|
112
|
+
},
|
|
113
|
+
publicKey,
|
|
114
|
+
chunk
|
|
115
|
+
);
|
|
116
|
+
chunks.push(encrypted);
|
|
117
|
+
}
|
|
118
|
+
const totalLength = chunks.reduce((sum, chunk) => sum + chunk.byteLength, 0);
|
|
119
|
+
const merged = new Uint8Array(totalLength);
|
|
120
|
+
let offset = 0;
|
|
121
|
+
for (const chunk of chunks) {
|
|
122
|
+
merged.set(new Uint8Array(chunk), offset);
|
|
123
|
+
offset += chunk.byteLength;
|
|
124
|
+
}
|
|
125
|
+
return base64Encode(merged.buffer);
|
|
126
|
+
}
|
|
127
|
+
async function rsaDecrypt(encryptedData, privateKey) {
|
|
128
|
+
if (typeof crypto === "undefined" || !crypto.subtle) {
|
|
129
|
+
throw new Error("Web Crypto API is not available");
|
|
130
|
+
}
|
|
131
|
+
const binaryString = atob(encryptedData);
|
|
132
|
+
const encryptedArray = new Uint8Array(binaryString.length);
|
|
133
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
134
|
+
encryptedArray[i] = binaryString.charCodeAt(i);
|
|
135
|
+
}
|
|
136
|
+
const chunkSize = 256;
|
|
137
|
+
const chunks = [];
|
|
138
|
+
for (let i = 0; i < encryptedArray.length; i += chunkSize) {
|
|
139
|
+
const chunk = encryptedArray.slice(i, i + chunkSize);
|
|
140
|
+
const decrypted = await crypto.subtle.decrypt(
|
|
141
|
+
{
|
|
142
|
+
name: "RSA-OAEP"
|
|
143
|
+
},
|
|
144
|
+
privateKey,
|
|
145
|
+
chunk
|
|
146
|
+
);
|
|
147
|
+
const decoder = new TextDecoder();
|
|
148
|
+
chunks.push(decoder.decode(decrypted));
|
|
149
|
+
}
|
|
150
|
+
return chunks.join("");
|
|
151
|
+
}
|
|
152
|
+
async function exportPublicKey(publicKey) {
|
|
153
|
+
if (typeof crypto === "undefined" || !crypto.subtle) {
|
|
154
|
+
throw new Error("Web Crypto API is not available");
|
|
155
|
+
}
|
|
156
|
+
const exported = await crypto.subtle.exportKey("spki", publicKey);
|
|
157
|
+
return base64Encode(exported);
|
|
158
|
+
}
|
|
159
|
+
async function exportPrivateKey(privateKey) {
|
|
160
|
+
if (typeof crypto === "undefined" || !crypto.subtle) {
|
|
161
|
+
throw new Error("Web Crypto API is not available");
|
|
162
|
+
}
|
|
163
|
+
const exported = await crypto.subtle.exportKey("pkcs8", privateKey);
|
|
164
|
+
return base64Encode(exported);
|
|
165
|
+
}
|
|
166
|
+
async function importPublicKey(keyData) {
|
|
167
|
+
if (typeof crypto === "undefined" || !crypto.subtle) {
|
|
168
|
+
throw new Error("Web Crypto API is not available");
|
|
169
|
+
}
|
|
170
|
+
const keyBuffer = base64Decode(keyData);
|
|
171
|
+
const keyArray = new Uint8Array(keyBuffer.split("").map((char) => char.charCodeAt(0)));
|
|
172
|
+
return crypto.subtle.importKey(
|
|
173
|
+
"spki",
|
|
174
|
+
keyArray.buffer,
|
|
175
|
+
{
|
|
176
|
+
name: "RSA-OAEP",
|
|
177
|
+
hash: "SHA-256"
|
|
178
|
+
},
|
|
179
|
+
true,
|
|
180
|
+
["encrypt"]
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
async function importPrivateKey(keyData) {
|
|
184
|
+
if (typeof crypto === "undefined" || !crypto.subtle) {
|
|
185
|
+
throw new Error("Web Crypto API is not available");
|
|
186
|
+
}
|
|
187
|
+
const keyBuffer = base64Decode(keyData);
|
|
188
|
+
const keyArray = new Uint8Array(keyBuffer.split("").map((char) => char.charCodeAt(0)));
|
|
189
|
+
return crypto.subtle.importKey(
|
|
190
|
+
"pkcs8",
|
|
191
|
+
keyArray.buffer,
|
|
192
|
+
{
|
|
193
|
+
name: "RSA-OAEP",
|
|
194
|
+
hash: "SHA-256"
|
|
195
|
+
},
|
|
196
|
+
true,
|
|
197
|
+
["decrypt"]
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
var init_crypto = __esm({
|
|
201
|
+
"src/helper/crypto.ts"() {
|
|
202
|
+
}
|
|
203
|
+
});
|
|
4
204
|
|
|
5
205
|
// src/browser/storage.ts
|
|
206
|
+
init_crypto();
|
|
6
207
|
var globalKeyPair = null;
|
|
7
208
|
function setStorageKeyPair(keyPair) {
|
|
8
209
|
globalKeyPair = keyPair;
|
|
@@ -11,11 +212,11 @@ function getStorageKeyPair() {
|
|
|
11
212
|
return globalKeyPair;
|
|
12
213
|
}
|
|
13
214
|
async function encryptValue(value, publicKey) {
|
|
14
|
-
return
|
|
215
|
+
return rsaEncrypt(value, publicKey);
|
|
15
216
|
}
|
|
16
217
|
async function decryptValue(encryptedValue, privateKey) {
|
|
17
218
|
try {
|
|
18
|
-
return await
|
|
219
|
+
return await rsaDecrypt(encryptedValue, privateKey);
|
|
19
220
|
} catch {
|
|
20
221
|
try {
|
|
21
222
|
JSON.parse(encryptedValue);
|
|
@@ -49,8 +250,8 @@ var localStorage = {
|
|
|
49
250
|
const encrypted = await encryptValue(jsonStr, keyToUse);
|
|
50
251
|
window.localStorage.setItem(key, encrypted);
|
|
51
252
|
} else {
|
|
52
|
-
const { base64Encode } = await
|
|
53
|
-
const encoded =
|
|
253
|
+
const { base64Encode: base64Encode2 } = await Promise.resolve().then(() => (init_crypto(), crypto_exports));
|
|
254
|
+
const encoded = base64Encode2(jsonStr);
|
|
54
255
|
window.localStorage.setItem(key, encoded);
|
|
55
256
|
}
|
|
56
257
|
} catch (error) {
|
|
@@ -78,17 +279,17 @@ var localStorage = {
|
|
|
78
279
|
try {
|
|
79
280
|
decryptedStr = await decryptValue(encryptedStr, keyToUse);
|
|
80
281
|
} catch {
|
|
81
|
-
const { base64Decode } = await
|
|
282
|
+
const { base64Decode: base64Decode2 } = await Promise.resolve().then(() => (init_crypto(), crypto_exports));
|
|
82
283
|
try {
|
|
83
|
-
decryptedStr =
|
|
284
|
+
decryptedStr = base64Decode2(encryptedStr);
|
|
84
285
|
} catch {
|
|
85
286
|
return defaultValue;
|
|
86
287
|
}
|
|
87
288
|
}
|
|
88
289
|
} else {
|
|
89
|
-
const { base64Decode } = await
|
|
290
|
+
const { base64Decode: base64Decode2 } = await Promise.resolve().then(() => (init_crypto(), crypto_exports));
|
|
90
291
|
try {
|
|
91
|
-
decryptedStr =
|
|
292
|
+
decryptedStr = base64Decode2(encryptedStr);
|
|
92
293
|
} catch {
|
|
93
294
|
return defaultValue;
|
|
94
295
|
}
|
|
@@ -164,8 +365,8 @@ var sessionStorage = {
|
|
|
164
365
|
const encrypted = await encryptValue(jsonStr, keyToUse);
|
|
165
366
|
window.sessionStorage.setItem(key, encrypted);
|
|
166
367
|
} else {
|
|
167
|
-
const { base64Encode } = await
|
|
168
|
-
const encoded =
|
|
368
|
+
const { base64Encode: base64Encode2 } = await Promise.resolve().then(() => (init_crypto(), crypto_exports));
|
|
369
|
+
const encoded = base64Encode2(jsonStr);
|
|
169
370
|
window.sessionStorage.setItem(key, encoded);
|
|
170
371
|
}
|
|
171
372
|
} catch (error) {
|
|
@@ -193,17 +394,17 @@ var sessionStorage = {
|
|
|
193
394
|
try {
|
|
194
395
|
decryptedStr = await decryptValue(encryptedStr, keyToUse);
|
|
195
396
|
} catch {
|
|
196
|
-
const { base64Decode } = await
|
|
397
|
+
const { base64Decode: base64Decode2 } = await Promise.resolve().then(() => (init_crypto(), crypto_exports));
|
|
197
398
|
try {
|
|
198
|
-
decryptedStr =
|
|
399
|
+
decryptedStr = base64Decode2(encryptedStr);
|
|
199
400
|
} catch {
|
|
200
401
|
return defaultValue;
|
|
201
402
|
}
|
|
202
403
|
}
|
|
203
404
|
} else {
|
|
204
|
-
const { base64Decode } = await
|
|
405
|
+
const { base64Decode: base64Decode2 } = await Promise.resolve().then(() => (init_crypto(), crypto_exports));
|
|
205
406
|
try {
|
|
206
|
-
decryptedStr =
|
|
407
|
+
decryptedStr = base64Decode2(encryptedStr);
|
|
207
408
|
} catch {
|
|
208
409
|
return defaultValue;
|
|
209
410
|
}
|
|
@@ -357,5 +558,3 @@ exports.localStorage = localStorage;
|
|
|
357
558
|
exports.sessionStorage = sessionStorage;
|
|
358
559
|
exports.setStorageKeyPair = setStorageKeyPair;
|
|
359
560
|
exports.storage = storage;
|
|
360
|
-
//# sourceMappingURL=chunk-WZDOPUJW.js.map
|
|
361
|
-
//# sourceMappingURL=chunk-WZDOPUJW.js.map
|