Skip to content

Commit

Permalink
merge: DEV to QA (#951)
Browse files Browse the repository at this point in the history
* refactor: applied validations on issuance date  (#934)

* fix: fetch schema details

Signed-off-by: bhavanakarwade <[email protected]>

* fix: applied validations for issuance using connection

Signed-off-by: bhavanakarwade <[email protected]>

---------

Signed-off-by: bhavanakarwade <[email protected]>

* fix: encrypt clientId and client secret

Signed-off-by: KulkarniShashank <[email protected]>

* fix:collect reuse connection events

Signed-off-by: pallavicoder <[email protected]>

* feat: reuse connection usinginvitation DID (#940)

Signed-off-by: tipusinghaw <[email protected]>

* fix: unable to use platform archieved schema

Signed-off-by: Krishna Waske <[email protected]>

* fix: solved the clientId dcryption in verification email

Signed-off-by: KulkarniShashank <[email protected]>

* feat: basic message (#848)

* WIP : Implementation of basic message protocol wrapper

Signed-off-by: Ankita Patidar <[email protected]>

* feat: basic message

Signed-off-by: tipusinghaw <[email protected]>

* changed response message

Signed-off-by: tipusinghaw <[email protected]>

* fix: sonar lint

Signed-off-by: tipusinghaw <[email protected]>

* fix: seperated URL creation logic

Signed-off-by: tipusinghaw <[email protected]>

* fix: changed error message

Signed-off-by: tipusinghaw <[email protected]>

---------

Signed-off-by: Ankita Patidar <[email protected]>
Signed-off-by: tipusinghaw <[email protected]>
Co-authored-by: Ankita Patidar <[email protected]>

* refactor: fetch proof details function (#943)

* fix: fetch schema details

Signed-off-by: bhavanakarwade <[email protected]>

* fix: applied validations for issuance using connection

Signed-off-by: bhavanakarwade <[email protected]>

* fix: multiple schemas in verified proof details api

Signed-off-by: bhavanakarwade <[email protected]>

* refactor: description

Signed-off-by: bhavanakarwade <[email protected]>

---------

Signed-off-by: bhavanakarwade <[email protected]>

* fix: basic message url (#944)

Signed-off-by: tipusinghaw <[email protected]>

* fix: add no_ledger type in seed file

Signed-off-by: KulkarniShashank <[email protected]>

* feat: migration logic for `org_dids` and schema type (#946)

* feat:migration script for did list

Signed-off-by: tipusinghaw <[email protected]>

* feat:schema support for W3C

Signed-off-by: tipusinghaw <[email protected]>

---------

Signed-off-by: tipusinghaw <[email protected]>

* fix: migration did for organization DIDs (#948)

* feat:migration script for did list

Signed-off-by: tipusinghaw <[email protected]>

* feat:schema support for W3C

Signed-off-by: tipusinghaw <[email protected]>

* fix: validation for null and empty string for did migration

Signed-off-by: tipusinghaw <[email protected]>

---------

Signed-off-by: tipusinghaw <[email protected]>

* fix: changed message pattern for basic-message (#950)

* feat:migration script for did list

Signed-off-by: tipusinghaw <[email protected]>

* feat:schema support for W3C

Signed-off-by: tipusinghaw <[email protected]>

* fix: validation for null and empty string for did migration

Signed-off-by: tipusinghaw <[email protected]>

* fix: changed message pattern for basic message

Signed-off-by: tipusinghaw <[email protected]>

---------

Signed-off-by: tipusinghaw <[email protected]>

* feat: reuse connection for issuance (#949)

* feat: reuse connection for issuance

Signed-off-by: bhavanakarwade <[email protected]>

* refactor: property name

Signed-off-by: bhavanakarwade <[email protected]>

* refactor: argument name

Signed-off-by: bhavanakarwade <[email protected]>

* refactor: dto name

Signed-off-by: bhavanakarwade <[email protected]>

* fix: added certificate template

Signed-off-by: bhavanakarwade <[email protected]>

---------

Signed-off-by: bhavanakarwade <[email protected]>

---------

Signed-off-by: bhavanakarwade <[email protected]>
Signed-off-by: KulkarniShashank <[email protected]>
Signed-off-by: pallavicoder <[email protected]>
Signed-off-by: tipusinghaw <[email protected]>
Signed-off-by: Krishna Waske <[email protected]>
Signed-off-by: Ankita Patidar <[email protected]>
Co-authored-by: Ganesh Nawle <[email protected]>
Co-authored-by: KulkarniShashank <[email protected]>
Co-authored-by: pallavicoder <[email protected]>
Co-authored-by: Shashank Kulkarni <[email protected]>
Co-authored-by: pallavighule <[email protected]>
Co-authored-by: tipusinghaw <[email protected]>
Co-authored-by: Krishna Waske <[email protected]>
Co-authored-by: Krishna <[email protected]>
Co-authored-by: Ankita Patidar <[email protected]>
Signed-off-by: KulkarniShashank <[email protected]>
  • Loading branch information
10 people committed Sep 12, 2024
1 parent 45f4bfe commit 49b0d8e
Show file tree
Hide file tree
Showing 10 changed files with 117 additions and 14 deletions.
8 changes: 4 additions & 4 deletions apps/agent-service/src/agent-service.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1937,13 +1937,13 @@ export class AgentServiceService {
}
}

async sendBasicMessage(questionPayload: IBasicMessage, url: string, orgId: string): Promise<object> {
async sendBasicMessage(messagePayload: IBasicMessage, url: string, orgId: string): Promise<object> {
try {
const getApiKey = await this.getOrgAgentApiKey(orgId);
const sendQuestionRes = await this.commonService
.httpPost(url, questionPayload, { headers: { authorization: getApiKey } })
const basicMessageRes = await this.commonService
.httpPost(url, messagePayload, { headers: { authorization: getApiKey } })
.then(async (response) => response);
return sendQuestionRes;
return basicMessageRes;
} catch (error) {
this.logger.error(`Error in sendBasicMessage in agent service : ${JSON.stringify(error)}`);
throw error;
Expand Down
2 changes: 1 addition & 1 deletion apps/api-gateway/src/connection/connection.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ export class ConnectionController {
}

@Post('/orgs/:orgId/basic-message/:connectionId')
@ApiOperation({ summary: '', description: 'send question' })
@ApiOperation({ summary: 'Send basic message', description: 'Send basic message' })
@UseGuards(AuthGuard('jwt'), OrgRolesGuard)
@Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.ISSUER, OrgRoles.VERIFIER, OrgRoles.MEMBER, OrgRoles.HOLDER, OrgRoles.SUPER_ADMIN, OrgRoles.PLATFORM_ADMIN)
@ApiResponse({ status: HttpStatus.CREATED, description: 'Created', type: ApiResponseDto })
Expand Down
2 changes: 1 addition & 1 deletion apps/api-gateway/src/connection/connection.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class ConnectionService extends BaseService {
basicMessageDto: BasicMessageDto
): Promise<object> {
try {
return this.sendNatsMessage(this.connectionServiceProxy, 'send-basic-message', basicMessageDto);
return this.sendNatsMessage(this.connectionServiceProxy, 'send-basic-message-on-connection', basicMessageDto);
} catch (error) {
throw new RpcException(error.response);
}
Expand Down
11 changes: 11 additions & 0 deletions apps/api-gateway/src/issuance/dtos/issuance.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,17 @@ export class OOBCredentialDtoWithEmail {
@IsOptional()
credentialType: IssueCredentialType;

@ApiPropertyOptional({ default: true })
@IsOptional()
@IsNotEmpty({ message: 'please provide valid value for isReuseConnection' })
@IsBoolean({ message: 'isReuseConnection must be a boolean' })
isReuseConnection?: boolean;

imageUrl?: string;

orgId: string;
}

export class PreviewFileDetails {
@ApiProperty({ required: false, example: '1' })
@IsOptional()
Expand Down
2 changes: 1 addition & 1 deletion apps/connection/src/connection.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class ConnectionController {
return this.connectionService.deleteConnectionRecords(orgId, userDetails);
}

@MessagePattern({ cmd: 'send-basic-message' })
@MessagePattern({ cmd: 'send-basic-message-on-connection' })
async sendBasicMessage(payload: {content: string, orgId: string, connectionId: string}): Promise<object> {
return this.connectionService.sendBasicMesage(payload);
}
Expand Down
1 change: 1 addition & 0 deletions apps/issuance/interfaces/issuance.interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ export interface IQueuePayload{
certificate?: string;
size?: string;
orientation?: string;
isReuseConnection?: boolean;
}

interface FileDetails {
Expand Down
17 changes: 14 additions & 3 deletions apps/issuance/src/issuance.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -659,12 +659,22 @@ async sendEmailForCredentialOffer(sendEmailCredentialOffer: SendEmailCredentialO
orgId,
organizationDetails,
platformName,
organizationLogoUrl
organizationLogoUrl,
isReuseConnection
} = sendEmailCredentialOffer;
const iterationNo = index + 1;
try {


let invitationDid: string | undefined;
if (true === isReuseConnection) {
const data: agent_invitations[] = await this.issuanceRepository.getInvitationDidByOrgId(orgId);
if (data && 0 < data.length) {
const [firstElement] = data;
invitationDid = firstElement?.invitationDid ?? undefined;
}
}

let outOfBandIssuancePayload;
if (IssueCredentialType.INDY === credentialType) {

Expand Down Expand Up @@ -1479,8 +1489,8 @@ return newCacheKey;
schemaLedgerId,
credentialData: jobDetails.credential_data,
orgDid,
orgId

orgId,
isReuseConnection: true
};

prettyVc = {
Expand All @@ -1491,6 +1501,7 @@ return newCacheKey;

oobIssuancepayload = await createOobJsonldIssuancePayload(JsonldCredentialDetails, prettyVc);
}

const oobCredentials = await this.outOfBandCredentialOffer(
oobIssuancepayload, jobDetails?.platformName, jobDetails?.organizationLogoUrl, prettyVc);
if (oobCredentials) {
Expand Down
6 changes: 6 additions & 0 deletions apps/verification/src/verification.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,12 @@ export class VerificationService {

const verifiableCredential = verifiableCredentials[index]?.credentialSubject;

if (getProofPresentationById?.response) {
certificate =
getProofPresentationById?.response?.presentation?.presentationExchange?.verifiableCredential[0].prettyVc
?.certificate;
}

if (
requestedAttributesForPresentationExchangeFormat &&
Array.isArray(requestedAttributesForPresentationExchangeFormat)
Expand Down
5 changes: 3 additions & 2 deletions libs/common/src/cast.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export const validateEmail = (email: string): boolean => {

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type
export const createOobJsonldIssuancePayload = (JsonldCredentialDetails: IJsonldCredential, prettyVc: IPrettyVc) => {
const {credentialData, orgDid, orgId, schemaLedgerId, schemaName} = JsonldCredentialDetails;
const {credentialData, orgDid, orgId, schemaLedgerId, schemaName, isReuseConnection} = JsonldCredentialDetails;
const credentialSubject = { };

for (const key in credentialData) {
Expand Down Expand Up @@ -236,7 +236,8 @@ export const createOobJsonldIssuancePayload = (JsonldCredentialDetails: IJsonldC
'comment': 'string',
'protocolVersion': 'v2',
'credentialType': 'jsonld',
orgId
orgId,
isReuseConnection
};
};

Expand Down
77 changes: 75 additions & 2 deletions libs/prisma-service/prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,81 @@ const createUserRole = async (): Promise<void> => {
}
};

const migrateOrgAgentDids = async (): Promise<void> => {
try {
const orgAgents = await prisma.org_agents.findMany({
where: {
walletName: {
not: 'platform-admin'
}
}
});

const orgDids = orgAgents.map((agent) => agent.orgDid).filter((did) => null !== did && '' !== did);
const existingDids = await prisma.org_dids.findMany({
where: {
did: {
in: orgDids
}
}
});

// If there are org DIDs that do not exist in org_dids table
if (orgDids.length !== existingDids.length) {
const newOrgAgents = orgAgents.filter(
(agent) => !existingDids.some((did) => did.did === agent.orgDid)
);

const newDidRecords = newOrgAgents.map((agent) => ({
orgId: agent.orgId,
did: agent.orgDid,
didDocument: agent.didDocument,
isPrimaryDid: true,
createdBy: agent.createdBy,
lastChangedBy: agent.lastChangedBy,
orgAgentId: agent.id
}));

const didInsertResult = await prisma.org_dids.createMany({
data: newDidRecords
});

logger.log(didInsertResult);
} else {
logger.log('No new DIDs to migrate in migrateOrgAgentDids');
}
} catch (error) {
logger.error('An error occurred during migrateOrgAgentDids:', error);
}
};

const addSchemaType = async (): Promise<void> => {
try {
const emptyTypeSchemaList = await prisma.schema.findMany({
where: {
OR: [
{ type: null },
{ type: '' }
]
}
});
if (0 < emptyTypeSchemaList.length) {
const updatePromises = emptyTypeSchemaList.map((schema) => prisma.schema.update({
where: { id: schema.id },
data: { type: 'indy' }
})
);
await Promise.all(updatePromises);

logger.log('Schemas updated successfully');
} else {
logger.log('No schemas to update');
}
} catch (error) {
logger.error('An error occurred during addSchemaType:', error);
}
};

async function main(): Promise<void> {

await createPlatformConfig();
Expand All @@ -579,8 +654,6 @@ async function main(): Promise<void> {
await createUserRole();
await migrateOrgAgentDids();
await addSchemaType();
await importGeoLocationMasterData();
await updateClientCredential();
}

main()
Expand Down

0 comments on commit 49b0d8e

Please sign in to comment.