Skip to content

Commit

Permalink
Merge pull request #380 from credebl/fix-prod-dev-merge
Browse files Browse the repository at this point in the history
merge: dev to main
  • Loading branch information
nishad-ayanworks authored Oct 19, 2023
2 parents 6fe82b5 + b514b02 commit 61a7e6a
Show file tree
Hide file tree
Showing 132 changed files with 9,448 additions and 4,622 deletions.
638 changes: 227 additions & 411 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"socket.io-client": "^4.6.2",
"tailwind-scrollbar": "^3.0.4",
"tailwindcss": "^3.3.3",
"uuidv4": "^6.2.13",
"uuid": "^9.0.1",
"yup": "^1.2.0"
},
"devDependencies": {
Expand All @@ -75,6 +75,7 @@
"@types/downloadjs": "^1.4.3",
"@types/eslint": "^8.21.1",
"@types/secure-random-password": "^0.2.1",
"@types/uuid": "^9.0.3",
"@typescript-eslint/eslint-plugin": "^5.54.1",
"@typescript-eslint/parser": "^5.54.1",
"astro-eslint-parser": "^0.11.0",
Expand Down
Binary file added public/images/profile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/api/Agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { storageKeys } from "../config/CommonConstant";
export const getAgentHealth = async (orgId:number) => {
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: `${apiRoutes.Agent.checkAgentHealth}?orgId=${orgId}`,
url: `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Agent.checkAgentHealth}`,
config: {
headers: {
'Content-type': 'application/json',
Expand Down
35 changes: 11 additions & 24 deletions src/api/Auth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {axiosGet, axiosPost, axiosPut} from '../services/apiRequests'
import { number, string } from 'yup'

import type { AxiosError } from 'axios'
import CryptoJS from "crypto-js"
import { apiRoutes } from '../config/apiRoutes'
import { envConfig } from '../config/envConfig'
Expand All @@ -12,7 +9,8 @@ export interface UserSignUpData {
email: string,
}
export interface AddPasswordDetails {
password?:string
email:string
password:string
isPasskey:boolean
firstName: string|null
lastName: string|null
Expand Down Expand Up @@ -61,7 +59,7 @@ export const loginUser = async(payload: UserSignInData) => {

export const getUserProfile = async(accessToken: string) => {
const details = {
url: apiRoutes.auth.userProfile,
url: apiRoutes.users.userProfile,
config : { headers: { Authorization: `Bearer ${accessToken}` } }
}
try{
Expand Down Expand Up @@ -98,7 +96,6 @@ export const updateUserProfile = async(data: object ) => {
const err = error as Error
return err?.message
}

}

export const verifyUserMail = async(payload: EmailVerifyData ) => {
Expand All @@ -113,14 +110,12 @@ export const verifyUserMail = async(payload: EmailVerifyData ) => {
catch(error){
const err = error as Error
return err?.message
}


}
}

export const checkUserExist = async(payload: string) => {
const details ={
url:`${apiRoutes.auth.checkUser}${payload}`,
url:`${apiRoutes.users.checkUser}${payload}`,
config: { headers: { "Content-type": "application/json" } }
}
try{
Expand All @@ -130,15 +125,12 @@ export const checkUserExist = async(payload: string) => {
catch(error){
const err = error as Error
return err?.message
}


}
}

export const addPasswordDetails = async(payload: AddPasswordDetails, email:string) => {
// Api call to add password
export const addPasswordDetails = async(payload: AddPasswordDetails) => {
const details ={
url: `${apiRoutes.auth.addDetails}${email}`,
url: `${apiRoutes.auth.addDetails}`,
payload,
config: { headers: { "Content-type": "application/json" } }
}
Expand All @@ -149,9 +141,7 @@ export const addPasswordDetails = async(payload: AddPasswordDetails, email:strin
catch(error){
const err = error as Error
return err?.message
}


}
}

export const addPasskeyUserDetails = async(payload: AddPassword, email:string) => {
Expand All @@ -165,18 +155,15 @@ export const addPasskeyUserDetails = async(payload: AddPassword, email:string) =
}, }
}
try{
const response = await axiosPost(details)
const response = await axiosPut(details)
return response
}
catch(error){
const err = error as Error
return err?.message
}


}
}


export const passwordEncryption = (password: string): string => {
const CRYPTO_PRIVATE_KEY: string = `${envConfig.PUBLIC_CRYPTO_PRIVATE_KEY}`
const encryptedPassword: string = CryptoJS.AES.encrypt(JSON.stringify(password), CRYPTO_PRIVATE_KEY).toString()
Expand Down
29 changes: 15 additions & 14 deletions src/api/Fido.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import type { DeviceDetails, IdeviceBody, RegistrationOptionInterface, UserEmail, verifyRegistrationObjInterface } from "../components/Profile/interfaces"
import type { DeviceDetails, IdeviceBody, RegistrationOptionInterface, UserEmail, VerifyRegistrationObjInterface } from "../components/Profile/interfaces"
import { storageKeys } from "../config/CommonConstant"
import { apiRoutes } from "../config/apiRoutes"
import { axiosDelete, axiosGet, axiosPost, axiosPut } from "../services/apiRequests"
import { getFromLocalStorage } from "./Auth"

export const generateRegistrationOption = async (payload: RegistrationOptionInterface) => {
const email = payload.userName;
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: `${apiRoutes.fido.generateRegistration}`,
url: `${apiRoutes.auth.generateRegistration}/${email}`,
payload,
config: {
headers: {
Expand All @@ -27,10 +28,10 @@ export const generateRegistrationOption = async (payload: RegistrationOptionInte
}
}

export const verifyRegistration = async (payload:unknown, userEmail:string) => {
export const verifyRegistration = async (payload:VerifyRegistrationObjInterface, email:string) => {
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: `${apiRoutes.fido.verifyRegistration}${userEmail}`,
url: `${apiRoutes.auth.verifyRegistration}${email}`,
payload,
config: {
headers: {
Expand All @@ -51,9 +52,10 @@ export const verifyRegistration = async (payload:unknown, userEmail:string) => {
}

export const addDeviceDetails = async (payload: IdeviceBody) => {
const credentialId = payload.credentialId;
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: `${apiRoutes.fido.userUpdate}`,
url: `${apiRoutes.auth.userUpdate}/${credentialId}`,
payload,
config: {
headers: {
Expand All @@ -73,10 +75,10 @@ export const addDeviceDetails = async (payload: IdeviceBody) => {
}
}

export const getUserDeviceDetails = async(userEmail:string) => {
export const getUserDeviceDetails = async(email:string) => {
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: `${apiRoutes.fido.getDeviceList}${userEmail}`,
url: `${apiRoutes.auth.getDeviceList}${email}`,
config: {
headers: {
'Content-type': 'application/json',
Expand All @@ -95,10 +97,10 @@ export const getUserDeviceDetails = async(userEmail:string) => {
}
}

export const deleteDeviceById = async(enCodedUrl:string) => {
export const deleteDeviceById = async(credentialId:string) => {
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: `${apiRoutes.fido.fidoDevice}?credentialId=${enCodedUrl}`,
url: `${apiRoutes.auth.fidoDevice}/${credentialId}`,
config: {
headers: {
'Content-type': 'application/json',
Expand All @@ -120,7 +122,7 @@ export const deleteDeviceById = async(enCodedUrl:string) => {
export const generateAuthenticationOption = async (payload:UserEmail) => {
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: `${apiRoutes.fido.fidoAuthentication}`,
url: `${apiRoutes.auth.fidoAuthentication}`,
payload,
config: {
headers: {
Expand All @@ -140,11 +142,10 @@ export const generateAuthenticationOption = async (payload:UserEmail) => {
}
}

export const verifyAuthentication = async (payload: any, userEmail:UserEmail) => {
console.log("userEmail", userEmail)
export const verifyAuthentication = async (payload: VerifyRegistrationObjInterface, email: { userName: string }) => {
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: `${apiRoutes.fido.fidoVerifyAuthentication}${userEmail?.userName}`,
url: `${apiRoutes.auth.fidoVerifyAuthentication}${email.userName}`,
payload,
config: {
headers: {
Expand All @@ -167,7 +168,7 @@ export const verifyAuthentication = async (payload: any, userEmail:UserEmail) =>
export const editDeviceDetails = async (payload:DeviceDetails) => {
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: `${apiRoutes.fido.updateDeviceName}?credentialId=${payload.enCodedUrl}&deviceName=${payload.updatedDeviceName}`,
url: `${apiRoutes.auth.updateDeviceName}/${payload.enCodedUrl}?deviceName=${payload.updatedDeviceName}`,
payload,
config: {
headers: {
Expand Down
25 changes: 13 additions & 12 deletions src/api/Schema.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { GetAllSchemaListParameter, createCredDeffFieldName, createSchema } from "../components/Resources/Schema/interfaces";
import { axiosDelete, axiosGet, axiosPost } from "../services/apiRequests";
import { axiosGet, axiosPost } from "../services/apiRequests";

import { apiRoutes } from "../config/apiRoutes";
import { getFromLocalStorage } from "./Auth";
Expand All @@ -8,7 +8,7 @@ import { storageKeys } from "../config/CommonConstant";
export const getAllSchemas = async ({itemPerPage, page, allSearch }: GetAllSchemaListParameter) => {
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: `${apiRoutes.schema.getAllSchemaFromPlatform}?pageSize=${itemPerPage}&searchByText=${allSearch}&pageNumber=${page}`,
url: `${apiRoutes.Platform.getAllSchemaFromPlatform}?pageSize=${itemPerPage}&searchByText=${allSearch}&pageNumber=${page}`,
config: {
headers: {
'Content-type': 'application/json',
Expand All @@ -30,7 +30,7 @@ export const getAllSchemas = async ({itemPerPage, page, allSearch }: GetAllSchem
export const getAllSchemasByOrgId = async ({ search, itemPerPage, page }: GetAllSchemaListParameter, orgId: string) => {
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: `${apiRoutes.schema.getAll}?orgId=${orgId}&pageNumber=${page}&pageSize=${itemPerPage}&searchByText=${search}`,
url: `${apiRoutes.organizations.root}/${orgId}${apiRoutes.schema.getAll}?pageNumber=${page}&pageSize=${itemPerPage}&searchByText=${search}`,
config: {
headers: {
'Content-type': 'application/json',
Expand All @@ -49,10 +49,10 @@ export const getAllSchemasByOrgId = async ({ search, itemPerPage, page }: GetAll
}
}

export const addSchema = async (payload: createSchema) => {
export const addSchema = async (payload: createSchema, orgId: number) => {
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: apiRoutes.schema.create,
url: `${apiRoutes.organizations.root}/${orgId}${apiRoutes.schema.create}`,
payload,
config: {
headers: {
Expand All @@ -72,10 +72,10 @@ export const addSchema = async (payload: createSchema) => {
}
}

export const getSchemaById = async (id: string, orgId: number) => {
export const getSchemaById = async (schemaId: string, orgId: number) => {
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: `${apiRoutes.schema.getSchemaById}?schemaId=${id}&orgId=${orgId}`,
url: `${apiRoutes.organizations.root}/${orgId}${apiRoutes.schema.getSchemaById}/${schemaId}`,
config: {
headers: {
'Content-type': 'application/json',
Expand All @@ -94,10 +94,10 @@ export const getSchemaById = async (id: string, orgId: number) => {
}
}

export const createCredentialDefinition = async (payload: createCredDeffFieldName) => {
export const createCredentialDefinition = async (payload: createCredDeffFieldName, orgId:number) => {
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: apiRoutes.schema.createCredentialDefinition,
url: `${apiRoutes.organizations.root}/${orgId}${apiRoutes.schema.createCredentialDefinition}`,
payload,
config: {
headers: {
Expand All @@ -118,10 +118,10 @@ export const createCredentialDefinition = async (payload: createCredDeffFieldNam
}
}

export const getCredDeffById = async (id: string, orgId: number) => {
export const getCredDeffById = async (schemaId: string, orgId: number) => {
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: `${apiRoutes.schema.getCredDeffBySchemaId}?schemaId=${id}&orgId=${orgId}`,
url: `${apiRoutes.organizations.root}/${orgId}${apiRoutes.schema.getCredDefBySchemaId}/${schemaId}/cred-defs`,
config: {
headers: {
'Content-type': 'application/json',
Expand All @@ -138,4 +138,5 @@ export const getCredDeffById = async (id: string, orgId: number) => {
const err = error as Error
return err?.message
}
}
}

2 changes: 1 addition & 1 deletion src/api/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getFromLocalStorage } from './Auth';

export const getConnectionsByOrg = async () => {
const orgId = await getFromLocalStorage(storageKeys.ORG_ID);
const url = `${apiRoutes.Issuance.getAllConnections}?orgId=${orgId}`;
const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Issuance.getAllConnections}`;
const axiosPayload = {
url,
config: await getHeaderConfigs(),
Expand Down
Loading

0 comments on commit 61a7e6a

Please sign in to comment.