@@ -14,7 +14,7 @@ import { useTranslator } from "@/hooks/use-translations";
1414import axiosInstance from "@/libs/Middleware/axiosInstace" ;
1515import { hashData } from "@/libs/crypto" ;
1616import { encryptDataField } from "@/libs/encryption" ;
17- import { secureGetItem , decryptFromSessionStorage } from "@/libs/session -storage-utils" ;
17+ import { secureGetItem , decryptFromLocalStorage } from "@/libs/local -storage-utils" ;
1818import { Dialog , DialogContent , DialogDescription , DialogFooter , DialogHeader , DialogTitle } from "@/components/ui/dialog" ;
1919
2020interface AddApiKeyProps {
@@ -106,18 +106,18 @@ export function AddApiKey({ open, onOpenChange, onApiKeyAdded }: AddApiKeyProps)
106106 console . log ( "API key JSON prepared:" , apiKeyJson ) ;
107107
108108 // Get the current project keys from storage
109- console . log ( "All sessionStorage keys:" , Object . keys ( sessionStorage ) ) ;
109+ console . log ( "All localStorage keys:" , Object . keys ( localStorage ) ) ;
110110
111- // Direct access to session storage key - using project name
111+ // Direct access to localStorage key - using project name
112112 let effectiveProjectKey = projectKey ;
113113 if ( ! effectiveProjectKey && selectedProjectName ) {
114114 console . log ( "Project key not found in state, trying to load directly" ) ;
115- const rawProjectKey = sessionStorage . getItem ( `projectKey_${ selectedProjectName } ` ) ;
116- console . log ( "Raw project key from session storage :" , rawProjectKey ? `Found (${ rawProjectKey . length } chars)` : "Not found" ) ;
115+ const rawProjectKey = localStorage . getItem ( `projectKey_${ selectedProjectName } ` ) ;
116+ console . log ( "Raw project key from localStorage :" , rawProjectKey ? `Found (${ rawProjectKey . length } chars)` : "Not found" ) ;
117117
118118 // Try to decrypt it if found
119119 if ( rawProjectKey ) {
120- effectiveProjectKey = await decryptFromSessionStorage ( rawProjectKey ) ;
120+ effectiveProjectKey = await decryptFromLocalStorage ( rawProjectKey ) ;
121121 console . log ( "Decrypted project key:" , effectiveProjectKey ? "Found" : "Failed to decrypt" ) ;
122122 }
123123 }
0 commit comments