Skip to content

Commit 7e3c358

Browse files
committed
Align with draft 24 path pointers for mso_mdoc.
Add intent_to_retain to mso_mdoc claim queries.
1 parent c5be3bb commit 7e3c358

4 files changed

Lines changed: 19 additions & 17 deletions

File tree

src/app/core/constants/attestations-per-format.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {AGE_OVER_18_ATTESTATION, EHIC_ATTESTATION, MDL_ATTESTATION, PDA1_ATTESTA
33
import {AttestationFormat} from "@core/models/attestation/AttestationFormat";
44
import {AttestationType} from "@core/models/attestation/AttestationType";
55
import {DataElement} from "@core/models/attestation/AttestationDefinition";
6+
import { ClaimsQuery } from "../models/dcql/DCQL";
67

78
export const SUPPORTED_FORMATS: AttestationFormat[] = [
89
AttestationFormat.MSO_MDOC,
@@ -16,7 +17,7 @@ export const MDL_MSO_MDOC: MsoMdocAttestation = {
1617
doctype: 'org.iso.18013.5.1.mDL',
1718
namespace: 'org.iso.18013.5.1',
1819
attributePath: (attribute: DataElement) => { return msoMdocAttributePath(attribute, 'org.iso.18013.5.1') },
19-
claimPath: (attribute: DataElement) => { return { namespace: 'org.iso.18013.5.1', claim_name: attribute.identifier } }
20+
claimQuery: (attribute: DataElement) => { return msoMdocClaimQuery('org.iso.18013.5.1', attribute.identifier) }
2021
}
2122

2223
/*---- PID ATTESTATION INSTANCES PER FORMAT ----*/
@@ -26,14 +27,14 @@ export const PID_MSO_MDOC: MsoMdocAttestation = {
2627
doctype: 'eu.europa.ec.eudi.pid.1',
2728
namespace: 'eu.europa.ec.eudi.pid.1',
2829
attributePath: (attribute: DataElement) => { return msoMdocAttributePath(attribute, 'eu.europa.ec.eudi.pid.1') },
29-
claimPath: (attribute: DataElement) => { return { namespace: 'eu.europa.ec.eudi.pid.1', claim_name: attribute.identifier } }
30+
claimQuery: (attribute: DataElement) => { return msoMdocClaimQuery('eu.europa.ec.eudi.pid.1', attribute.identifier) }
3031
}
3132
export const PID_SD_JWT_VC: SdJwtVcAttestation = {
3233
format: AttestationFormat.SD_JWT_VC,
3334
vct: "urn:eu.europa.ec.eudi:pid:1",
3435
attestationDef: PID_ATTESTATION,
3536
attributePath: (attribute: DataElement) => { return `$.${sdJwtVcAttributePath(attribute, AttestationType.PID)}` },
36-
claimPath: (attribute: DataElement) => { return { path: sdJwtVcAttributePath(attribute, AttestationType.PID).split('.') } }
37+
claimQuery: (attribute: DataElement) => { return { path: sdJwtVcAttributePath(attribute, AttestationType.PID).split('.') } }
3738
}
3839

3940
/*---- AGE OVER 18 ATTESTATION INSTANCES PER FORMAT ----*/
@@ -43,7 +44,7 @@ export const AGE_OVER_18_MSO_MDOC: MsoMdocAttestation = {
4344
doctype: 'eu.europa.ec.eudi.pseudonym.age_over_18.1',
4445
namespace: 'eu.europa.ec.eudi.pseudonym.age_over_18.1',
4546
attributePath: (attribute: DataElement) => { return msoMdocAttributePath(attribute, 'eu.europa.ec.eudi.pseudonym.age_over_18.1') },
46-
claimPath: (attribute: DataElement) => { return { namespace: 'eu.europa.ec.eudi.pseudonym.age_over_18.1', claim_name: attribute.identifier } }
47+
claimQuery: (attribute: DataElement) => { return msoMdocClaimQuery('eu.europa.ec.eudi.pseudonym.age_over_18.1', attribute.identifier) }
4748
}
4849

4950
/*---- PHOTO ID ATTESTATION INSTANCES PER FORMAT ----*/
@@ -53,7 +54,7 @@ export const PHOTO_ID_MSO_MDOC: MsoMdocAttestation = {
5354
doctype: 'org.iso.23220.2.photoid.1',
5455
namespace: 'org.iso.23220.photoid.1',
5556
attributePath: (attribute: DataElement) => { return msoMdocAttributePath(attribute, 'org.iso.23220.photoid.1') },
56-
claimPath: (attribute: DataElement) => { return { namespace: 'org.iso.23220.photoid.1', claim_name: attribute.identifier } }
57+
claimQuery: (attribute: DataElement) => { return msoMdocClaimQuery('org.iso.23220.photoid.1', attribute.identifier) }
5758
}
5859

5960
/*---- EHIC INSTANCES PER FORMAT ----*/
@@ -107,6 +108,10 @@ function sdJwtVcAttributePath(attribute: DataElement, attestationType: Attestati
107108
return resolvedAttribute;
108109
}
109110

111+
function msoMdocClaimQuery(namespace: string, claimName: string): ClaimsQuery {
112+
return { path: [namespace, claimName], intent_to_retain: false }
113+
}
114+
110115
export const PID_SD_JWT_VC_ATTRIBUTE_MAP: { [id: string]: string } = {
111116
"birth_date": "birthdate",
112117
"age_over_18": "age_equal_or_over.18",

src/app/core/models/attestation/Attestations.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ export type MsoMdocAttestation = {
1010
namespace: string,
1111
attestationDef: AttestationDefinition,
1212
attributePath: (attribute: DataElement) => string,
13-
claimPath: (attribute: DataElement) => ClaimsQuery,
13+
claimQuery: (attribute: DataElement) => ClaimsQuery,
1414
}
1515

1616
export type SdJwtVcAttestation = {
1717
format: AttestationFormat.SD_JWT_VC,
1818
vct: string,
1919
attestationDef: AttestationDefinition
2020
attributePath: (attribute: DataElement) => string,
21-
claimPath: (attribute: DataElement) => ClaimsQuery,
21+
claimQuery: (attribute: DataElement) => ClaimsQuery,
2222
}

src/app/core/models/dcql/DCQL.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,19 @@ export type CredentialSetQuery = {
1717
required?: boolean;
1818
};
1919

20-
export type BaseClaimQuery = {
20+
export type ClaimQuery = {
2121
id?: ClaimId;
22+
path: ClaimPath;
2223
values?: Object[];
2324
};
2425

25-
export type JsonClaimQuery = {
26-
path: string[];
27-
};
28-
2926
export type MsoMdocClaimQueryExtension = {
30-
namespace: string;
31-
claim_name: string;
27+
intent_to_retain: boolean;
3228
};
3329

34-
export type ClaimsQuery = BaseClaimQuery &
35-
(JsonClaimQuery | MsoMdocClaimQueryExtension);
30+
export type ClaimsQuery = ClaimQuery &
31+
(ClaimQuery | MsoMdocClaimQueryExtension);
32+
3633

3734
export type QueryId = string;
3835
export type ClaimId = string;

src/app/core/services/dcql-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export class DCQLService {
7575
selectedAttributes!.includes(dataElement.identifier)
7676
)
7777
.map((dataElement) => {
78-
return attestation!!.claimPath(dataElement);
78+
return attestation!.claimQuery(dataElement);
7979
});
8080

8181
if (claims.length > 0) {

0 commit comments

Comments
 (0)