Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/credebl/platform into qa
Browse files Browse the repository at this point in the history
  • Loading branch information
KulkarniShashank committed Feb 27, 2024
2 parents 4364dbb + 17af01f commit 0395c95
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion apps/api-gateway/src/dtos/create-schema.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class CreateSchemaDto {
attributeName: 'name',
schemaDataType: 'string',
displayName: 'Name',
isRequired: 'true'
isRequired: true
}
]
})
Expand Down
2 changes: 1 addition & 1 deletion apps/api-gateway/src/ecosystem/dtos/request-schema.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class RequestSchemaDto {
attributeName: 'name',
schemaDataType: 'string',
displayName: 'Name',
isRequired: 'true'
isRequired: true
}
]
})
Expand Down
2 changes: 1 addition & 1 deletion apps/api-gateway/src/verification/dto/request-proof.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class ProofRequestAttribute {

@ValidateIf((obj) => obj.attributeNames === undefined)
@IsNotEmpty()
@IsString({each:true})
@IsString()
attributeName?: string;

@ValidateIf((obj) => obj.attributeName === undefined)
Expand Down
3 changes: 2 additions & 1 deletion apps/verification/src/interfaces/verification.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { AutoAccept } from "@credebl/enum/enum";
import { IUserRequest } from "@credebl/user-request/user-request.interface";

interface IProofRequestAttribute {
attributeName: string;
attributeName?: string;
attributeNames?:string[];
condition?: string;
value?: string;
credDefId?: string;
Expand Down
22 changes: 16 additions & 6 deletions apps/verification/src/verification.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,10 @@ export class VerificationService {
]);

const imageUrl = getOrganization?.logoUrl;
const label = getOrganization?.name;

outOfBandRequestProof['imageUrl'] = imageUrl;
outOfBandRequestProof['label'] = label;

const orgAgentType = await this.verificationRepository.getOrgAgentType(getAgentDetails?.orgAgentTypeId);
let apiKey: string = await this.cacheService.get(CommonConstants.CACHE_APIKEY_KEY);
Expand Down Expand Up @@ -515,20 +518,21 @@ export class VerificationService {
requestedPredicates;
}> {
try {
let requestedAttributes = {};
let requestedAttributes = {};
const requestedPredicates = {};
const {attributes} = proofRequestpayload;
if (attributes) {
requestedAttributes = Object.fromEntries(proofRequestpayload.attributes.map((attribute, index) => {

const attributeElement = attribute.attributeName;
requestedAttributes = Object.fromEntries(attributes.map((attribute, index) => {
const attributeElement = attribute.attributeName || attribute.attributeNames;
const attributeReferent = `additionalProp${index + 1}`;
const attributeKey = attribute.attributeName ? 'name' : 'names';

if (!attribute.condition && !attribute.value) {

return [
attributeReferent,
{
name: attributeElement,
[attributeKey]: attributeElement,
restrictions: [
{
cred_def_id: proofRequestpayload.attributes[index].credDefId ? proofRequestpayload.attributes[index].credDefId : undefined,
Expand All @@ -541,7 +545,13 @@ export class VerificationService {
requestedPredicates[attributeReferent] = {
p_type: attribute.condition,
name: attributeElement,
p_value: parseInt(attribute.value)
p_value: parseInt(attribute.value),
restrictions: [
{
cred_def_id: proofRequestpayload.attributes[index].credDefId ? proofRequestpayload.attributes[index].credDefId : undefined,
schema_id: proofRequestpayload.attributes[index].schemaId
}
]
};
}

Expand Down

0 comments on commit 0395c95

Please sign in to comment.