Skip to content

Commit

Permalink
Merge pull request #576 from credebl/develop-to-qa
Browse files Browse the repository at this point in the history
develop to qa
  • Loading branch information
KulkarniShashank authored Mar 6, 2024
2 parents 37dad8f + e399881 commit 3188500
Show file tree
Hide file tree
Showing 12 changed files with 544 additions and 250 deletions.
2 changes: 1 addition & 1 deletion apps/agent-provisioning/AFJ/scripts/start_agent.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

START_TIME=$(date +%s)

Expand Down
113 changes: 112 additions & 1 deletion apps/api-gateway/src/verification/dto/request-proof.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,81 @@ export class OutOfBandRequestProof extends ProofPayload {
autoAcceptProof: string;
}

export class Fields {
@ApiProperty()
@IsArray()
@IsNotEmpty({ message: 'path is required.' })
path: string[];
}

export class Constraints {
@ApiProperty({type: () => [Fields]})
@IsOptional()
@IsNotEmpty({ message: 'Fields are required.' })
@ValidateNested()
@Type(() => Fields)
fields: Fields[];
}


export class Schema {
@ApiProperty()
@IsNotEmpty({ message: 'uri is required.' })
@IsString()
uri:string;

}
export class InputDescriptors {
@ApiProperty()
@IsNotEmpty({ message: 'id is required.' })
@IsString()
id:string;

@ApiProperty()
@IsString()
@IsOptional()
@IsNotEmpty({ message: 'name is required.' })
name:string;

@ApiProperty()
@IsString()
@IsOptional()
@IsNotEmpty({ message: 'purpose is required.' })
purpose:string;


@ApiProperty({type: () => [Schema]})
@IsNotEmpty({ message: 'schema is required.' })
@ValidateNested()
@Type(() => Schema)
schema:Schema[];


@ApiProperty({type: () => Constraints})
@IsOptional()
@IsNotEmpty({ message: 'Constraints are required.' })
@ValidateNested()
@Type(() => Constraints)
constraints:Constraints;

}

export class ProofRequestPresentationDefinition {

@IsString()
@IsNotEmpty({ message: 'id is required.' })
id: string;
@ApiProperty({type: () => [InputDescriptors]})
@IsNotEmpty({ message: 'inputDescriptors is required.' })
@IsArray({ message: 'inputDescriptors must be an array' })
@IsObject({ each: true })
@Type(() => InputDescriptors)
@ValidateNested()

// eslint-disable-next-line camelcase
input_descriptors:InputDescriptors[];
}

export class SendProofRequestPayload {

@ApiPropertyOptional()
Expand Down Expand Up @@ -194,7 +269,43 @@ export class SendProofRequestPayload {
})
@IsObject({ each: true })
@IsNotEmpty({ message: 'please provide valid proofFormat' })
proofFormats: IProofFormats;
@IsOptional()
proofFormats?: IProofFormats;

@ApiProperty({
'example':
{
id: '32f54163-7166-48f1-93d8-ff217bdb0653',
inputDescriptors: [
{
'id': 'banking_input_1',
'name': 'Bank Account Information',
'schema': [
{
'uri': 'https://bank-schemas.org/1.0.0/accounts.json'
}

],
'constraints': {
'fields': [
{
'path': ['$.issuer']
}
]
}
}
]
},
type: () => [ProofRequestPresentationDefinition]
})
@IsOptional()
@ValidateNested()
@IsObject({ message: 'presentationDefinition must be an object' })
@IsNotEmpty({ message: 'presentationDefinition must not be empty' })
@Type(() => ProofRequestPresentationDefinition)
presentationDefinition?:ProofRequestPresentationDefinition;

type:string;

@ApiPropertyOptional()
@IsString({ message: 'auto accept proof must be in string' })
Expand Down
5 changes: 5 additions & 0 deletions apps/api-gateway/src/verification/enum/verification.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@ export enum SortFields {
STATUS = 'state',
CONNECTION_ID = 'connectionId',
PRESENTATION_ID = 'presentationId'
}

export enum ProofRequestType {
INDY = 'indy',
PRESENTATIONEXCHANGE = 'presentationExchange'
}
10 changes: 8 additions & 2 deletions apps/api-gateway/src/verification/verification.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { ImageServiceService } from '@credebl/image-service';
import { User } from '../authz/decorators/user.decorator';
import { GetAllProofRequestsDto } from './dto/get-all-proof-requests.dto';
import { IProofRequestSearchCriteria } from './interfaces/verification.interface';
import { SortFields } from './enum/verification.enum';
import { ProofRequestType, SortFields } from './enum/verification.enum';

@UseFilters(CustomExceptionFilter)
@Controller()
Expand Down Expand Up @@ -247,16 +247,22 @@ export class VerificationController {
@ApiUnauthorizedResponse({ status: HttpStatus.UNAUTHORIZED, description: 'Unauthorized', type: UnauthorizedErrorDto })
@ApiForbiddenResponse({ status: HttpStatus.FORBIDDEN, description: 'Forbidden', type: ForbiddenErrorDto })
@ApiBody({ type: SendProofRequestPayload })
@ApiQuery({
name: 'requestType',
enum: ProofRequestType
})
@Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.VERIFIER)
@ApiBearerAuth()
@UseGuards(AuthGuard('jwt'), OrgRolesGuard)
async sendOutOfBandPresentationRequest(
@Res() res: Response,
@User() user: IUserRequest,
@Body() outOfBandRequestProof: SendProofRequestPayload,
@Param('orgId') orgId: string
@Param('orgId') orgId: string,
@Query('requestType') requestType:ProofRequestType = ProofRequestType.INDY
): Promise<Response> {
user.orgId = orgId;
outOfBandRequestProof.type = requestType;
const result = await this.verificationService.sendOutOfBandPresentationRequest(outOfBandRequestProof, user);
const finalResponse: IResponseType = {
statusCode: HttpStatus.CREATED,
Expand Down
17 changes: 17 additions & 0 deletions apps/issuance/interfaces/issuance.interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,20 @@ export interface OrgAgent {
orgAgentTypeId: string;
tenantId: string;
}

export interface SendEmailCredentialOffer {
iterator: CredentialOffer;
emailId: string;
index: number;
credentialType: IssueCredentialType;
protocolVersion: string;
attributes: IAttributes[];
credentialDefinitionId: string;
outOfBandCredential: OutOfBandCredentialOfferPayload;
comment: string;
organisation: organisation;
errors;
url: string;
apiKey: string;
organizationDetails: organisation;
}
Loading

0 comments on commit 3188500

Please sign in to comment.