defaultClassifyPurposes
Default ClassifyPurposesFn implementation that classifies the PresentmentPurposes across all selected use-cases in presentmentData.
Implementation Details
Each selected PresentmentUseCase (where selections[index] >= 0) is evaluated against its selected org.multipaz.presentment.PresentmentUseCaseSolution:
Per-credential match inference: For each org.multipaz.presentment.PresentmentCredentialMatch in the selected solution:
Unknown claims: If any requested claim is not defined in the credential's schema (
claim.attribute == null), classification fails for that match and returns an empty set.Transaction data: If any attached transaction data has type identifier
"urn:eudi:sca:payment:1", PresentmentPurpose.PAYMENT is added.Domain-specific doctypes and VCTs:
Payment credentials (
org.multipaz.payment.sca.1,urn:emvco:dpc:card:1): Classified as PresentmentPurpose.PAYMENT if all requested claims are recognized payment claims (issuer_name,payment_instrument_id,masked_account_reference,holder_name,issue_date,expiry_date,credential_id,network,last_four) or have DocumentAttributeSensitivity.VALIDITY / DocumentAttributeSensitivity.ISSUER sensitivity; otherwise returns an empty set.Loyalty credentials (
org.multipaz.loyalty.1): Classified as PresentmentPurpose.LOYALTY_VERIFICATION if all requested claims are recognized loyalty claims (family_name,given_name,portrait,membership_number,tier,issue_date,expiry_date) or haveVALIDITY,ISSUER, orPORTRAIT_IMAGEsensitivity; otherwise returns an empty set.Ticket / boarding pass credentials (
org.multipaz.example.boarding-pass.1,org.multipaz.movieticket.1,https://utopia.example.com/vct/movieticket): Classified as PresentmentPurpose.TICKET_VERIFICATION if all requested claims are recognized ticket claims (passenger_name,flight_number,seat_number,departure_time,ticket_id,cinema,movie,show_date_time,movie_rating,theater_id,seat_id,parking_option,poster) or haveVALIDITY,ISSUER, orPORTRAIT_IMAGEsensitivity; otherwise returns an empty set.General identity / mDL / PID / age verification credentials (
org.iso.18013.5.1.mDL,org.iso.23220.photoid.1,eu.europa.ec.eudi.pid.1,urn:eudi:pid:1,https://example.bmi.bund.de/credential/pid/1.0,eu.europa.ec.av.1,com.google.wallet.idcard.1,in.gov.uidai.aadhaar.1,eu.europa.ec.eudi.cor.1,https://example.eudi.ec.europa.eu/cor/1): Each requested claim is categorized:Driving claims (
driving_privileges,domestic_driving_privileges) add PresentmentPurpose.DRIVING_PRIVILEGES.Age claims (DocumentAttributeSensitivity.AGE_INFORMATION,
age_in_years,age_birth_year,age_over_*,age_above*,age_equal_or_over.*) add PresentmentPurpose.AGE_VERIFICATION. At most 2 age claims per credential are permitted; requesting 3 or more age claims on a single credential is treated as over-broad and returns an empty set.Address claims (e.g.,
resident_address,resident_city,resident_state,resident_postal_code,resident_country,address.*,locality,street_address, etc.) add PresentmentPurpose.ADDRESS_VERIFICATION.Core identity claims (e.g.,
family_name,given_name,birth_date,document_number,person_id,personal_administrative_number,sex,gender,nationality,place_of_birth,signature_usual_mark,dg1,dg2,sod, etc.) add PresentmentPurpose.IDENTITY_VERIFICATION.Portrait claims (DocumentAttributeSensitivity.PORTRAIT_IMAGE,
portrait,picture,resident_image) and auxiliary validity/issuer metadata claims (issue_date,expiry_date,issuing_country,issuing_authority,DHS_compliance, etc.) are compatible with any purpose. If a credential requests only a portrait (or requires face matching) without other purpose-specific claims, it defaults to PresentmentPurpose.IDENTITY_VERIFICATION.Any other claim not accounted for above (such as
height,weight,eye_colour,hair_colour, etc.) causes classification to fail and return an empty set.Same-credential subsumption: When both PresentmentPurpose.IDENTITY_VERIFICATION and PresentmentPurpose.AGE_VERIFICATION are inferred on the same credential, PresentmentPurpose.IDENTITY_VERIFICATION subsumes PresentmentPurpose.AGE_VERIFICATION.
Other / custom credentials: For any other doctype or VCT, no domain-specific PresentmentPurpose is inferred (unless a recognized transaction type such as
"urn:eudi:sca:payment:1"is attached), returning an empty set so the UI renders a generic request subtitle without flagging the request as unusual.Purpose hints validation: If PresentmentUseCase.purposeHints is non-empty, each protocol-level hint (such as ISO/IEC 18013-5
org.iso.jtc1.sc17purpose codes1for identity,2for driving privileges, and3for age verification) is mapped to a PresentmentPurpose and checked against the inferred purposes of the selected solution:PresentmentPurpose.DRIVING_PRIVILEGES permits inferred
DRIVING_PRIVILEGES,IDENTITY_VERIFICATION, andAGE_VERIFICATION.PresentmentPurpose.IDENTITY_VERIFICATION permits inferred
IDENTITY_VERIFICATION,ADDRESS_VERIFICATION, andAGE_VERIFICATION.All other hinted purposes permit only that exact inferred purpose.
If any hint is unrecognized or if the inferred purposes exceed what the declared hints permit, the use-case fails classification and returns an empty set.
Aggregation across use-cases: The classified purposes across all selected use-cases are combined in PresentmentPurpose enum declaration order. If no use-cases are selected or if any selected use-case returns an empty set, this function returns an empty set.
Return
the set of PresentmentPurposes in enum declaration order, or an empty set if unknown.
Parameters
the relying party which is requesting the data.
trust information for the requester, or null if untrusted.
the combinations of credentials and claims that the user can select.
the selected solution indices for each PresentmentUseCase in PresentmentData.useCases, or an empty list for an omitted optional use-case. Defaults to PresentmentData.defaultSelections.