From 5e2c69e75795170bac33be7edce64dd8855e196a Mon Sep 17 00:00:00 2001 From: Ajay Jadhav Date: Tue, 19 Mar 2024 17:37:48 +0530 Subject: [PATCH 01/13] Create DMP_2024.yml Signed-off-by: Ajay Jadhav --- .github/ISSUE_TEMPLATE /DMP_2024.yml | 267 +++++++++++++++++++++++++++ 1 file changed, 267 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE /DMP_2024.yml diff --git a/.github/ISSUE_TEMPLATE /DMP_2024.yml b/.github/ISSUE_TEMPLATE /DMP_2024.yml new file mode 100644 index 000000000..2b147944a --- /dev/null +++ b/.github/ISSUE_TEMPLATE /DMP_2024.yml @@ -0,0 +1,267 @@ +name: DMP 2024 Project Template +description: List a new project for Dedicated Mentoring Program (DMP) 2024 +title: "[DMP 2024]: " +labels: ["DMP 2024"] +body: + - type: textarea + id: ticket-description + validations: + required: true + attributes: + label: Ticket Contents + value: | + ## Description + [Provide a brief description of the feature, including why it is needed and what it will accomplish.] + + - type: textarea + id: ticket-goals + validations: + required: true + attributes: + label: Goals & Mid-Point Milestone + description: List the goals of the feature. Please add the goals that must be achieved by Mid-point check-in i.e 1.5 months into the coding period. + value: | + ## Goals + - [ ] [Goal 1] + - [ ] [Goal 2] + - [ ] [Goal 3] + - [ ] [Goal 4] + - [ ] [Goals Achieved By Mid-point Milestone] + + - type: textarea + id: ticket-setup + attributes: + label: Setup/Installation + description: Please list or link setup or installation guide (if any) + + - type: textarea + id: ticket-expected-outcome + attributes: + label: Expected Outcome + description: Describe in detail what the final product or result should look like and how it should behave. + + - type: textarea + id: ticket-acceptance-criteria + attributes: + label: Acceptance Criteria + description: List the acceptance criteria for this feature. + + - type: textarea + id: ticket-implementation-details + validations: + required: true + attributes: + label: Implementation Details + description: List any technical details about the proposed implementation, including any specific technologies that will be used. + + - type: textarea + id: ticket-mockups + attributes: + label: Mockups/Wireframes + description: Include links to any visual aids, mockups, wireframes, or diagrams that help illustrate what the final product should look like. This is not always necessary, but can be very helpful in many cases. + + - type: input + id: ticket-product + attributes: + label: Product Name + placeholder: Enter Product Name + validations: + required: true + + - type: dropdown + id: ticket-organisation + attributes: + label: Organisation Name + description: Enter Organisation Name + multiple: false + options: + - Bandhu + - Blockster Labs (CREDEBL) + - Civis + - Dhwani + - Dhiway + - EGov + - EkShop Marketplace + - FIDE + - If Me + - Key Education Foundation + - Norwegian Meteorological Institute + - Planet Read + - Project Second Chance + - Reap Benefit + - SamagraX + - ShikshaLokam + - Tech4Dev + - Tekdi + - The Mifos Initiative + - Tibil + - Ushahidi + - Arghyam + - Piramal Swasthya Management Research Institute + validations: + required: true + + - type: dropdown + id: ticket-governance-domain + attributes: + label: Domain + options: + - ⁠Healthcare + - ⁠Education + - Financial Inclusion + - ⁠Livelihoods + - ⁠Skilling + - ⁠Learning & Development + - ⁠Agriculture + - ⁠Service Delivery + - Open Source Library + - Water + - Identity & Digital Credentialing + validations: + required: true + + + - type: dropdown + id: ticket-technical-skills-required + attributes: + label: Tech Skills Needed + description: Select the technologies needed for this ticket (use Ctrl or Command to select multiple) + multiple: true + options: + - .NET + - Angular + - Artificial Intelligence + - ASP.NET + - Astro.js + - AWS + - Babel + - Bootstrap + - C# + - Chart.js + - CI/CD + - Computer Vision + - CORS + - cURL + - Cypress + - D3.js + - Database + - Debugging + - Deno + - Design + - DevOps + - Django + - Docker + - Electron + - ESLint + - Express.js + - Feature + - Flask + - Go + - GraphQL + - HTML + - Ionic + - Jest + - Java + - JavaScript + - Jenkins + - JWT + - Kubernetes + - Laravel + - Machine Learning + - Maintenance + - Markdown + - Material-UI + - Microservices + - MongoDB + - Mobile + - Mockups + - Mocha + - Natural Language Processing + - NATS Messaging + - NestJS + - Next.js + - Node.js + - NUnit + - OAuth + - Performance Improvement + - Prettier + - Python + - Question + - React + - React Native + - Redux + - RESTful APIs + - Ruby + - Ruby on Rails + - Rust + - Scala + - Security + - Selenium + - SEO + - Serverless + - Solidity + - Spring Boot + - SQL + - Swagger + - Tailwind CSS + - Test + - Testing Library + - Three.js + - TypeScript + - UI/UX/Design + - Virtual Reality + - Vue.js + - WebSockets + - Webpack + - Other + validations: + required: true + + - type: textarea + id: ticket-mentors + attributes: + label: Mentor(s) + description: Please tag relevant mentors for the ticket + validations: + required: true + + - type: dropdown + id: ticket-category + attributes: + label: Category + description: Choose the categories that best describe your ticket + multiple: true + options: + - API + - Analytics + - Accessibility + - Backend + - Breaking Change + - Beginner Friendly + - Configuration + - CI/CD + - Database + - Data Science + - Deprecation + - Documentation + - Delpoyment + - Frontend + - Internationalization + - Localization + - Machine Learning + - Maintenance + - Mobile + - Performance Improvement + - Question + - Refactoring + - Research + - Needs Reproduction + - SEO + - Security + - Testing + - AI + - Other + validations: + required: true + + From dc5d6a4e23e9efdf5aea1dd0ae7765e9be297410 Mon Sep 17 00:00:00 2001 From: Sai Ranjit Tummalapalli Date: Tue, 19 Mar 2024 17:55:09 +0530 Subject: [PATCH 02/13] Update and rename DMP_2024.yml to DMP_2024.yml Signed-off-by: Sai Ranjit Tummalapalli --- .../DMP_2024.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) rename .github/{ISSUE_TEMPLATE => ISSUE_TEMPLATE}/DMP_2024.yml (97%) diff --git a/.github/ISSUE_TEMPLATE /DMP_2024.yml b/.github/ISSUE_TEMPLATE/DMP_2024.yml similarity index 97% rename from .github/ISSUE_TEMPLATE /DMP_2024.yml rename to .github/ISSUE_TEMPLATE/DMP_2024.yml index 2b147944a..89452adc0 100644 --- a/.github/ISSUE_TEMPLATE /DMP_2024.yml +++ b/.github/ISSUE_TEMPLATE/DMP_2024.yml @@ -1,7 +1,7 @@ name: DMP 2024 Project Template -description: List a new project for Dedicated Mentoring Program (DMP) 2024 -title: "[DMP 2024]: " -labels: ["DMP 2024"] +description: List a new project for Dedicated Mentoring Program (DMP) 2024 +title: '[DMP 2024]: ' +labels: ['DMP 2024'] body: - type: textarea id: ticket-description @@ -31,7 +31,7 @@ body: - type: textarea id: ticket-setup attributes: - label: Setup/Installation + label: Setup/Installation description: Please list or link setup or installation guide (if any) - type: textarea @@ -106,11 +106,11 @@ body: attributes: label: Domain options: - - ⁠Healthcare + - ⁠Healthcare - ⁠Education - Financial Inclusion - ⁠Livelihoods - - ⁠Skilling + - ⁠Skilling - ⁠Learning & Development - ⁠Agriculture - ⁠Service Delivery @@ -120,7 +120,6 @@ body: validations: required: true - - type: dropdown id: ticket-technical-skills-required attributes: @@ -227,7 +226,7 @@ body: - type: dropdown id: ticket-category - attributes: + attributes: label: Category description: Choose the categories that best describe your ticket multiple: true @@ -244,7 +243,7 @@ body: - Data Science - Deprecation - Documentation - - Delpoyment + - Deployment - Frontend - Internationalization - Localization @@ -263,5 +262,3 @@ body: - Other validations: required: true - - From 26458d7babc4332876f4f4fb0047ec4c5cdf3613 Mon Sep 17 00:00:00 2001 From: Nishad Shirsat <103021375+nishad-ayanworks@users.noreply.github.com> Date: Wed, 20 Mar 2024 16:28:34 +0530 Subject: [PATCH 03/13] develop to qa (#632) * feat: support multiple did methods Signed-off-by: bhavanakarwade * fix: sonarcloud issues Signed-off-by: pranalidhanavade * fix: sonarlint issues Signed-off-by: pranalidhanavade * fix: resolved sonarlint issues Signed-off-by: pranalidhanavade * feat: support multiple did methods (#620) * feat: support multiple did methods Signed-off-by: bhavanakarwade * fix: sonarcloud issues Signed-off-by: pranalidhanavade * fix: sonarlint issues Signed-off-by: pranalidhanavade * fix: resolved sonarlint issues Signed-off-by: pranalidhanavade --------- Signed-off-by: bhavanakarwade Signed-off-by: pranalidhanavade Co-authored-by: pranalidhanavade * fix: resolved sonarcloud issues Signed-off-by: pranalidhanavade * Worked on the refresh token implementation Signed-off-by: Nishad * removed unnecessary encryption while storing token in cookies Signed-off-by: Nishad * cosmetic changes Signed-off-by: Nishad * feat: did web functionality Signed-off-by: bhavanakarwade * Handled the error validations in encrypt and decrypt of data Signed-off-by: Nishad * refactored auth.ts for encrypt and decrypt data Signed-off-by: Nishad * refactoring in wallet spinup Signed-off-by: Nishad * cosmetic changes in wallet spinup Signed-off-by: Nishad * cosmetic changesin Field Signed-off-by: Nishad --------- Signed-off-by: bhavanakarwade Signed-off-by: pranalidhanavade Signed-off-by: Nishad Co-authored-by: bhavanakarwade Co-authored-by: pranalidhanavade Co-authored-by: bhavanakarwade <137506897+bhavanakarwade@users.noreply.github.com> --- src/api/Agent.ts | 46 +- src/api/Auth.ts | 41 +- src/app/LayoutCommon.astro | 12 +- src/common/enums.ts | 7 + src/commonComponents/CopyDid.tsx | 6 +- .../Authentication/SignInUserPasskey.tsx | 1 + .../Authentication/SignInUserPassword.tsx | 1 + src/components/organization/Dashboard.tsx | 2 +- .../organization/OrganizationDetails.tsx | 390 ++++---- src/components/organization/WalletSpinup.tsx | 931 +++++++++++++----- .../organization/interfaces/index.ts | 1 + .../GenerateBtnPolygon.tsx | 26 + .../LegderLessMethods.tsx | 70 ++ .../SetDomainValueInput.tsx | 29 + .../SetPrivateKeyValue.tsx | 29 + .../TokenWarningMessage.tsx | 22 + src/config/CommonConstant.ts | 1 + src/config/apiRoutes.ts | 5 +- src/pages/api/auth/signin.ts | 5 +- src/pages/api/auth/signout.ts | 3 + src/services/axiosIntercepter.ts | 23 +- src/utils/check-session.ts | 39 +- 22 files changed, 1243 insertions(+), 447 deletions(-) create mode 100644 src/components/organization/walletCommonComponents/GenerateBtnPolygon.tsx create mode 100644 src/components/organization/walletCommonComponents/LegderLessMethods.tsx create mode 100644 src/components/organization/walletCommonComponents/SetDomainValueInput.tsx create mode 100644 src/components/organization/walletCommonComponents/SetPrivateKeyValue.tsx create mode 100644 src/components/organization/walletCommonComponents/TokenWarningMessage.tsx diff --git a/src/api/Agent.ts b/src/api/Agent.ts index 81bbc687e..e2312aaef 100644 --- a/src/api/Agent.ts +++ b/src/api/Agent.ts @@ -1,8 +1,52 @@ -import { axiosGet } from "../services/apiRequests"; +import { axiosGet, axiosPost } from "../services/apiRequests"; import { apiRoutes } from "../config/apiRoutes"; import { getFromLocalStorage } from "./Auth"; import { storageKeys } from "../config/CommonConstant"; +export const getLedgerConfig = async () => { + const token = await getFromLocalStorage(storageKeys.TOKEN) + const details = { + url: `${apiRoutes.organizations.root}${apiRoutes.Agent.getLedgerConfig}`, + config: { + headers: { + 'Content-type': 'application/json', + 'Authorization': `Bearer ${token}`, + }, + }, + }; + + try { + const response = await axiosGet(details) + return response + } + catch (error) { + const err = error as Error + return err?.message + } +} + +export const createPolygonKeyValuePair = async (orgId:string) => { + const token = await getFromLocalStorage(storageKeys.TOKEN) + const details = { + url: `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Agent.createPolygonKeys}`, + config: { + headers: { + 'Content-type': 'application/json', + 'Authorization': `Bearer ${token}`, + }, + }, + }; + + try { + const response = await axiosPost(details) + return response + } + catch (error) { + const err = error as Error + return err?.message + } +} + export const getAgentHealth = async (orgId:string) => { const token = await getFromLocalStorage(storageKeys.TOKEN) const details = { diff --git a/src/api/Auth.ts b/src/api/Auth.ts index bbb9087ca..52239ccce 100644 --- a/src/api/Auth.ts +++ b/src/api/Auth.ts @@ -225,19 +225,38 @@ export const passwordEncryption = (password: string): string => { } export const encryptData = (value: any): string => { - if(typeof(value) !== 'string'){ - value = JSON.stringify(value) - } + const CRYPTO_PRIVATE_KEY: string = `${envConfig.PUBLIC_CRYPTO_PRIVATE_KEY}` - const convrtedValue: string = CryptoJS.AES.encrypt(value, CRYPTO_PRIVATE_KEY).toString() - return convrtedValue + + try { + const encJson: string = CryptoJS.AES.encrypt(JSON.stringify(value), CRYPTO_PRIVATE_KEY).toString(); + let encData = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(encJson)) + + return encData; + } catch (error) { + // Handle encryption error + console.error('Encryption error:', error); + return ''; + } } export const decryptData = (value: any): string => { const CRYPTO_PRIVATE_KEY: string = `${envConfig.PUBLIC_CRYPTO_PRIVATE_KEY}` - const bytes = CryptoJS.AES.decrypt(value, CRYPTO_PRIVATE_KEY) - var originalValue: string = bytes.toString(CryptoJS.enc.Utf8); - return originalValue + + try { + + let decData = CryptoJS.enc.Base64.parse(value).toString(CryptoJS.enc.Utf8) + let bytes = CryptoJS.AES.decrypt(decData, CRYPTO_PRIVATE_KEY).toString(CryptoJS.enc.Utf8) + const parsedData = JSON.parse(bytes); + if (typeof parsedData !== 'string') { + return JSON.stringify(parsedData); + } + return parsedData; + } catch (error) { + // Handle decryption error or invalid input + console.error('Decryption error:', error); + return ''; + } } export const setToLocalStorage = async (key: string, value: any) =>{ @@ -273,7 +292,6 @@ export const setToCookies = (cookies: AstroCookies, key: string, value: any, opt return; } - const convertedValue = encryptData(value) // Set HttpOnly, Secure, and SameSite attributes in the options const updatedOption: { [key: string]: any }= { ...option, @@ -281,15 +299,14 @@ export const setToCookies = (cookies: AstroCookies, key: string, value: any, opt secure: true, // Set to true if using HTTPS sameSite: 'Strict', }; - cookies.set(key, convertedValue as string, updatedOption) + cookies.set(key, value as string, updatedOption) return true } export const getFromCookies = (cookies: AstroCookies, key: string) =>{ const value = cookies.get(key).value - const convertedValue = value ? decryptData(value) : '' - return convertedValue + return value } export const removeFromLocalStorage = async (key: string) => { diff --git a/src/app/LayoutCommon.astro b/src/app/LayoutCommon.astro index 502ded50e..785356b56 100644 --- a/src/app/LayoutCommon.astro +++ b/src/app/LayoutCommon.astro @@ -2,7 +2,7 @@ import pkg from '../../package.json' assert { type: 'json' }; import HelmetHead from '../components/HelmetHead'; import { url } from '../lib/data.js'; - +import { getFromCookies } from '../api/Auth'; import { SITE_TITLE } from './constants.js'; const { class: clazz, metaData } = Astro.props; @@ -13,6 +13,10 @@ const envKeys = [...Object.keys(process.env), ...Object.keys(import.meta.env)]; envKeys.forEach((item) => { initData[item] = process.env[item] || import.meta.env[item]; }); + +const sessionToken = getFromCookies(Astro.cookies, 'session'); +const refreshToken = getFromCookies(Astro.cookies, 'refresh'); + --- @@ -56,11 +60,15 @@ envKeys.forEach((item) => { import 'flowbite'; import 'flowbite/dist/datepicker.js'; -