Skip to content

Commit

Permalink
Merge pull request #865 from credebl/develop-fixed-dco
Browse files Browse the repository at this point in the history
Sync changes from DEV to QA
  • Loading branch information
pranalidhanavade authored Jan 15, 2025
2 parents 1b48b66 + 90cdef2 commit ef7239a
Show file tree
Hide file tree
Showing 53 changed files with 850 additions and 820 deletions.
3 changes: 0 additions & 3 deletions .env.demo
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ PUBLIC_PLATFORM_NAME=CREDEBL
PUBLIC_PLATFORM_LOGO=/images/CREDEBL_ICON.png
PUBLIC_POWERED_BY=Blockster Labs Pvt. Ltd.
PUBLIC_PLATFORM_WEB_URL=https://credebl.id/
PUBLIC_POWERED_BY_URL=https://blockster.global
PUBLIC_PLATFORM_DOCS_URL=https://docs.credebl.id/en/intro/what-is-credebl/
PUBLIC_PLATFORM_GIT=https://github.com/credebl
[email protected]
PUBLIC_PLATFORM_SUPPORT_INVITE=
PUBLIC_PLATFORM_TWITTER_URL="https://twitter.com/i/flow/login?redirect_after_login=%2Fcredebl"
PUBLIC_PLATFROM_DISCORD_SUPPORT="https://discord.gg/w4hnQT7NJG"
PUBLIC_ALLOW_DOMAIN="http://your-ip:5000 http://localhost:5000 http://localhost:5001 http://your-ip:5001 https://cdnjs.cloudflare.com https://tailwindcss.com https://www.blockster.global https://www.ayanworks.com https://qaapi.credebl.id https://devapi.credebl.id https://api.credebl.id https://*.credebl.id https://fonts.googleapis.com https://fonts.gstatic.com https://avatars.githubusercontent.com https://dev-org-logo.s3.ap-south-1.amazonaws.com https://flowbite-admin-dashboard.vercel.app/ wss://devapi.credebl.id wss://qaapi.credebl.id wss://api.credebl.id wss://*.credebl.id https://qa.credebl.id https://dev.credebl.id https://credebl.id http://your-ip:3001 http://localhost:3001 http://localhost:3000/certificates ws://your-ip:5000 ws://localhost:5000 https://rpc-amoy.polygon.technology/"
2 changes: 0 additions & 2 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ PUBLIC_PLATFORM_NAME= # Please specify your paltform name
PUBLIC_PLATFORM_LOGO= # Please specify your logo file link
PUBLIC_POWERED_BY= # Please specify your powered by org name
PUBLIC_PLATFORM_WEB_URL= # Please specify your platform web URL
PUBLIC_POWERED_BY_URL= # Please specify your support URL
PUBLIC_PLATFORM_DOCS_URL= # Please specify your documentation URL
PUBLIC_PLATFORM_GIT= # Please specify your Github URL
PUBLIC_PLATFORM_SUPPORT_EMAIL= # Please specify your support email
PUBLIC_PLATFORM_TWITTER_URL= # Please specify your twitter URL
PUBLIC_PLATFROM_DISCORD_SUPPORT= # Please specify your discord support url

Expand Down
53 changes: 49 additions & 4 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Deploy develop branch to Deno
on:
push:
branches: develop
branches: develop-fixed-dco
pull_request:
branches: develop
branches: develop-fixed-dco

