From 78a6ffc070bcb24dbfe2e1ddfddcbafcbc799ba9 Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Wed, 18 Dec 2024 11:29:19 +0530 Subject: [PATCH] refactored access approach for env variables --- src/api/Auth.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/api/Auth.ts b/src/api/Auth.ts index 68efe5e8..66495987 100644 --- a/src/api/Auth.ts +++ b/src/api/Auth.ts @@ -221,7 +221,7 @@ export const addPasskeyUserDetails = async(payload: AddPassword, email:string) = } export const passwordEncryption = (password: string): string => { - const CRYPTO_PRIVATE_KEY: string = `${envConfig.PUBLIC_CRYPTO_PRIVATE_KEY}`; + const CRYPTO_PRIVATE_KEY: string = import.meta.env.PUBLIC_CRYPTO_PRIVATE_KEY; console.log("🚀 ~ passwordEncryption ~ CRYPTO_PRIVATE_KEY:", CRYPTO_PRIVATE_KEY) const encryptedPassword: string = CryptoJS.AES.encrypt(JSON.stringify(password), CRYPTO_PRIVATE_KEY).toString() return encryptedPassword @@ -229,9 +229,9 @@ export const passwordEncryption = (password: string): string => { export const encryptData = (value: any): string => { - console.log("All env variables:", envConfig); + console.log("All env variables:", import.meta.env); - const CRYPTO_PRIVATE_KEY: string = `${envConfig.PUBLIC_CRYPTO_PRIVATE_KEY}`; + const CRYPTO_PRIVATE_KEY: string = import.meta.env.PUBLIC_CRYPTO_PRIVATE_KEY; console.log("🚀 ~ encryptData ~ CRYPTO_PRIVATE_KEY:", CRYPTO_PRIVATE_KEY) try { @@ -247,7 +247,7 @@ export const encryptData = (value: any): string => { } export const decryptData = (value: any): string => { - const CRYPTO_PRIVATE_KEY: string = `${envConfig.PUBLIC_CRYPTO_PRIVATE_KEY}`; + const CRYPTO_PRIVATE_KEY: string = import.meta.env.PUBLIC_CRYPTO_PRIVATE_KEY; console.log("🚀 ~ decryptData ~ CRYPTO_PRIVATE_KEY:", CRYPTO_PRIVATE_KEY) try {