@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/types.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration options for the secure local storage
|
|
3
|
+
*/
|
|
4
|
+
export interface SecureStorageConfig {
|
|
5
|
+
/** Custom hash key for encryption */
|
|
6
|
+
hashKey?: string;
|
|
7
|
+
/** Prefix for storage keys */
|
|
8
|
+
prefix?: string;
|
|
9
|
+
/** Disabled properties for fingerprint generation */
|
|
10
|
+
disabledKeys?: FingerprintProperty[];
|
|
11
|
+
/** Enable debug mode */
|
|
12
|
+
debug?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Environment configuration for different frameworks
|
|
16
|
+
*/
|
|
17
|
+
export interface EnvironmentConfig {
|
|
18
|
+
/** React environment prefix */
|
|
19
|
+
REACT_APP_SECURE_LOCAL_STORAGE_HASH_KEY?: string;
|
|
20
|
+
REACT_APP_SECURE_LOCAL_STORAGE_PREFIX?: string;
|
|
21
|
+
REACT_APP_SECURE_LOCAL_STORAGE_DISABLED_KEYS?: string;
|
|
22
|
+
/** Vite environment prefix */
|
|
23
|
+
VITE_SECURE_LOCAL_STORAGE_HASH_KEY?: string;
|
|
24
|
+
VITE_SECURE_LOCAL_STORAGE_PREFIX?: string;
|
|
25
|
+
VITE_SECURE_LOCAL_STORAGE_DISABLED_KEYS?: string;
|
|
26
|
+
/** Next.js environment prefix */
|
|
27
|
+
NEXT_PUBLIC_SECURE_LOCAL_STORAGE_HASH_KEY?: string;
|
|
28
|
+
NEXT_PUBLIC_SECURE_LOCAL_STORAGE_PREFIX?: string;
|
|
29
|
+
NEXT_PUBLIC_SECURE_LOCAL_STORAGE_DISABLED_KEYS?: string;
|
|
30
|
+
/** Default environment variables */
|
|
31
|
+
SECURE_LOCAL_STORAGE_HASH_KEY?: string;
|
|
32
|
+
SECURE_LOCAL_STORAGE_PREFIX?: string;
|
|
33
|
+
SECURE_LOCAL_STORAGE_DISABLED_KEYS?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Browser fingerprint properties
|
|
37
|
+
*/
|
|
38
|
+
export type FingerprintProperty = 'UserAgent' | 'ScreenPrint' | 'Plugins' | 'Fonts' | 'LocalStorage' | 'SessionStorage' | 'TimeZone' | 'Language' | 'SystemLanguage' | 'Cookie' | 'Canvas' | 'Hostname';
|
|
39
|
+
/**
|
|
40
|
+
* Supported data types for storage
|
|
41
|
+
*/
|
|
42
|
+
export type StorageValue = string | number | boolean | object | null;
|
|
43
|
+
/**
|
|
44
|
+
* Storage engine interface
|
|
45
|
+
*/
|
|
46
|
+
export interface StorageEngine {
|
|
47
|
+
getItem(key: string): string | null;
|
|
48
|
+
setItem(key: string, value: string): void;
|
|
49
|
+
removeItem(key: string): void;
|
|
50
|
+
clear(): void;
|
|
51
|
+
key(index: number): string | null;
|
|
52
|
+
readonly length: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Encrypted storage item structure
|
|
56
|
+
*/
|
|
57
|
+
export interface EncryptedStorageItem {
|
|
58
|
+
data: string;
|
|
59
|
+
type: string;
|
|
60
|
+
timestamp: number;
|
|
61
|
+
version: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Browser fingerprint data
|
|
65
|
+
*/
|
|
66
|
+
export interface BrowserFingerprint {
|
|
67
|
+
userAgent: string;
|
|
68
|
+
screenPrint: string;
|
|
69
|
+
plugins: string;
|
|
70
|
+
fonts: string;
|
|
71
|
+
localStorage: boolean;
|
|
72
|
+
sessionStorage: boolean;
|
|
73
|
+
timeZone: string;
|
|
74
|
+
language: string;
|
|
75
|
+
systemLanguage: string;
|
|
76
|
+
cookie: boolean;
|
|
77
|
+
canvas: string;
|
|
78
|
+
hostname: string;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,YAAY,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACrC,wBAAwB;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,+BAA+B;IAC/B,uCAAuC,CAAC,EAAE,MAAM,CAAC;IACjD,qCAAqC,CAAC,EAAE,MAAM,CAAC;IAC/C,4CAA4C,CAAC,EAAE,MAAM,CAAC;IAEtD,8BAA8B;IAC9B,kCAAkC,CAAC,EAAE,MAAM,CAAC;IAC5C,gCAAgC,CAAC,EAAE,MAAM,CAAC;IAC1C,uCAAuC,CAAC,EAAE,MAAM,CAAC;IAEjD,iCAAiC;IACjC,yCAAyC,CAAC,EAAE,MAAM,CAAC;IACnD,uCAAuC,CAAC,EAAE,MAAM,CAAC;IACjD,8CAA8C,CA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CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pathscale/secure-local-storage-chacha20-poly1305",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A secure localStorage wrapper using ChaCha20-Poly1305 and browser fingerprinting",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.mjs",
|
|
15
|
+
"require": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"README.md",
|
|
21
|
+
"LICENSE",
|
|
22
|
+
"CHANGELOG.md"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "node scripts/build.mjs",
|
|
26
|
+
"build:watch": "rollup -c rollup.config.mjs -w",
|
|
27
|
+
"dev": "rollup -c rollup.config.mjs -w",
|
|
28
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
29
|
+
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
30
|
+
"typecheck": "tsc --noEmit",
|
|
31
|
+
"prepublishOnly": "npm run build && npm run lint",
|
|
32
|
+
"preversion": "npm run lint",
|
|
33
|
+
"version": "npm run build && git add -A dist",
|
|
34
|
+
"postversion": "git push && git push --tags",
|
|
35
|
+
"clean": "rimraf dist"
|
|
36
|
+
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"localstorage",
|
|
39
|
+
"encryption",
|
|
40
|
+
"security",
|
|
41
|
+
"browser-fingerprinting",
|
|
42
|
+
"typescript",
|
|
43
|
+
"chacha20-poly1305",
|
|
44
|
+
"aead",
|
|
45
|
+
"secure-storage",
|
|
46
|
+
"privacy",
|
|
47
|
+
"data-protection",
|
|
48
|
+
"crypto",
|
|
49
|
+
"react",
|
|
50
|
+
"vue",
|
|
51
|
+
"angular",
|
|
52
|
+
"vite",
|
|
53
|
+
"nextjs"
|
|
54
|
+
],
|
|
55
|
+
"author": "Pathscale",
|
|
56
|
+
"license": "MIT",
|
|
57
|
+
"repository": {
|
|
58
|
+
"type": "git",
|
|
59
|
+
"url": "git+https://github.com/pathscale/secure-local-storage-chacha20-poly1305.git"
|
|
60
|
+
},
|
|
61
|
+
"bugs": {
|
|
62
|
+
"url": "https://github.com/pathscale/secure-local-storage-chacha20-poly1305/issues"
|
|
63
|
+
},
|
|
64
|
+
"homepage": "https://github.com/pathscale/secure-local-storage-chacha20-poly1305#readme",
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@rollup/plugin-commonjs": "^29.0.2",
|
|
67
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
68
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
69
|
+
"@typescript-eslint/eslint-plugin": "^8.46.0",
|
|
70
|
+
"@typescript-eslint/parser": "^8.46.0",
|
|
71
|
+
"eslint": "^8.54.0",
|
|
72
|
+
"rimraf": "^5.0.5",
|
|
73
|
+
"rollup": "^4.60.3",
|
|
74
|
+
"tslib": "^2.8.1",
|
|
75
|
+
"typescript": "^5.3.2"
|
|
76
|
+
},
|
|
77
|
+
"dependencies": {
|
|
78
|
+
"@noble/ciphers": "^2.2.0",
|
|
79
|
+
"@noble/hashes": "^2.2.0"
|
|
80
|
+
}
|
|
81
|
+
}
|