@decido/shell-auth 1.0.0 → 4.0.1
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/README.md +29 -0
- package/package.json +5 -2
- package/src/secureStorage.ts +0 -61
- package/tsconfig.json +0 -15
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# 🚀 @decido/shell-auth
|
|
2
|
+
|
|
3
|
+
> Decido OS Shell Authentication & Obfuscated Persistence Core
|
|
4
|
+
|
|
5
|
+
Bienvenido a la documentación oficial de **@decido/shell-auth**, un componente integral del ecosistema **Decido OS**.
|
|
6
|
+
|
|
7
|
+
## 📦 Instalación
|
|
8
|
+
|
|
9
|
+
Para aprovisionar este módulo dentro de otra área del monorepo o consumirlo remotamente:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @decido/shell-auth
|
|
13
|
+
# o mediante el gestor oficial del monorepo
|
|
14
|
+
pnpm add @decido/shell-auth
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 🔧 Estructura y Dependencias
|
|
18
|
+
|
|
19
|
+
Este paquete está diseñado para interoperar de forma nativa con la infraestructura central.
|
|
20
|
+
Para su correcto funcionamiento en un entorno aislado (Sandboxed), se apoya en los siguientes cimientos tecnológicos:
|
|
21
|
+
|
|
22
|
+
- `idb-keyval`
|
|
23
|
+
- `zustand`
|
|
24
|
+
- `@decido/tauri-bridge`
|
|
25
|
+
|
|
26
|
+
## 🔐 Licencia y Privacidad
|
|
27
|
+
El código de este componente se encuentra auditado y restringido (Sin Sourcemaps).
|
|
28
|
+
Propiedad Intelectual Protegida - Framework Decido OS.
|
|
29
|
+
Distribuido bajo licencia **UNLICENSED**.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decido/shell-auth",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Decido OS Shell Authentication & Obfuscated Persistence Core",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"idb-keyval": "^6.2.1",
|
|
15
15
|
"zustand": "^4.5.2",
|
|
16
|
-
"@decido/tauri-bridge": "0.1
|
|
16
|
+
"@decido/tauri-bridge": "4.0.1"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"typescript": "^5.0.0"
|
|
@@ -22,6 +22,9 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"license": "UNLICENSED",
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
25
28
|
"scripts": {
|
|
26
29
|
"lint": "eslint \"src/**/*.ts*\"",
|
|
27
30
|
"build": "tsup src/index.ts --format esm --dts --minify --clean"
|
package/src/secureStorage.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { get, set, del } from 'idb-keyval';
|
|
2
|
-
import { StateStorage } from 'zustand/middleware';
|
|
3
|
-
import { secure } from '@decido/tauri-bridge';
|
|
4
|
-
import { isTauri } from '@decido/tauri-bridge';
|
|
5
|
-
|
|
6
|
-
// Basic obfuscation wrapper for pure SSR/Web Fallback
|
|
7
|
-
const obfuscate = (data: string): string => {
|
|
8
|
-
if (typeof btoa === 'undefined') return data;
|
|
9
|
-
return btoa(encodeURIComponent(data));
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const deobfuscate = (data: string): string => {
|
|
13
|
-
if (typeof atob === 'undefined') return data;
|
|
14
|
-
try {
|
|
15
|
-
return decodeURIComponent(atob(data));
|
|
16
|
-
} catch {
|
|
17
|
-
return data;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const secureStorage: StateStorage = {
|
|
22
|
-
getItem: async (name: string): Promise<string | null> => {
|
|
23
|
-
try {
|
|
24
|
-
if (isTauri()) {
|
|
25
|
-
const val = await secure.secureVault.getItem(name);
|
|
26
|
-
if (val !== null) return val;
|
|
27
|
-
}
|
|
28
|
-
// WEB Fallback
|
|
29
|
-
const val = await get(name);
|
|
30
|
-
if (!val) return null;
|
|
31
|
-
return deobfuscate(val);
|
|
32
|
-
} catch (err) {
|
|
33
|
-
console.error(`[SecureStorage] Failed to get item ${name}`, err);
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
setItem: async (name: string, value: string): Promise<void> => {
|
|
38
|
-
try {
|
|
39
|
-
if (isTauri()) {
|
|
40
|
-
await secure.secureVault.setItem(name, value);
|
|
41
|
-
return; // Do not leak to indexedDB
|
|
42
|
-
}
|
|
43
|
-
// WEB Fallback
|
|
44
|
-
const obfuscated = obfuscate(value);
|
|
45
|
-
await set(name, obfuscated);
|
|
46
|
-
} catch (err) {
|
|
47
|
-
console.error(`[SecureStorage] Failed to set item ${name}`, err);
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
removeItem: async (name: string): Promise<void> => {
|
|
51
|
-
try {
|
|
52
|
-
if (isTauri()) {
|
|
53
|
-
await secure.secureVault.removeItem(name);
|
|
54
|
-
// Also clean legacy web fallback just in case
|
|
55
|
-
}
|
|
56
|
-
await del(name);
|
|
57
|
-
} catch (err) {
|
|
58
|
-
console.error(`[SecureStorage] Failed to remove item ${name}`, err);
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
};
|
package/tsconfig.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"strict": true,
|
|
5
|
-
"outDir": "dist",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"declarationMap": true,
|
|
8
|
-
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
9
|
-
"module": "ESNext",
|
|
10
|
-
"target": "ESNext",
|
|
11
|
-
"moduleResolution": "bundler"
|
|
12
|
-
},
|
|
13
|
-
"include": ["src/**/*"],
|
|
14
|
-
"exclude": ["node_modules", "dist"]
|
|
15
|
-
}
|