jobs:
deploy:
Expand All @@ -22,8 +22,53 @@ jobs:
with:
node-version: lts/*

- name: remove previous node module
run: rm -rf node_modules
- name: Create .env file

run: |
echo "PUBLIC_MODE=DEV" > .env
echo "PUBLIC_BASE_URL=${{ secrets.DEV_PUBLIC_BASE_URL }}" >> .env
echo "PUBLIC_SHOW_NAME_AS_LOGO=true" >> .env
echo "PUBLIC_PLATFORM_NAME=CREDEBL" >> .env
echo "PUBLIC_PLATFORM_LOGO=/images/CREDEBL_ICON.png" >> .env
echo "PUBLIC_POWERED_BY=Blockster Labs Pvt. Ltd" >> .env
echo "PUBLIC_PLATFORM_DOCS_URL=https://docs.credebl.id/docs" >> .env
echo "PUBLIC_PLATFORM_GIT=https://github.com/credebl" >> .env
echo "PUBLIC_PLATFORM_TWITTER_URL=https://twitter.com/i/flow/login?redirect_after_login=%2Fcredebl" >> .env
echo "PUBLIC_PLATFROM_DISCORD_SUPPORT=https://discord.gg/w4hnQT7NJG" >> .env
echo "PUBLIC_ALLOW_DOMAIN=${{ secrets.DEV_PUBLIC_ALLOW_DOMAIN }}" >> .env
echo "PUBLIC_POLYGON_MAINNET_URL=https://polygon-rpc.com/" >> .env
echo "PUBLIC_POLYGON_TESTNET_URL=https://rpc-amoy.polygon.technology" >> .env
echo "PUBLIC_ECOSYSTEM_FRONT_END_URL=https://dev-ecosystem.credebl.id" >> .env
echo "PUBLIC_CREDEBL_FRONT_END_URL=https://dev.credebl.id" >> .env
echo "PUBLIC_ECOSYSTEM_BASE_URL=${{ secrets.DEV_PUBLIC_ECOSYSTEM_BASE_URL }}" >> .env
echo "PUBLIC_PLATFORM_DISCORD_URL=https://discord.gg/w4hnQT7NJG" >> .env
echo "PUBLIC_REDIRECTION_TARGET_URL=https://social-share.credebl.id" >> .env
echo "PUBLIC_CRYPTO_PRIVATE_KEY=${{ secrets.DEV_PUBLIC_CRYPTO_PRIVATE_KEY }}" >> .env
echo "PUBLIC_KEYCLOAK_MANAGEMENT_CLIENT_ID=${{ secrets.DEV_PUBLIC_KEYCLOAK_MANAGEMENT_CLIENT_ID }}" >> .env
echo "PUBLIC_KEYCLOAK_MANAGEMENT_CLIENT_SECRET=${{ secrets.DEV_PUBLIC_KEYCLOAK_MANAGEMENT_CLIENT_SECRET }}" >> .env
echo "PUBLIC_REDIRECT_FROM_URL=https://dev.credebl.id" >> .env
- name: Build step
run: npm install && npm run build # 📝 Update the build command(s)
Expand Down
59 changes: 50 additions & 9 deletions .github/workflows/deploy-qa.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Deploy develop branch to Deno
on:
push:
branches: qa
branches: qa-fixed-dco
pull_request:
branches: qa
branches: qa-fixed-dco

jobs:
deploy:
Expand All @@ -17,18 +17,59 @@ jobs:
- name: Clone repository
uses: actions/checkout@v3


- name: Install Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x


- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: lts/*

- name: Create .env file

run: |
echo "PUBLIC_MODE=DEV" > .env
echo "PUBLIC_BASE_URL=${{ secrets.QA_PUBLIC_BASE_URL }}" >> .env
echo "PUBLIC_SHOW_NAME_AS_LOGO=true" >> .env
echo "PUBLIC_PLATFORM_NAME=CREDEBL" >> .env
echo "PUBLIC_PLATFORM_LOGO=/images/CREDEBL_ICON.png" >> .env
echo "PUBLIC_POWERED_BY=Blockster Labs Pvt. Ltd" >> .env
echo "PUBLIC_PLATFORM_DOCS_URL=https://docs.credebl.id/docs" >> .env
echo "PUBLIC_PLATFORM_GIT=https://github.com/credebl" >> .env
echo "PUBLIC_PLATFORM_TWITTER_URL=https://twitter.com/i/flow/login?redirect_after_login=%2Fcredebl" >> .env
echo "PUBLIC_PLATFROM_DISCORD_SUPPORT=https://discord.gg/w4hnQT7NJG" >> .env
echo "PUBLIC_ALLOW_DOMAIN=${{ secrets.QA_PUBLIC_ALLOW_DOMAIN }}" >> .env
echo "PUBLIC_POLYGON_MAINNET_URL=https://polygon-rpc.com/" >> .env
echo "PUBLIC_POLYGON_TESTNET_URL=https://rpc-amoy.polygon.technology" >> .env
echo "PUBLIC_ECOSYSTEM_FRONT_END_URL=https://qa-ecosystem.credebl.id" >> .env
echo "PUBLIC_CREDEBL_FRONT_END_URL=https://qa.credebl.id" >> .env
echo "PUBLIC_ECOSYSTEM_BASE_URL=${{ secrets.QA_PUBLIC_ECOSYSTEM_BASE_URL }}" >> .env
echo "PUBLIC_PLATFORM_DISCORD_URL=https://discord.gg/w4hnQT7NJG" >> .env
echo "PUBLIC_REDIRECTION_TARGET_URL=https://social-share.credebl.id" >> .env
echo "PUBLIC_CRYPTO_PRIVATE_KEY=${{ secrets.QA_PUBLIC_CRYPTO_PRIVATE_KEY }}" >> .env
echo "PUBLIC_KEYCLOAK_MANAGEMENT_CLIENT_ID=${{ secrets.QA_PUBLIC_KEYCLOAK_MANAGEMENT_CLIENT_ID }}" >> .env
echo "PUBLIC_KEYCLOAK_MANAGEMENT_CLIENT_SECRET=${{ secrets.QA_PUBLIC_KEYCLOAK_MANAGEMENT_CLIENT_SECRET }}" >> .env
echo "PUBLIC_REDIRECT_FROM_URL=https://qa.credebl.id" >> .env
- name: Build step
run: npm install && npm run build # 📝 Update the build command(s)

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Deploy
on:
push:
branches: qa-fixed-dco
branches: main
pull_request:
branches: qa-fixed-dco
branches: main

jobs:
deploy:
Expand Down Expand Up @@ -41,4 +41,4 @@ jobs:
entrypoint: "server/entry.mjs"
root: "dist"



8 changes: 4 additions & 4 deletions src/api/Auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,15 @@ 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;
const encryptedPassword: string = CryptoJS.AES.encrypt(JSON.stringify(password), CRYPTO_PRIVATE_KEY).toString()
return encryptedPassword
}

export const encryptData = (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;
try {
if (typeof (value) !== 'string') {
value = JSON.stringify(value)
Expand All @@ -243,7 +243,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;

try {
let bytes = CryptoJS.AES.decrypt(value, CRYPTO_PRIVATE_KEY);
Expand Down
20 changes: 19 additions & 1 deletion src/api/verification.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IssueCredential, RequestType } from '../common/enums';
import { APIVersion, type IssueCredential, type RequestType } from '../common/enums';
import { apiRoutes } from '../config/apiRoutes';
import { storageKeys } from '../config/CommonConstant';
import { getHeaderConfigs } from '../config/GetHeaderConfigs';
Expand All @@ -23,6 +23,24 @@ export const verifyCredential = async (payload: object, requestType:RequestType)
}
};


export const verifyCredentialV2 = async (payload: object, requestType:RequestType) => {
const orgId = await getFromLocalStorage(storageKeys.ORG_ID);
const url = `${APIVersion.version_v2}${apiRoutes.organizations.root}/${orgId}${apiRoutes.Verification.verifyCredential}?requestType=${requestType}`;
const axiosPayload = {
url,
payload,
config: await getHeaderConfigs(),
};

try {
return await axiosPost(axiosPayload);
} catch (error) {
const err = error as Error;
return err?.message;
}
};

export const createOobProofRequest = async (payload: object, requestType: RequestType) => {
const orgId = await getFromLocalStorage(storageKeys.ORG_ID);
const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Verification.oobProofRequest}?requestType=${requestType}`;
Expand Down
33 changes: 3 additions & 30 deletions src/app/LayoutCommon.astro
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
---
import pkg from '../../package.json' assert { type: 'json' };
import { getFromCookies } from '../api/Auth';
import { SITE_TITLE } from './constants.js';
import { envConfig } from '../config/envConfig';
const { class: clazz, metaData } = Astro.props;
const initData: any = {};
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');
---

<!DOCTYPE html>
Expand All @@ -34,12 +24,8 @@ const refreshToken = getFromCookies(Astro.cookies, 'refresh');

<link rel="preconnect" href="https://fonts.googleapis.com" crossorigin />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:[email protected]&display=swap"
rel="stylesheet"
/>

<meta property="og:image" content={initData.PUBLIC_PLATFORM_LOGO} />
<meta property="og:image" content={envConfig.PLATFORM_DATA.logo} />
<script is:inline id="theme">
if (
localStorage.getItem('color-theme') === 'dark' ||
Expand All @@ -55,8 +41,7 @@ const refreshToken = getFromCookies(Astro.cookies, 'refresh');

<body
class:list={[
,
// clazz, 'bg-gray-50 dark:bg-gray-800'
// clazz, 'bg-gray-50 dark:bg-gray-800',
'scrollbar scrollbar-w-3 scrollbar-thumb-rounded-[0.25rem]',
'scrollbar-track-slate-200 scrollbar-thumb-gray-400',
'dark:scrollbar-track-gray-900 dark:scrollbar-thumb-gray-700',
Expand All @@ -66,18 +51,6 @@ const refreshToken = getFromCookies(Astro.cookies, 'refresh');
<slot />
<script is:inline src="https://cdnjs.cloudflare.com/ajax/libs/flowbite/1.8.0/flowbite.min.js"></script>

<script
id="global"
define:vars={{ initData, envKeys, sessionToken, refreshToken }}
>
envKeys.forEach((item) => {
globalThis[item] = initData[item];
});

globalThis.access_token = sessionToken;
globalThis.refresh_token = refreshToken;
</script>

<style is:global>
body {
font-family: 'Inter', sans-serif;
Expand All @@ -100,4 +73,4 @@ const refreshToken = getFromCookies(Astro.cookies, 'refresh');
}
</style>
</body>
</html>
</html>
4 changes: 4 additions & 0 deletions src/common/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,8 @@ export enum Environment {
PROD = 'PROD',
DEV = 'DEV',
QA = 'QA'
}

export enum APIVersion {
version_v2 = '/v2'
}
29 changes: 0 additions & 29 deletions src/commonComponents/CustomCheckbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,10 @@ import type { ICustomCheckboxProps, ISchemaData } from './interface';

const CustomCheckbox: React.FC<ICustomCheckboxProps> = ({ showCheckbox, isVerificationUsingEmail, onChange, schemaData }) => {
const [checked, setChecked] = useState<boolean>(false);

useEffect(() => {
if (schemaData) {
try {
const selectedSchemas = JSON.parse(localStorage.getItem('selectedSchemas') ?? '[]');
const isChecked = selectedSchemas.some((schema: ISchemaData) => schema.schemaId === schemaData.schemaId);
setChecked(isChecked);
} catch (error) {
console.error('Error parsing JSON from localStorage:', error);
}
}
}, [schemaData]);

const handleCheckboxChange = async () => {
const newChecked = !checked;
setChecked(newChecked);
onChange(newChecked, schemaData);

try {
const selectedSchemas = JSON.parse(localStorage.getItem('selectedSchemas') ?? '[]');

if (newChecked) {
selectedSchemas.push(schemaData);
} else {
const index = selectedSchemas.findIndex((schema: ISchemaData) => schema.schemaId === schemaData?.schemaId);
if (index > -1) {
selectedSchemas.splice(index, 1);
}
}
await setToLocalStorage(storageKeys.SELECTED_SCHEMAS, JSON.stringify(selectedSchemas));
} catch (error) {
console.error('Error updating localStorage:', error);
}
};

return (
Expand Down
5 changes: 3 additions & 2 deletions src/commonComponents/QRcode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import domtoimage from 'dom-to-image';

const CustomQRCode = ({ value, size }: { value: string, size: number }) => {

const inputRef = useRef<HTMLInputElement>(null);
const node = document.createTextNode('');
const inputRef = useRef<Node>(node);
const [isCopied, setIsCopied] = useState(false);

function copyTextVal(e: React.MouseEvent<HTMLButtonElement>) {
Expand All @@ -24,7 +25,7 @@ const CustomQRCode = ({ value, size }: { value: string, size: number }) => {
}

const drawHtmlToCanvas = () => {
domtoimage.toJpeg(inputRef.current, { quality: 0.95 })
domtoimage.toJpeg(inputRef.current, { quality: 0.95 })
.then(function (dataUrl) {
var link = document.createElement('a');
link.download = 'my-image-name.jpeg';
Expand Down
Loading

0 comments on commit ef7239a

Please sign in to comment.