Skip to content

Commit

Permalink
Merge branch 'main' into fix/sdjwtvc-media-type
Browse files Browse the repository at this point in the history
  • Loading branch information
gdimtsas authored Feb 17, 2025
2 parents 9d2ad71 + 1bbfb1a commit dd9049a
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "verifier-ui",
"version": "0.6.3-SNAPSHOT",
"version": "0.6.5-SNAPSHOT",
"scripts": {
"ng": "ng",
"start": "npm run config && ng serve --proxy-config src/proxy.conf.json",
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/constants/attestations-per-format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const PID_SD_JWT_VC: SdJwtVcAttestation = {
format: AttestationFormat.SD_JWT_VC,
vct: "urn:eu.europa.ec.eudi:pid:1",
attestationDef: PID_ATTESTATION,
attributePath: (attribute: DataElement) => { return `'$.'${sdJwtVcAttributePath(attribute, AttestationType.PID)}` },
attributePath: (attribute: DataElement) => { return `$.${sdJwtVcAttributePath(attribute, AttestationType.PID)}` },
claimPath: (attribute: DataElement) => { return { path: sdJwtVcAttributePath(attribute, AttestationType.PID).split('.') } }
}

Expand Down
80 changes: 40 additions & 40 deletions src/app/core/services/dcql-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import {
} from '@app/features/presentation-request-preparation/models/AttestationSelection';
import { v4 as uuidv4 } from 'uuid';
import { DCQLTransactionRequest } from '../models/TransactionInitializationRequest';
import { MsoMdocAttestation, SdJwtVcAttestation } from '../models/attestation/Attestations';
import {
MsoMdocAttestation,
SdJwtVcAttestation,
} from '../models/attestation/Attestations';

@Injectable({
providedIn: 'root',
Expand All @@ -19,25 +22,18 @@ export class DCQLService {
selectedAttestations: AttestationSelection[],
selectedAttributes: { [id: string]: string[] }
): DCQLTransactionRequest {
let dcqlQueries: CredentialQuery[] = [];

selectedAttestations.map((attestation, index) => {
const selectedAttributesForAttestation =
selectedAttributes[attestation.type];

const dcqlQuery = this.dcqlQueryOf(
`query_${index}`,
attestation.type,
attestation.format!!,
attestation.attributeSelectionMethod ===
AttributeSelectionMethod.ALL_ATTRIBUTES
? undefined
: selectedAttributesForAttestation
);
if (dcqlQuery) {
dcqlQueries.push(dcqlQuery);
}
});
let dcqlQueries: CredentialQuery[] = selectedAttestations.map(
(attestation, index) =>
this.dcqlQueryOf(
`query_${index}`,
attestation.type,
attestation.format!!,
attestation.attributeSelectionMethod ===
AttributeSelectionMethod.ALL_ATTRIBUTES
? []
: selectedAttributes[attestation.type]
)
);

return {
type: 'vp_token',
Expand All @@ -56,28 +52,32 @@ export class DCQLService {
): CredentialQuery {
let attestation = getAttestationByFormatAndType(type, format);

let claims: ClaimsQuery[] = [];
if (attestation != null) {
claims = attestation.attestationDef.dataSet
.filter(
(dataElement) =>
selectedAttributes === undefined ||
selectedAttributes.includes(dataElement.identifier)
)
.map((dataElement) => {
return attestation!!.claimPath(dataElement);
});
}

return {
let query: CredentialQuery = {
id: queryId,
format: format === AttestationFormat.MSO_MDOC ? 'mso_mdoc' : 'dc+sd-jwt',
meta: format === AttestationFormat.MSO_MDOC ? {
doctype_value: (attestation as MsoMdocAttestation).doctype
} : {
vct_values: [(attestation as SdJwtVcAttestation).vct]
},
claims: claims,
meta:
format === AttestationFormat.MSO_MDOC
? {
doctype_value: (attestation as MsoMdocAttestation).doctype,
}
: {
vct_values: [(attestation as SdJwtVcAttestation).vct],
},
};

let claims: ClaimsQuery[] = [];
claims = attestation!.attestationDef.dataSet
.filter((dataElement) =>
selectedAttributes!.includes(dataElement.identifier)
)
.map((dataElement) => {
return attestation!!.claimPath(dataElement);
});

if (claims.length > 0) {
query.claims = claims;
}

return query;
}
}

0 comments on commit dd9049a

Please sign in to comment.