Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions apps/agent-service/test/app.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,5 @@ describe('AgentServiceController (e2e)', () => {
await app.init();
});

it('/ (GET)', () => {
return request(app.getHttpServer())
.get('/')
.expect(200)
.expect('Hello World!');
});
it('/ (GET)', () => request(app.getHttpServer()).get('/').expect(200).expect('Hello World!'));
});
6 changes: 3 additions & 3 deletions apps/api-gateway/src/cloud-wallet/enums/connections.enum.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export declare enum HandshakeProtocol {
Connections = "https://didcomm.org/connections/1.0",
DidExchange = "https://didcomm.org/didexchange/1.0"
}
Connections = 'https://didcomm.org/connections/1.0',
DidExchange = 'https://didcomm.org/didexchange/1.0'
}
6 changes: 3 additions & 3 deletions apps/api-gateway/src/connection/enums/connections.enum.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export declare enum HandshakeProtocol {
Connections = "https://didcomm.org/connections/1.0",
DidExchange = "https://didcomm.org/didexchange/1.0"
}
Connections = 'https://didcomm.org/connections/1.0',
DidExchange = 'https://didcomm.org/didexchange/1.0'
}
10 changes: 4 additions & 6 deletions apps/api-gateway/src/connection/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ export interface ISelectedOrgInterface {
export interface IOrganizationInterface {
name: string;
description: string;
org_agents: IOrgAgentInterface[]

org_agents: IOrgAgentInterface[];
}

export interface IOrgAgentInterface {
Expand All @@ -40,7 +39,6 @@ export interface IOrgAgentInterface {
orgId: string;
}


export class IConnectionInterface {
tag: object;
createdAt: string;
Expand Down Expand Up @@ -71,8 +69,8 @@ interface IOutOfBandInvitationService {
}

interface IOutOfBandInvitation {
"@type": string;
"@id": string;
'@type': string;
'@id': string;
label: string;
accept: string[];
handshake_protocols: string[];
Expand Down Expand Up @@ -114,4 +112,4 @@ interface IConnectionRecord {
export interface IReceiveInvitationRes {
outOfBandRecord: IOutOfBandRecord;
connectionRecord: IConnectionRecord;
}
}
57 changes: 28 additions & 29 deletions apps/api-gateway/src/dtos/credential-offer.dto.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,39 @@
import { ApiProperty } from "@nestjs/swagger";
import { IsArray, IsNotEmpty, IsString } from "class-validator";
import { ApiProperty } from '@nestjs/swagger';
import { IsArray, IsNotEmpty, IsString } from 'class-validator';

interface attributeValue {
name: string,
value: string,
name: string;
value: string;
}

export class IssueCredentialOffer {
@ApiProperty({ example: { protocolVersion: 'v1' } })
@IsNotEmpty({ message: 'Please provide valid protocol-version' })
@IsString({ message: 'protocol-version should be string' })
protocolVersion: string;

@ApiProperty({ example: { 'protocolVersion': 'v1' } })
@IsNotEmpty({ message: 'Please provide valid protocol-version' })
@IsString({ message: 'protocol-version should be string' })
protocolVersion: string;

@ApiProperty({ example: { 'attributes': [{ 'value': 'string', 'name': 'string' }] } })
@IsNotEmpty({ message: 'Please provide valid attributes' })
@IsArray({ message: 'attributes should be array' })
attributes: attributeValue[];
@ApiProperty({ example: { attributes: [{ value: 'string', name: 'string' }] } })
@IsNotEmpty({ message: 'Please provide valid attributes' })
@IsArray({ message: 'attributes should be array' })
attributes: attributeValue[];

@ApiProperty({ example: { 'credentialDefinitionId': 'string' } })
@IsNotEmpty({ message: 'Please provide valid credentialDefinitionId' })
@IsString({ message: 'credentialDefinitionId should be string' })
credentialDefinitionId: string;
@ApiProperty({ example: { credentialDefinitionId: 'string' } })
@IsNotEmpty({ message: 'Please provide valid credentialDefinitionId' })
@IsString({ message: 'credentialDefinitionId should be string' })
credentialDefinitionId: string;

@ApiProperty({ example: { autoAcceptCredential: 'always' } })
@IsNotEmpty({ message: 'Please provide valid autoAcceptCredential' })
@IsString({ message: 'autoAcceptCredential should be string' })
autoAcceptCredential: string;
@ApiProperty({ example: { autoAcceptCredential: 'always' } })
@IsNotEmpty({ message: 'Please provide valid autoAcceptCredential' })
@IsString({ message: 'autoAcceptCredential should be string' })
autoAcceptCredential: string;

@ApiProperty({ example: { comment: 'string' } })
@IsNotEmpty({ message: 'Please provide valid comment' })
@IsString({ message: 'comment should be string' })
comment: string;
@ApiProperty({ example: { comment: 'string' } })
@IsNotEmpty({ message: 'Please provide valid comment' })
@IsString({ message: 'comment should be string' })
comment: string;

@ApiProperty({ example: { connectionId: '3fa85f64-5717-4562-b3fc-2c963f66afa6' } })
@IsNotEmpty({ message: 'Please provide valid connection-id' })
@IsString({ message: 'Connection-id should be string' })
connectionId: string;
@ApiProperty({ example: { connectionId: '3fa85f64-5717-4562-b3fc-2c963f66afa6' } })
@IsNotEmpty({ message: 'Please provide valid connection-id' })
@IsString({ message: 'Connection-id should be string' })
connectionId: string;
Comment on lines +10 to +38
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Swagger examples are incorrectly nested; use field-value examples.

Examples should represent the property value directly, not { propertyName: value }. Fix to avoid misleading API docs.

-  @ApiProperty({ example: { protocolVersion: 'v1' } })
+  @ApiProperty({ example: 'v1' })
   @IsNotEmpty({ message: 'Please provide valid protocol-version' })
   @IsString({ message: 'protocol-version should be string' })
   protocolVersion: string;

-  @ApiProperty({ example: { attributes: [{ value: 'string', name: 'string' }] } })
+  @ApiProperty({ example: [{ name: 'firstName', value: 'Alice' }] })
   @IsNotEmpty({ message: 'Please provide valid attributes' })
   @IsArray({ message: 'attributes should be array' })
   attributes: attributeValue[];

-  @ApiProperty({ example: { credentialDefinitionId: 'string' } })
+  @ApiProperty({ example: 'creddef:XYZ' })
   @IsNotEmpty({ message: 'Please provide valid credentialDefinitionId' })
   @IsString({ message: 'credentialDefinitionId should be string' })
   credentialDefinitionId: string;

-  @ApiProperty({ example: { autoAcceptCredential: 'always' } })
+  @ApiProperty({ example: 'always' })
   @IsNotEmpty({ message: 'Please provide valid autoAcceptCredential' })
   @IsString({ message: 'autoAcceptCredential should be string' })
   autoAcceptCredential: string;

-  @ApiProperty({ example: { comment: 'string' } })
+  @ApiProperty({ example: 'Issuing employment credential' })
   @IsNotEmpty({ message: 'Please provide valid comment' })
   @IsString({ message: 'comment should be string' })
   comment: string;

-  @ApiProperty({ example: { connectionId: '3fa85f64-5717-4562-b3fc-2c963f66afa6' } })
+  @ApiProperty({ example: '3fa85f64-5717-4562-b3fc-2c963f66afa6' })
   @IsNotEmpty({ message: 'Please provide valid connection-id' })
   @IsString({ message: 'Connection-id should be string' })
   connectionId: string;

Optional:

  • Rename attributeValue to AttributeValue (PascalCase for interfaces).
  • Use @IsUUID() for connectionId.
🤖 Prompt for AI Agents
In apps/api-gateway/src/dtos/credential-offer.dto.ts around lines 10 to 38, the
@ApiProperty examples are incorrectly wrapped as objects (e.g. {
protocolVersion: 'v1' }) which misleads Swagger—change each example to the
direct property value (e.g. example: 'v1' or example: [{ value: 'string', name:
'string' }]); also follow the optional suggestions: rename the attributeValue
type to PascalCase AttributeValue everywhere and replace the connectionId
validation with @IsUUID() (or add @IsUUID() alongside @IsString()) to ensure
proper UUID validation.

}
13 changes: 6 additions & 7 deletions apps/api-gateway/src/dtos/credential-send-offer.dto.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { ApiProperty } from "@nestjs/swagger";
import { IsNotEmpty, IsString } from "class-validator";
import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsString } from 'class-validator';

export class CredentialSendOffer {

@ApiProperty({ example: 'string' })
@IsNotEmpty({ message: 'Please provide valid credentialRecordId' })
@IsString({ message: 'credentialRecordId should be string' })
credentialRecordId: string;
@ApiProperty({ example: 'string' })
@IsNotEmpty({ message: 'Please provide valid credentialRecordId' })
@IsString({ message: 'credentialRecordId should be string' })
credentialRecordId: string;
}
52 changes: 21 additions & 31 deletions apps/api-gateway/src/helper-files/file-operation.helper.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,26 @@
import { promisify } from "util";
import * as fs from "fs";
import { promisify } from 'util';
import * as fs from 'fs';

export const createFile = async (path: string, fileName: string, data: string): Promise<void> => {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
if (!checkIfFileOrDirectoryExists(path)) {
fs.mkdirSync(path, { recursive: true });
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const writeFile = promisify(fs.writeFile);
return fs.writeFileSync(`${path}/${fileName}`, data, 'utf8');
Comment on lines +10 to +11
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Remove unused promisified writeFile and use async write or make function sync.

The function promisifies fs.writeFile but never uses it, then calls the synchronous fs.writeFileSync. This is inconsistent and the unused variable triggers an ESLint warning.

Choose one approach:

Option 1 (async): Use the promisified version consistently:

 export const createFile = async (path: string, fileName: string, data: string): Promise<void> => {
   // eslint-disable-next-line @typescript-eslint/no-use-before-define
   if (!checkIfFileOrDirectoryExists(path)) {
     fs.mkdirSync(path);
   }
-  // eslint-disable-next-line @typescript-eslint/no-unused-vars
   const writeFile = promisify(fs.writeFile);
-  return fs.writeFileSync(`${path}/${fileName}`, data, 'utf8');
+  return writeFile(`${path}/${fileName}`, data, 'utf8');
 };

Option 2 (sync): Remove async and promisify:

-export const createFile = async (path: string, fileName: string, data: string): Promise<void> => {
+export const createFile = (path: string, fileName: string, data: string): void => {
   // eslint-disable-next-line @typescript-eslint/no-use-before-define
   if (!checkIfFileOrDirectoryExists(path)) {
     fs.mkdirSync(path);
   }
-  // eslint-disable-next-line @typescript-eslint/no-unused-vars
-  const writeFile = promisify(fs.writeFile);
-  return fs.writeFileSync(`${path}/${fileName}`, data, 'utf8');
+  fs.writeFileSync(`${path}/${fileName}`, data, 'utf8');
 };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const writeFile = promisify(fs.writeFile);
return fs.writeFileSync(`${path}/${fileName}`, data, 'utf8');
export const createFile = async (path: string, fileName: string, data: string): Promise<void> => {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
if (!checkIfFileOrDirectoryExists(path)) {
fs.mkdirSync(path);
}
const writeFile = promisify(fs.writeFile);
return writeFile(`${path}/${fileName}`, data, 'utf8');
};
Suggested change
const writeFile = promisify(fs.writeFile);
return fs.writeFileSync(`${path}/${fileName}`, data, 'utf8');
export const createFile = (path: string, fileName: string, data: string): void => {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
if (!checkIfFileOrDirectoryExists(path)) {
fs.mkdirSync(path);
}
fs.writeFileSync(`${path}/${fileName}`, data, 'utf8');
};
🤖 Prompt for AI Agents
In apps/api-gateway/src/helper-files/file-operation.helper.ts around lines
10-11, the code promisifies fs.writeFile to a writeFile constant but then calls
fs.writeFileSync, leaving an unused variable and inconsistent sync/async
behavior; fix by either removing the promisify and the unused writeFile constant
(keep the synchronous fs.writeFileSync and ensure the function is
documented/typed as sync) or convert the function to async: replace
fs.writeFileSync with await writeFile(pathWithFileName, data, 'utf8'), mark the
function async, and remove any unused sync import; also remove any unused eslint
warnings by deleting the unused variable or using the promisified call.

};

export const createFile = async (
path: string,
fileName: string,
data: string
): Promise<void> => {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
if (!checkIfFileOrDirectoryExists(path)) {

fs.mkdirSync(path);
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const writeFile = promisify(fs.writeFile);
return fs.writeFileSync(`${path}/${fileName}`, data, 'utf8');
};
export const checkIfFileOrDirectoryExists = (path: string): boolean => fs.existsSync(path);

export const checkIfFileOrDirectoryExists = (path: string): boolean => fs.existsSync(path);

export const getFile = async (
path: string,
encoding: BufferEncoding
): Promise<string | Buffer> => {
const readFile = promisify(fs.readFile);

return encoding ? readFile(path, {encoding}) : readFile(path, {});
};
export const getFile = async (path: string, encoding: BufferEncoding): Promise<string | Buffer> => {
const readFile = promisify(fs.readFile);

return encoding ? readFile(path, { encoding }) : readFile(path, {});
};

export const deleteFile = async (path: string): Promise<void> => {
const unlink = promisify(fs.unlink);
return unlink(path);
};
export const deleteFile = async (path: string): Promise<void> => {
const unlink = promisify(fs.unlink);

return unlink(path);
};
153 changes: 76 additions & 77 deletions apps/api-gateway/src/verification/dto/webhook-proof.dto.ts
Original file line number Diff line number Diff line change
@@ -1,83 +1,82 @@
import { ApiPropertyOptional } from "@nestjs/swagger";
import { IsOptional } from "class-validator";
import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsOptional } from 'class-validator';

interface IWebhookPresentationProof {
threadId: string;
state: string;
connectionId
threadId: string;
state: string;
connectionId;
}

export class WebhookPresentationProofDto {
@ApiPropertyOptional()
@IsOptional()
metadata: object;

@ApiPropertyOptional()
@IsOptional()
metadata: object;

@ApiPropertyOptional()
@IsOptional()
_tags: IWebhookPresentationProof;

@ApiPropertyOptional()
@IsOptional()
id: string;

@ApiPropertyOptional()
@IsOptional()
createdAt: string;

@ApiPropertyOptional()
@IsOptional()
protocolVersion: string;

@ApiPropertyOptional()
@IsOptional()
state: string;

@ApiPropertyOptional()
@IsOptional()
connectionId: string;

@ApiPropertyOptional()
@IsOptional()
threadId: string;

@ApiPropertyOptional()
@IsOptional()
parentThreadId?: string;

@ApiPropertyOptional()
@IsOptional()
presentationId: string;

@ApiPropertyOptional()
@IsOptional()
autoAcceptProof: string;

@ApiPropertyOptional()
@IsOptional()
updatedAt: string;

@ApiPropertyOptional()
@IsOptional()
isVerified: boolean;

@ApiPropertyOptional()
@IsOptional()
contextCorrelationId: string;

@ApiPropertyOptional()
@IsOptional()
type: string;

@ApiPropertyOptional()
@IsOptional()
proofData: object;

@ApiPropertyOptional()
@IsOptional()
orgId: string;

@ApiPropertyOptional()
@IsOptional()
errorMessage: string;
}
@ApiPropertyOptional()
@IsOptional()
_tags: IWebhookPresentationProof;

@ApiPropertyOptional()
@IsOptional()
id: string;

@ApiPropertyOptional()
@IsOptional()
createdAt: string;

@ApiPropertyOptional()
@IsOptional()
protocolVersion: string;

@ApiPropertyOptional()
@IsOptional()
state: string;

@ApiPropertyOptional()
@IsOptional()
connectionId: string;

@ApiPropertyOptional()
@IsOptional()
threadId: string;

@ApiPropertyOptional()
@IsOptional()
parentThreadId?: string;

@ApiPropertyOptional()
@IsOptional()
presentationId: string;

@ApiPropertyOptional()
@IsOptional()
autoAcceptProof: string;

@ApiPropertyOptional()
@IsOptional()
updatedAt: string;

@ApiPropertyOptional()
@IsOptional()
isVerified: boolean;

@ApiPropertyOptional()
@IsOptional()
contextCorrelationId: string;

@ApiPropertyOptional()
@IsOptional()
type: string;

@ApiPropertyOptional()
@IsOptional()
proofData: object;

@ApiPropertyOptional()
@IsOptional()
orgId: string;

@ApiPropertyOptional()
@IsOptional()
errorMessage: string;
}
Loading