@decido/shell-auth 4.0.2 → 4.0.4

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -0
  2. package/package.json +4 -3
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var g=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var h=(e,t)=>{for(var r in t)g(e,r,{get:t[r],enumerable:!0})},C=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of S(t))!y.call(e,o)&&o!==r&&g(e,o,{get:()=>t[o],enumerable:!(n=b(t,o))||n.enumerable});return e};var w=e=>C(g({},"__esModule",{value:!0}),e);var I={};h(I,{secureStorage:()=>p,useAuthStore:()=>T});module.exports=w(I);var v=require("zustand"),m=require("zustand/middleware");var i=require("idb-keyval"),c=require("@decido/tauri-bridge"),u=require("@decido/tauri-bridge"),x=e=>typeof btoa>"u"?e:btoa(encodeURIComponent(e)),L=e=>{if(typeof atob>"u")return e;try{return decodeURIComponent(atob(e))}catch{return e}},p={getItem:async e=>{try{if((0,u.isTauri)()){let r=await c.secure.secureVault.getItem(e);if(r!==null)return r}let t=await(0,i.get)(e);return t?L(t):null}catch(t){return console.error(`[SecureStorage] Failed to get item ${e}`,t),null}},setItem:async(e,t)=>{try{if((0,u.isTauri)()){await c.secure.secureVault.setItem(e,t);return}let r=x(t);await(0,i.set)(e,r)}catch(r){console.error(`[SecureStorage] Failed to set item ${e}`,r)}},removeItem:async e=>{try{(0,u.isTauri)()&&await c.secure.secureVault.removeItem(e),await(0,i.del)(e)}catch(t){console.error(`[SecureStorage] Failed to remove item ${e}`,t)}}};var T=(0,v.create)()((0,m.persist)((e,t)=>({isAuthenticated:!1,userRole:null,userName:null,availableLicenses:[],activeContext:null,hasCompletedWelcome:!1,hasSeenTour:!1,login:(r,n,o)=>{let a=o||[{type:"personal",id:"personal",name:`${n}'s Private Space`}];e({isAuthenticated:!0,userRole:r,userName:n,availableLicenses:a,activeContext:a.length===1?a[0]:null})},joinSwarm:async r=>{try{let o=r.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),a=decodeURIComponent(atob(o).split("").map(function(d){return"%"+("00"+d.charCodeAt(0).toString(16)).slice(-2)}).join("")),s=JSON.parse(a);if(!s.tenantId||!s.name)return!1;let l={type:s.type||"enterprise",id:s.tenantId,name:s.name,swarmKey:s.swarm_key,websocketRelayUrl:s.ws_url},{availableLicenses:f}=t();return f.find(d=>d.id===l.id)?e({activeContext:l}):e({availableLicenses:[...f,l],activeContext:l}),!0}catch(n){return console.error("Failed to join swarm from token",n),!1}},setActiveContext:r=>{let{availableLicenses:n}=t(),o=n.find(a=>a.id===r)||null;e({activeContext:o})},setHasCompletedWelcome:r=>{e({hasCompletedWelcome:r})},setHasSeenTour:r=>{e({hasSeenTour:r})},logout:()=>e({isAuthenticated:!1,userRole:null,userName:null,availableLicenses:[],activeContext:null,hasCompletedWelcome:!1,hasSeenTour:!1})}),{name:"decido-auth-storage",storage:(0,m.createJSONStorage)(()=>p)}));0&&(module.exports={secureStorage,useAuthStore});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decido/shell-auth",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
4
4
  "description": "Decido OS Shell Authentication & Obfuscated Persistence Core",
5
5
  "main": "./dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -9,6 +9,7 @@
9
9
  },
10
10
  "exports": {
11
11
  ".": {
12
+ "development": "./src/index.ts",
12
13
  "types": "./dist/index.d.ts",
13
14
  "import": "./dist/index.mjs",
14
15
  "require": "./dist/index.js",
@@ -18,7 +19,7 @@
18
19
  "dependencies": {
19
20
  "idb-keyval": "^6.2.1",
20
21
  "zustand": "^4.5.2",
21
- "@decido/tauri-bridge": "4.0.2"
22
+ "@decido/tauri-bridge": "4.0.4"
22
23
  },
23
24
  "devDependencies": {
24
25
  "typescript": "^5.0.0"
@@ -33,6 +34,6 @@
33
34
  "module": "./dist/index.mjs",
34
35
  "scripts": {
35
36
  "lint": "eslint \"src/**/*.ts*\"",
36
- "build": "tsup src/index.ts --format esm,cjs"
37
+ "build": "tsup src/index.ts --format esm,cjs --minify --clean"
37
38
  }
38
39
  }