@pathscale/secure-local-storage-chacha20-poly1305 1.0.0
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/CHANGELOG.md +21 -0
- package/LICENSE +21 -0
- package/README.md +403 -0
- package/dist/SecureLocalStorage.d.ts +54 -0
- package/dist/SecureLocalStorage.d.ts.map +1 -0
- package/dist/encryption.d.ts +36 -0
- package/dist/encryption.d.ts.map +1 -0
- package/dist/environment.d.ts +17 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/fingerprinting.d.ts +30 -0
- package/dist/fingerprinting.d.ts.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +656 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +647 -0
- package/dist/index.mjs.map +1 -0
- package/dist/types.d.ts +80 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +81 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,647 @@
|
|
|
1
|
+
import { chacha20poly1305 } from '@noble/ciphers/chacha.js';
|
|
2
|
+
import { randomBytes } from '@noble/ciphers/utils.js';
|
|
3
|
+
import { pbkdf2 } from '@noble/hashes/pbkdf2.js';
|
|
4
|
+
import { sha256 } from '@noble/hashes/sha2.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Browser fingerprinting utility for generating unique browser identifiers
|
|
8
|
+
*/
|
|
9
|
+
class BrowserFingerprinting {
|
|
10
|
+
constructor(disabledKeys = []) {
|
|
11
|
+
this.disabledKeys = new Set(disabledKeys);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Generate a comprehensive browser fingerprint
|
|
15
|
+
*/
|
|
16
|
+
generateFingerprint() {
|
|
17
|
+
return {
|
|
18
|
+
userAgent: this.isEnabled('UserAgent') ? this.getUserAgent() : '',
|
|
19
|
+
screenPrint: this.isEnabled('ScreenPrint') ? this.getScreenPrint() : '',
|
|
20
|
+
plugins: this.isEnabled('Plugins') ? this.getPlugins() : '',
|
|
21
|
+
fonts: this.isEnabled('Fonts') ? this.getFonts() : '',
|
|
22
|
+
localStorage: this.isEnabled('LocalStorage') ? this.hasLocalStorage() : false,
|
|
23
|
+
sessionStorage: this.isEnabled('SessionStorage') ? this.hasSessionStorage() : false,
|
|
24
|
+
timeZone: this.isEnabled('TimeZone') ? this.getTimeZone() : '',
|
|
25
|
+
language: this.isEnabled('Language') ? this.getLanguage() : '',
|
|
26
|
+
systemLanguage: this.isEnabled('SystemLanguage') ? this.getSystemLanguage() : '',
|
|
27
|
+
cookie: this.isEnabled('Cookie') ? this.hasCookieSupport() : false,
|
|
28
|
+
canvas: this.isEnabled('Canvas') ? this.getCanvasFingerprint() : '',
|
|
29
|
+
hostname: this.isEnabled('Hostname') ? this.getHostname() : '',
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Convert fingerprint to a hash string
|
|
34
|
+
*/
|
|
35
|
+
fingerprintToString(fingerprint) {
|
|
36
|
+
return Object.values(fingerprint)
|
|
37
|
+
.map(value => String(value))
|
|
38
|
+
.join('|');
|
|
39
|
+
}
|
|
40
|
+
isEnabled(property) {
|
|
41
|
+
return !this.disabledKeys.has(property);
|
|
42
|
+
}
|
|
43
|
+
getUserAgent() {
|
|
44
|
+
return typeof navigator !== 'undefined' ? navigator.userAgent : '';
|
|
45
|
+
}
|
|
46
|
+
getScreenPrint() {
|
|
47
|
+
if (typeof screen === 'undefined')
|
|
48
|
+
return '';
|
|
49
|
+
return `${screen.width}x${screen.height}x${screen.colorDepth}`;
|
|
50
|
+
}
|
|
51
|
+
getPlugins() {
|
|
52
|
+
if (typeof navigator === 'undefined' || !navigator.plugins)
|
|
53
|
+
return '';
|
|
54
|
+
const plugins = Array.from(navigator.plugins)
|
|
55
|
+
.map(plugin => plugin.name)
|
|
56
|
+
.sort()
|
|
57
|
+
.join(',');
|
|
58
|
+
return plugins;
|
|
59
|
+
}
|
|
60
|
+
getFonts() {
|
|
61
|
+
// Basic font detection using canvas
|
|
62
|
+
if (typeof document === 'undefined')
|
|
63
|
+
return '';
|
|
64
|
+
const fonts = [
|
|
65
|
+
'Arial', 'Helvetica', 'Times New Roman', 'Times', 'Courier New', 'Courier',
|
|
66
|
+
'Verdana', 'Georgia', 'Palatino', 'Garamond', 'Bookman', 'Comic Sans MS',
|
|
67
|
+
'Trebuchet MS', 'Arial Black', 'Impact', 'Sans-serif', 'Serif', 'Monospace'
|
|
68
|
+
];
|
|
69
|
+
const availableFonts = [];
|
|
70
|
+
const canvas = document.createElement('canvas');
|
|
71
|
+
const context = canvas.getContext('2d');
|
|
72
|
+
if (!context)
|
|
73
|
+
return '';
|
|
74
|
+
fonts.forEach(font => {
|
|
75
|
+
context.font = `12px ${font}, monospace`;
|
|
76
|
+
const width1 = context.measureText('mmmmmmmmmmlli').width;
|
|
77
|
+
context.font = `12px ${font}, sans-serif`;
|
|
78
|
+
const width2 = context.measureText('mmmmmmmmmmlli').width;
|
|
79
|
+
if (width1 !== width2) {
|
|
80
|
+
availableFonts.push(font);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
return availableFonts.join(',');
|
|
84
|
+
}
|
|
85
|
+
hasLocalStorage() {
|
|
86
|
+
try {
|
|
87
|
+
return typeof localStorage !== 'undefined';
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
hasSessionStorage() {
|
|
94
|
+
try {
|
|
95
|
+
return typeof sessionStorage !== 'undefined';
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
getTimeZone() {
|
|
102
|
+
try {
|
|
103
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
return new Date().getTimezoneOffset().toString();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
getLanguage() {
|
|
110
|
+
if (typeof navigator === 'undefined')
|
|
111
|
+
return '';
|
|
112
|
+
return navigator.language || '';
|
|
113
|
+
}
|
|
114
|
+
getSystemLanguage() {
|
|
115
|
+
if (typeof navigator === 'undefined')
|
|
116
|
+
return '';
|
|
117
|
+
const extendedNavigator = navigator;
|
|
118
|
+
return extendedNavigator.systemLanguage || navigator.language || '';
|
|
119
|
+
}
|
|
120
|
+
hasCookieSupport() {
|
|
121
|
+
if (typeof document === 'undefined')
|
|
122
|
+
return false;
|
|
123
|
+
return navigator.cookieEnabled;
|
|
124
|
+
}
|
|
125
|
+
getCanvasFingerprint() {
|
|
126
|
+
if (typeof document === 'undefined')
|
|
127
|
+
return '';
|
|
128
|
+
try {
|
|
129
|
+
const canvas = document.createElement('canvas');
|
|
130
|
+
const ctx = canvas.getContext('2d');
|
|
131
|
+
if (!ctx)
|
|
132
|
+
return '';
|
|
133
|
+
// Draw some text and shapes to create a unique canvas fingerprint
|
|
134
|
+
ctx.textBaseline = 'top';
|
|
135
|
+
ctx.font = '14px Arial';
|
|
136
|
+
ctx.fillStyle = '#f60';
|
|
137
|
+
ctx.fillRect(125, 1, 62, 20);
|
|
138
|
+
ctx.fillStyle = '#069';
|
|
139
|
+
ctx.fillText('SecureStorage 🔒', 2, 15);
|
|
140
|
+
ctx.fillStyle = 'rgba(102, 204, 0, 0.7)';
|
|
141
|
+
ctx.fillText('SecureStorage 🔒', 4, 17);
|
|
142
|
+
return canvas.toDataURL();
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return '';
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
getHostname() {
|
|
149
|
+
if (typeof location === 'undefined')
|
|
150
|
+
return '';
|
|
151
|
+
return location.hostname;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const ALGORITHM = 'ChaCha20-Poly1305';
|
|
156
|
+
const KEY_BYTES = 32;
|
|
157
|
+
const NONCE_BYTES = 12;
|
|
158
|
+
const PBKDF2_ITERATIONS = 1000;
|
|
159
|
+
const PBKDF2_SALT = 'secure-local-storage-salt';
|
|
160
|
+
/**
|
|
161
|
+
* Encryption utility for secure data storage
|
|
162
|
+
*/
|
|
163
|
+
class EncryptionManager {
|
|
164
|
+
constructor(secretKey) {
|
|
165
|
+
this.version = '2.0.0';
|
|
166
|
+
this.textEncoder = new TextEncoder();
|
|
167
|
+
this.textDecoder = new TextDecoder();
|
|
168
|
+
this.secretKey = this.deriveKey(secretKey);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Update the secret key
|
|
172
|
+
*/
|
|
173
|
+
updateSecretKey(newSecretKey) {
|
|
174
|
+
this.secretKey.fill(0);
|
|
175
|
+
this.secretKey = this.deriveKey(newSecretKey);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Encrypt data with type preservation
|
|
179
|
+
*/
|
|
180
|
+
encrypt(data) {
|
|
181
|
+
const item = {
|
|
182
|
+
data: this.serializeData(data),
|
|
183
|
+
type: this.getDataType(data),
|
|
184
|
+
timestamp: Date.now(),
|
|
185
|
+
version: this.version,
|
|
186
|
+
};
|
|
187
|
+
const serialized = JSON.stringify(item);
|
|
188
|
+
const nonce = randomBytes(NONCE_BYTES);
|
|
189
|
+
const plaintext = this.textEncoder.encode(serialized);
|
|
190
|
+
const ciphertext = chacha20poly1305(this.secretKey, nonce).encrypt(plaintext);
|
|
191
|
+
const envelope = {
|
|
192
|
+
algorithm: ALGORITHM,
|
|
193
|
+
nonce: this.encodeBase64(nonce),
|
|
194
|
+
ciphertext: this.encodeBase64(ciphertext),
|
|
195
|
+
version: this.version,
|
|
196
|
+
};
|
|
197
|
+
return JSON.stringify(envelope);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Decrypt data with type restoration
|
|
201
|
+
*/
|
|
202
|
+
decrypt(encryptedData) {
|
|
203
|
+
try {
|
|
204
|
+
const envelope = JSON.parse(encryptedData);
|
|
205
|
+
if (!this.isChachaEnvelope(envelope)) {
|
|
206
|
+
throw new Error('Unsupported encrypted data format');
|
|
207
|
+
}
|
|
208
|
+
const nonce = this.decodeBase64(envelope.nonce);
|
|
209
|
+
const ciphertext = this.decodeBase64(envelope.ciphertext);
|
|
210
|
+
const plaintext = chacha20poly1305(this.secretKey, nonce).decrypt(ciphertext);
|
|
211
|
+
const decryptedText = this.textDecoder.decode(plaintext);
|
|
212
|
+
const item = JSON.parse(decryptedText);
|
|
213
|
+
return this.deserializeData(item.data, item.type);
|
|
214
|
+
}
|
|
215
|
+
catch (error) {
|
|
216
|
+
console.warn('Failed to decrypt data:', error);
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Validate if data was encrypted with this library
|
|
222
|
+
*/
|
|
223
|
+
isValidEncryptedData(encryptedData) {
|
|
224
|
+
try {
|
|
225
|
+
const envelope = JSON.parse(encryptedData);
|
|
226
|
+
if (!this.isChachaEnvelope(envelope))
|
|
227
|
+
return false;
|
|
228
|
+
const plaintext = chacha20poly1305(this.secretKey, this.decodeBase64(envelope.nonce)).decrypt(this.decodeBase64(envelope.ciphertext));
|
|
229
|
+
const item = JSON.parse(this.textDecoder.decode(plaintext));
|
|
230
|
+
return item && typeof item.data !== 'undefined' && typeof item.type === 'string';
|
|
231
|
+
}
|
|
232
|
+
catch {
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
deriveKey(key) {
|
|
237
|
+
return pbkdf2(sha256, key, PBKDF2_SALT, {
|
|
238
|
+
c: PBKDF2_ITERATIONS,
|
|
239
|
+
dkLen: KEY_BYTES,
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
serializeData(data) {
|
|
243
|
+
if (data === null || data === undefined) {
|
|
244
|
+
return '';
|
|
245
|
+
}
|
|
246
|
+
if (typeof data === 'object') {
|
|
247
|
+
return JSON.stringify(data);
|
|
248
|
+
}
|
|
249
|
+
return String(data);
|
|
250
|
+
}
|
|
251
|
+
deserializeData(serializedData, type) {
|
|
252
|
+
if (type === 'null' || serializedData === '') {
|
|
253
|
+
return null;
|
|
254
|
+
}
|
|
255
|
+
switch (type) {
|
|
256
|
+
case 'string':
|
|
257
|
+
return serializedData;
|
|
258
|
+
case 'number':
|
|
259
|
+
return Number(serializedData);
|
|
260
|
+
case 'boolean':
|
|
261
|
+
return serializedData === 'true';
|
|
262
|
+
case 'object':
|
|
263
|
+
try {
|
|
264
|
+
return JSON.parse(serializedData);
|
|
265
|
+
}
|
|
266
|
+
catch {
|
|
267
|
+
return null;
|
|
268
|
+
}
|
|
269
|
+
default:
|
|
270
|
+
return serializedData;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
getDataType(data) {
|
|
274
|
+
if (data === null)
|
|
275
|
+
return 'null';
|
|
276
|
+
if (typeof data === 'object')
|
|
277
|
+
return 'object';
|
|
278
|
+
return typeof data;
|
|
279
|
+
}
|
|
280
|
+
isChachaEnvelope(value) {
|
|
281
|
+
if (!value || typeof value !== 'object')
|
|
282
|
+
return false;
|
|
283
|
+
const envelope = value;
|
|
284
|
+
return (envelope.algorithm === ALGORITHM &&
|
|
285
|
+
typeof envelope.nonce === 'string' &&
|
|
286
|
+
typeof envelope.ciphertext === 'string' &&
|
|
287
|
+
typeof envelope.version === 'string');
|
|
288
|
+
}
|
|
289
|
+
encodeBase64(bytes) {
|
|
290
|
+
if (typeof btoa === 'function') {
|
|
291
|
+
let binary = '';
|
|
292
|
+
const chunkSize = 0x8000;
|
|
293
|
+
for (let index = 0; index < bytes.length; index += chunkSize) {
|
|
294
|
+
binary += String.fromCharCode(...Array.from(bytes.subarray(index, index + chunkSize)));
|
|
295
|
+
}
|
|
296
|
+
return btoa(binary);
|
|
297
|
+
}
|
|
298
|
+
const buffer = this.getGlobalBuffer();
|
|
299
|
+
if (buffer)
|
|
300
|
+
return buffer.from(bytes).toString('base64');
|
|
301
|
+
throw new Error('No base64 encoder available');
|
|
302
|
+
}
|
|
303
|
+
decodeBase64(value) {
|
|
304
|
+
if (typeof atob === 'function') {
|
|
305
|
+
const binary = atob(value);
|
|
306
|
+
const bytes = new Uint8Array(binary.length);
|
|
307
|
+
for (let index = 0; index < binary.length; index += 1) {
|
|
308
|
+
bytes[index] = binary.charCodeAt(index);
|
|
309
|
+
}
|
|
310
|
+
return bytes;
|
|
311
|
+
}
|
|
312
|
+
const buffer = this.getGlobalBuffer();
|
|
313
|
+
if (buffer)
|
|
314
|
+
return Uint8Array.from(buffer.from(value, 'base64'));
|
|
315
|
+
throw new Error('No base64 decoder available');
|
|
316
|
+
}
|
|
317
|
+
getGlobalBuffer() {
|
|
318
|
+
return globalThis.Buffer;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Environment configuration manager for different frameworks
|
|
324
|
+
*/
|
|
325
|
+
class EnvironmentManager {
|
|
326
|
+
constructor() {
|
|
327
|
+
this.config = this.loadEnvironmentVariables();
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Get configuration from environment variables
|
|
331
|
+
*/
|
|
332
|
+
getConfig() {
|
|
333
|
+
const hashKey = this.getHashKey();
|
|
334
|
+
const prefix = this.getPrefix();
|
|
335
|
+
const disabledKeys = this.getDisabledKeys();
|
|
336
|
+
const config = {
|
|
337
|
+
disabledKeys,
|
|
338
|
+
debug: false,
|
|
339
|
+
};
|
|
340
|
+
if (hashKey)
|
|
341
|
+
config.hashKey = hashKey;
|
|
342
|
+
if (prefix)
|
|
343
|
+
config.prefix = prefix;
|
|
344
|
+
return config;
|
|
345
|
+
}
|
|
346
|
+
loadEnvironmentVariables() {
|
|
347
|
+
// Handle different environments with proper typing
|
|
348
|
+
const globalProcess = globalThis.process;
|
|
349
|
+
if (typeof globalProcess !== 'undefined' && globalProcess.env) {
|
|
350
|
+
return globalProcess.env;
|
|
351
|
+
}
|
|
352
|
+
// Handle Vite environment
|
|
353
|
+
const importMeta = import.meta;
|
|
354
|
+
if (typeof import.meta !== 'undefined' && importMeta.env) {
|
|
355
|
+
return importMeta.env;
|
|
356
|
+
}
|
|
357
|
+
// Handle browser environment with injected variables
|
|
358
|
+
const globalWindow = window;
|
|
359
|
+
if (typeof window !== 'undefined' && globalWindow.__ENV__) {
|
|
360
|
+
return globalWindow.__ENV__;
|
|
361
|
+
}
|
|
362
|
+
return {};
|
|
363
|
+
}
|
|
364
|
+
getHashKey() {
|
|
365
|
+
return (this.config.REACT_APP_SECURE_LOCAL_STORAGE_HASH_KEY ||
|
|
366
|
+
this.config.VITE_SECURE_LOCAL_STORAGE_HASH_KEY ||
|
|
367
|
+
this.config.NEXT_PUBLIC_SECURE_LOCAL_STORAGE_HASH_KEY ||
|
|
368
|
+
this.config.SECURE_LOCAL_STORAGE_HASH_KEY);
|
|
369
|
+
}
|
|
370
|
+
getPrefix() {
|
|
371
|
+
return (this.config.REACT_APP_SECURE_LOCAL_STORAGE_PREFIX ||
|
|
372
|
+
this.config.VITE_SECURE_LOCAL_STORAGE_PREFIX ||
|
|
373
|
+
this.config.NEXT_PUBLIC_SECURE_LOCAL_STORAGE_PREFIX ||
|
|
374
|
+
this.config.SECURE_LOCAL_STORAGE_PREFIX);
|
|
375
|
+
}
|
|
376
|
+
getDisabledKeys() {
|
|
377
|
+
const disabledKeysStr = this.config.REACT_APP_SECURE_LOCAL_STORAGE_DISABLED_KEYS ||
|
|
378
|
+
this.config.VITE_SECURE_LOCAL_STORAGE_DISABLED_KEYS ||
|
|
379
|
+
this.config.NEXT_PUBLIC_SECURE_LOCAL_STORAGE_DISABLED_KEYS ||
|
|
380
|
+
this.config.SECURE_LOCAL_STORAGE_DISABLED_KEYS;
|
|
381
|
+
if (!disabledKeysStr)
|
|
382
|
+
return [];
|
|
383
|
+
return disabledKeysStr
|
|
384
|
+
.split('|')
|
|
385
|
+
.filter(key => key.trim())
|
|
386
|
+
.map(key => key.trim());
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Secure Local Storage - A secure, encrypted local storage with browser fingerprinting
|
|
392
|
+
*/
|
|
393
|
+
class SecureLocalStorage {
|
|
394
|
+
constructor(config = {}) {
|
|
395
|
+
this.isInitialized = false;
|
|
396
|
+
this.environment = new EnvironmentManager();
|
|
397
|
+
const envConfig = this.environment.getConfig();
|
|
398
|
+
// Merge environment config with provided config
|
|
399
|
+
this.config = {
|
|
400
|
+
hashKey: config.hashKey || envConfig.hashKey || this.generateDefaultHashKey(),
|
|
401
|
+
prefix: config.prefix || envConfig.prefix || 'sls_',
|
|
402
|
+
disabledKeys: config.disabledKeys || envConfig.disabledKeys || [],
|
|
403
|
+
debug: config.debug || envConfig.debug || false,
|
|
404
|
+
};
|
|
405
|
+
this.fingerprinting = new BrowserFingerprinting(this.config.disabledKeys);
|
|
406
|
+
this.storageEngine = this.getStorageEngine();
|
|
407
|
+
this.prefix = this.config.prefix || 'sls_';
|
|
408
|
+
this.memoryCache = new Map();
|
|
409
|
+
const secretKey = this.generateSecretKey();
|
|
410
|
+
this.encryption = new EncryptionManager(secretKey);
|
|
411
|
+
this.isInitialized = true;
|
|
412
|
+
this.initializeFromStorage();
|
|
413
|
+
if (this.config.debug) {
|
|
414
|
+
console.log('SecureLocalStorage initialized with config:', this.config);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Get the singleton instance
|
|
419
|
+
*/
|
|
420
|
+
static getInstance(config) {
|
|
421
|
+
if (!SecureLocalStorage.instance) {
|
|
422
|
+
SecureLocalStorage.instance = new SecureLocalStorage(config);
|
|
423
|
+
}
|
|
424
|
+
return SecureLocalStorage.instance;
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Set an item in secure storage
|
|
428
|
+
*/
|
|
429
|
+
setItem(key, value) {
|
|
430
|
+
if (!this.isInitialized) {
|
|
431
|
+
throw new Error('SecureLocalStorage is not initialized');
|
|
432
|
+
}
|
|
433
|
+
try {
|
|
434
|
+
const encryptedValue = this.encryption.encrypt(value);
|
|
435
|
+
const storageKey = this.getStorageKey(key);
|
|
436
|
+
this.storageEngine.setItem(storageKey, encryptedValue);
|
|
437
|
+
this.memoryCache.set(key, value);
|
|
438
|
+
if (this.config.debug) {
|
|
439
|
+
console.log(`Set item: ${key}`, value);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
catch (error) {
|
|
443
|
+
console.error('Failed to set item:', error);
|
|
444
|
+
throw new Error(`Failed to set item: ${key}`);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Get an item from secure storage
|
|
449
|
+
*/
|
|
450
|
+
getItem(key) {
|
|
451
|
+
if (!this.isInitialized) {
|
|
452
|
+
throw new Error('SecureLocalStorage is not initialized');
|
|
453
|
+
}
|
|
454
|
+
// First check memory cache for performance
|
|
455
|
+
if (this.memoryCache.has(key)) {
|
|
456
|
+
const value = this.memoryCache.get(key);
|
|
457
|
+
if (this.config.debug) {
|
|
458
|
+
console.log(`Get item from cache: ${key}`, value);
|
|
459
|
+
}
|
|
460
|
+
return value !== undefined ? value : null;
|
|
461
|
+
}
|
|
462
|
+
try {
|
|
463
|
+
const storageKey = this.getStorageKey(key);
|
|
464
|
+
const encryptedValue = this.storageEngine.getItem(storageKey);
|
|
465
|
+
if (!encryptedValue) {
|
|
466
|
+
return null;
|
|
467
|
+
}
|
|
468
|
+
const decryptedValue = this.encryption.decrypt(encryptedValue);
|
|
469
|
+
this.memoryCache.set(key, decryptedValue);
|
|
470
|
+
if (this.config.debug) {
|
|
471
|
+
console.log(`Get item from storage: ${key}`, decryptedValue);
|
|
472
|
+
}
|
|
473
|
+
return decryptedValue;
|
|
474
|
+
}
|
|
475
|
+
catch (error) {
|
|
476
|
+
console.error('Failed to get item:', error);
|
|
477
|
+
return null;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Remove an item from secure storage
|
|
482
|
+
*/
|
|
483
|
+
removeItem(key) {
|
|
484
|
+
if (!this.isInitialized) {
|
|
485
|
+
throw new Error('SecureLocalStorage is not initialized');
|
|
486
|
+
}
|
|
487
|
+
try {
|
|
488
|
+
const storageKey = this.getStorageKey(key);
|
|
489
|
+
this.storageEngine.removeItem(storageKey);
|
|
490
|
+
this.memoryCache.delete(key);
|
|
491
|
+
if (this.config.debug) {
|
|
492
|
+
console.log(`Removed item: ${key}`);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
catch (error) {
|
|
496
|
+
console.error('Failed to remove item:', error);
|
|
497
|
+
throw new Error(`Failed to remove item: ${key}`);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Clear all items from secure storage
|
|
502
|
+
*/
|
|
503
|
+
clear() {
|
|
504
|
+
if (!this.isInitialized) {
|
|
505
|
+
throw new Error('SecureLocalStorage is not initialized');
|
|
506
|
+
}
|
|
507
|
+
try {
|
|
508
|
+
// Only remove items with our prefix
|
|
509
|
+
const keysToRemove = [];
|
|
510
|
+
for (let i = 0; i < this.storageEngine.length; i++) {
|
|
511
|
+
const key = this.storageEngine.key(i);
|
|
512
|
+
if (key && key.startsWith(this.prefix)) {
|
|
513
|
+
keysToRemove.push(key);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
keysToRemove.forEach(key => {
|
|
517
|
+
this.storageEngine.removeItem(key);
|
|
518
|
+
});
|
|
519
|
+
this.memoryCache.clear();
|
|
520
|
+
if (this.config.debug) {
|
|
521
|
+
console.log('Cleared all secure storage items');
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
catch (error) {
|
|
525
|
+
console.error('Failed to clear storage:', error);
|
|
526
|
+
throw new Error('Failed to clear secure storage');
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Get all keys in secure storage
|
|
531
|
+
*/
|
|
532
|
+
keys() {
|
|
533
|
+
if (!this.isInitialized) {
|
|
534
|
+
throw new Error('SecureLocalStorage is not initialized');
|
|
535
|
+
}
|
|
536
|
+
const keys = [];
|
|
537
|
+
for (let i = 0; i < this.storageEngine.length; i++) {
|
|
538
|
+
const key = this.storageEngine.key(i);
|
|
539
|
+
if (key && key.startsWith(this.prefix)) {
|
|
540
|
+
// Remove prefix to get original key
|
|
541
|
+
keys.push(key.substring(this.prefix.length));
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
return keys;
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Get the number of items in secure storage
|
|
548
|
+
*/
|
|
549
|
+
length() {
|
|
550
|
+
return this.keys().length;
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Update configuration
|
|
554
|
+
*/
|
|
555
|
+
updateConfig(newConfig) {
|
|
556
|
+
const oldConfig = { ...this.config };
|
|
557
|
+
this.config = { ...this.config, ...newConfig };
|
|
558
|
+
// Regenerate secret key if hash key changed
|
|
559
|
+
if (oldConfig.hashKey !== this.config.hashKey) {
|
|
560
|
+
const newSecretKey = this.generateSecretKey();
|
|
561
|
+
this.encryption.updateSecretKey(newSecretKey);
|
|
562
|
+
}
|
|
563
|
+
// Update fingerprinting if disabled keys changed
|
|
564
|
+
if (oldConfig.disabledKeys !== this.config.disabledKeys) {
|
|
565
|
+
this.fingerprinting = new BrowserFingerprinting(this.config.disabledKeys);
|
|
566
|
+
}
|
|
567
|
+
if (this.config.debug) {
|
|
568
|
+
console.log('Configuration updated:', this.config);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
getStorageEngine() {
|
|
572
|
+
if (typeof localStorage !== 'undefined') {
|
|
573
|
+
return localStorage;
|
|
574
|
+
}
|
|
575
|
+
// Fallback to memory storage for environments without localStorage
|
|
576
|
+
return new MemoryStorage();
|
|
577
|
+
}
|
|
578
|
+
getStorageKey(key) {
|
|
579
|
+
return `${this.prefix}${key}`;
|
|
580
|
+
}
|
|
581
|
+
generateDefaultHashKey() {
|
|
582
|
+
return 'secure-local-storage-default-key';
|
|
583
|
+
}
|
|
584
|
+
generateSecretKey() {
|
|
585
|
+
const fingerprint = this.fingerprinting.generateFingerprint();
|
|
586
|
+
const fingerprintString = this.fingerprinting.fingerprintToString(fingerprint);
|
|
587
|
+
return `${this.config.hashKey}|${fingerprintString}`;
|
|
588
|
+
}
|
|
589
|
+
initializeFromStorage() {
|
|
590
|
+
try {
|
|
591
|
+
const keys = this.keys();
|
|
592
|
+
keys.forEach(key => {
|
|
593
|
+
try {
|
|
594
|
+
const value = this.getItem(key);
|
|
595
|
+
if (value !== null) {
|
|
596
|
+
this.memoryCache.set(key, value);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
catch (error) {
|
|
600
|
+
console.warn(`Failed to load item from storage: ${key}`, error);
|
|
601
|
+
}
|
|
602
|
+
});
|
|
603
|
+
if (this.config.debug) {
|
|
604
|
+
console.log(`Loaded ${this.memoryCache.size} items from storage`);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
catch (error) {
|
|
608
|
+
console.error('Failed to initialize from storage:', error);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
SecureLocalStorage.instance = null;
|
|
613
|
+
/**
|
|
614
|
+
* Memory storage fallback for environments without localStorage
|
|
615
|
+
*/
|
|
616
|
+
class MemoryStorage {
|
|
617
|
+
constructor() {
|
|
618
|
+
this.storage = new Map();
|
|
619
|
+
}
|
|
620
|
+
getItem(key) {
|
|
621
|
+
return this.storage.get(key) || null;
|
|
622
|
+
}
|
|
623
|
+
setItem(key, value) {
|
|
624
|
+
this.storage.set(key, value);
|
|
625
|
+
}
|
|
626
|
+
removeItem(key) {
|
|
627
|
+
this.storage.delete(key);
|
|
628
|
+
}
|
|
629
|
+
clear() {
|
|
630
|
+
this.storage.clear();
|
|
631
|
+
}
|
|
632
|
+
key(index) {
|
|
633
|
+
const keys = Array.from(this.storage.keys());
|
|
634
|
+
return keys[index] || null;
|
|
635
|
+
}
|
|
636
|
+
get length() {
|
|
637
|
+
return this.storage.size;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* Default secure local storage instance
|
|
643
|
+
*/
|
|
644
|
+
const secureLocalStorage = SecureLocalStorage.getInstance();
|
|
645
|
+
|
|
646
|
+
export { BrowserFingerprinting, EncryptionManager, EnvironmentManager, SecureLocalStorage, secureLocalStorage as default };
|
|
647
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/fingerprinting.ts","../src/encryption.ts","../src/environment.ts","../src/SecureLocalStorage.ts","../src/index.ts"],"sourcesContent":[null,null,null,null,null],"names":[],"mappings":";;;;;AAEA;;AAEG;MACU,qBAAqB,CAAA;AAGhC,IAAA,WAAA,CAAY,eAAsC,EAAE,EAAA;QAClD,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC;IAC3C;AAEA;;AAEG;IACI,mBAAmB,GAAA;QACxB,OAAO;AACL,YAAA,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE;AACjE,YAAA,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,cAAc,EAAE,GAAG,EAAE;AACvE,YAAA,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE;AAC3D,YAAA,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE;AACrD,YAAA,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,eAAe,EAAE,GAAG,KAAK;AAC7E,YAAA,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC,iBAAiB,EAAE,GAAG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