Repository navigation
Conversation
Use CEL expressions in input-fields-to-credential-map.json (keyed by output JSON pointer) and x-cel-rules in input-fields/schema.json. Convert the mobile-driving-licence v1 mdoc map, which fixes the driving_privileges key casing and the broken weight pointer, and add apply-credential-map.js to build each credential from its example and validate it against the format schema. Maps keyed by input field keep working unchanged.
The EDC schemas disagree with the ELM SHACL shapes and with the EDCs
Velocert issues today:
- contactPoint emailAddress id was const "mailto:", so no real address
could pass. It is now a ^mailto:.+ pattern.
- individualDisplay, displayDetail and language may be lists in ELM.
They now accept an object or a non-empty array.
- The issuer needs an eIDASIdentifier (mandatory in EDC-generic-no-cv),
which additionalProperties rejected. Organisation now allows it.
- microcredential: prefLabel enums were applied to the LangString
object instead of its "en" value, and used labels that are not in
the ELM vocabularies ("ECTS"). LearningAssessment.specifiedBy is a
LearningAssessmentSpecification, not a Qualification.
Convert every edc/w3c-vc map and the microcredential open-badge map to CEL, building on the mDL proof of concept. - profiles/<profile>/<format>/base-map.json holds what every type of a profile shares (EDC envelope, issuer, awarding process, display parameter; OB envelope and achievement skeleton). The type map is applied on top. - meta is fixed per profile: profile-shaped issuer and awardingBody nodes, primaryLanguage, recipient and validity. Defaults live in profiles/<profile>/<format>/examples/issuance-meta.json. - New CEL inputs: vocab (controlled-vocabulary tables generated from the ELM XSDs into resources/vocabularies), translations (the type's credential title per language), now and uuid(). The runner fixes now and the uuid() sequence so output is reproducible. - EDCs are also expanded as JSON-LD and validated against the vendored ELM SHACL shapes (EDC-generic-full), offline. Fields the ELM context does not define are reported as warnings. - CI runs apply-map and the runner tests in a new job. Only CEL maps fail the build; legacy maps are reported. - microcredential gets a nationalIdCountry input field, required by an x-cel-rule when nationalId is set, for the LegalIdentifier spatial. All CEL map entries and rules give the same values in cel-go v0.28.
The v1 EDC maps of eight types put their type-specific fields into properties the ELM JSON-LD context does not define, so Europass and other linked-data verifiers never see them. v1 stays as it is; v2 fixes this with the same input fields: - degree-certificate, certificate-of-advanced-study: LearningAchievement specified by a Qualification; ECTS as creditReceived - confirmation-of-enrolment, matriculation: LearningEntitlement (learning opportunity, actual); matriculation start and end as its dateIssued and expiryDate - certificate-of-participation-in-summer-school: LearningActivity (educational programme) with its workload - student-id: LearningEntitlement of type membership - student numbers and card, library and identity numbers are ELM Identifiers on the person; statements without an ELM property (academic year, programme status, discounts, roles) are additionalNotes; personTitle is not carried - visa, boarding-pass: not learning credentials, so v2 drops EDC and adds eaa/sd-jwt-vc with snake_case claims and a placeholder vct All six v2 EDCs pass their new JSON Schemas and the ELM SHACL shapes with no dropped fields. New vocabulary tables: entitlementType, entitlementStatus, learningActivityType and countryCode (ISO 3166-1 alpha-3). cel-go v0.28 matches cel-js on all 568 entries.
- Input fields that take a vocabulary label carry "x-vocabulary": the runner rejects any other value as an input error, and forms can offer the labels from resources/vocabularies. Added to the v2 inputs and to microcredential and certificate-of-attendance v1. - visa and boarding-pass v2 get SD-JWT VC Type Metadata (type-metadata.json, draft 19): labels, mandatory and sd per claim, all claims sd "allowed". The vct is now the raw GitHub URL of that file instead of a urn placeholder. The runner checks that the map's vct matches and that every claim is described. - v1 of the eight remodelled types is marked deprecated in favour of v2.
Every map in the repository is now a CEL map, so the runner drops the
reader for maps keyed by input field: a key that is not a JSON pointer
is now a map error and every map is enforced in CI.
- age-verification v1 (eudi.av mdoc): adds the missing docType. A key
with {{NN}} is a template that repeats for every matching input field
(ageOver21 -> age_over_21), since standard CEL cannot build a map with
computed keys. The example input uses ageOver21 instead of the
literal "ageOver{{NN}}" key.
- personal-id v2 (eudi.pid mdoc and sd-jwt-vc): add vct and docType,
and the issuer values (expiry and issuance date, issuing authority,
country and jurisdiction, document number, trust anchor) from meta.
- Fixes: the PID mdoc namespace schema had a "nationality " key with a
trailing space, and the PID input schema declared nationality as a
string while the example and both formats use a list of codes.
cel-go v0.28 matches cel-js on all 626 entries.
- The runner writes each format folder's unsigned example (examples/<profile>-<initials>-example.json) from the input example with --write-examples, and fails when a committed example is missing or out of date, so examples cannot drift from the maps again. The initials come from an existing example of the type, else from the words of its name. All 23 format folders now have one; the hand-written v1 examples are replaced. - Signed examples are kept as they are and documented as historical. - PID SD-JWT VC schema: allow iss, iat, nbf, exp, cnf and status, so a signed PID passes its own schema. - The version rule in credential-type-structure and naming-conventions now names the bug-fix exception that CONTRIBUTING already allows.
- build-rulebooks.js parses the attribute tables of the EUDI PID Rulebook (ARF Annex 3.01) and the Age Verification Profile (Annex A), pinned to a commit, into profiles/<profile>/<format>/rulebook.json. The runner checks docType or vct, that every element or claim is in the rulebook, that mandatory ones are present, and their encoding. The mDL rulebook defers to ISO/IEC 18013-5, so mDL has none. - The check found the PID mdoc used the SD-JWT VC address structure and a vct element, neither of which the rulebook's mdoc encoding has. It now writes the flat resident_* elements (street including the house number) and the portrait as bytes (base64), and all three PID schemas accept the rulebook's sex codes 0-6 and 9. - Open Badge is expanded as JSON-LD with the vendored VC 2.0 and OB 3.0.3 contexts, so undefined fields are reported as for EDC. shacl.json is renamed linked-data.json, with shapes optional. - Maps may use the CEL strings extension (split, substring, indexOf); cel-go runs it with ext.Strings() and still matches on all entries.
A local page to edit input fields, meta, input rules and map expressions and watch the credential and its validation update: format JSON Schema, EUDI rulebook, and JSON-LD/SHACL. Once a claim set is valid, it is signed with a mock PKI and verified, for every format: - mdoc: ISO/IEC 18013-5 IssuerSigned, presented over OpenID4VP, verified by @auth0/mdl and pymdoccbor (Python) - SD-JWT VC: dc+sd-jwt with disclosures per the Type Metadata, presented with a key-binding JWT, verified by @sd-jwt/sd-jwt-vc and the OpenWallet Foundation sd-jwt library (Python) - EDC: JAdES baseline-B with the protected header Velocert's DSS produces, verified with jose (B-LTA needs DSS and is shown as skipped) - Open Badge 3.0: VC-JWT per Open Badges 3.0 §8.2.4, verified with jose The demo has its own package.json, so CI and the map tooling never install its signing libraries. @sd-jwt/sd-jwt-vc is pinned to 0.21 and its @owf/* dependencies to 0.4.0. @owf/cose and @auth0/mdl both register global cbor-x handlers for tags 24 and 1004, so mdoc.js loads @sd-jwt/sd-jwt-vc first and @auth0/mdl's handlers win. Run: npm ci && npm --prefix demo ci && npm --prefix demo start
- mDL: ISO/IEC 18013-5 §7.2.6 names biometric templates
biometric_template_<type>, the ISO/IEC 19785-3 biometric type in snake
case (biometric_template_face, biometric_template_signature_sign).
The map wrote the literal biometric_template_xx, the input pattern
expected 5 characters and the mdoc schema 2. A {{XX}} key template now
stands for a capitalised word, written in snake case in the pointer:
biometricTemplateFace -> biometric_template_face. The validator
accepts {{XX}} pattern keys as it does {{NN}}.
- Remove the signed examples. The EDC ones contained a real person's
email address in this public repository, and none of them matched the
current maps; the playground shows every format signed and verified.
The address remains in git history.
h4nz4
force-pushed
the
feat/cel-mapping-poc
branch
from
October 8, 2026 07:10
aeabeef to
7ecca1e
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The short version
A credential map is a recipe. You give it the ingredients (the input fields) and it should bake a credential.
Until now, the recipes could only move an ingredient from one place to another. That is not enough to bake a real credential, so almost every recipe in this repo produced a broken one. This PR lets recipes do a little more (with CEL, a tiny, safe expression language) and fixes every recipe in the repo: mDL, all 10 Europass Digital Credential (EDC / ELM) types, the Open Badge microcredential, PID and age verification. A local playground lets you try it.
It also adds a v2 of eight types whose v1 EDCs looked fine as JSON but lost most of their data when Europass read them (see v2 below).
Spec:
specifications/cel-mapping.mdHow to review
It looks big (about 32,700 added lines), but about 22,000 are generated or copied in, so there is much less to read than the number suggests.
Skip these (generated by a script, or vendored from an official source):
.autogen/*credential-definitions/**/examples/*-example.jsonnpm run apply-map -- --write-examples(CI fails if stale)resources/vocabularies/*.jsonnpm run build-vocabularies(ELM XSDs, EU SPARQL)profiles/*/*/rulebook.jsonnpm run build-rulebooks(EUDI rulebooks)profiles/*/*/contexts/*,profiles/edc/w3c-vc/shacl/*.ttlprofiles/README.mdpackage-lock.json,demo/package-lock.jsonRead in this order:
specifications/cel-mapping.md: the rules, in about two pages..github/scripts/apply-credential-map.js: the runner (build, checks, examples). Its tests are inapply-credential-map.test.js.profiles/edc/w3c-vc/base-map.json, thencredential-definitions/microcredential/v1/edc/w3c-vc/input-fields-to-credential-map.json.credential-definitions/degree-certificate/v2/(map and schema), and one EAA type:credential-definitions/visa/v2/eaa/sd-jwt-vc/.demo/last; it's optional and doesn't affect the maps or CI.Commits, if you prefer reading by step: the first two are the original mDL proof of concept;
d5d91a4fixes the EDC schemas;43361ffEDC and Open Badge;53262b4the v2 types;7c9e6b4caveat fixes;2ab9389PID and age verification;8c6df20generated examples;57654b9rulebook and Open Badge checks;2090e1bthe playground;7ecca1ethe mDL biometric fix and removal of the signed examples.Check it yourself:
npm ci && npm run apply-map && npm testbuilds and validates every credential and runs the tests.Before and after
docTypeTry it:
Playground
Want to see it instead of reading it?
demo/is a small local web page. Pick any credential, change the input or the recipe, and watch the credential rebuild and re-validate as you type. Once it's valid, the page also signs it with a pretend issuer and checks the signature, the way a wallet or verifier would:@auth0/mdlandpymdoccbordc+sd-jwtwith a key-binding presentation@sd-jwt/sd-jwt-vcand the OpenWallet Foundation Python libraryjose(the full B-LTA check needs DSS)joseThe demo has its own
package.json, so CI and the map tooling don't install any of these libraries. Details indemo/README.md.What changed, explained simply
1. A recipe line is now a small formula. The key says where the value goes, the value says what it is:
input.?xandoptional.none()mean "if there is nothing, leave it out".2. Shared base recipes per profile. All 10 EDC types share the same envelope (
@context,type, issuer, display parameters…). Instead of copying it 10 times, it lives once inprofiles/edc/w3c-vc/base-map.json. Open Badge has its own inprofiles/open-badge/w3c-vc/. A type's own recipe is applied on top and wins on conflicts.3. Things a recipe can now read:
inputmetavocab"Slovenia"→http://publications.europa.eu/resource/authority/country/SVNtranslationsnow,uuid()In tests,
nowanduuid()are fixed, so every run produces exactly the same credential.4. EDCs are checked the way Europass checks them. Passing a JSON Schema only means the shape looks right. An EDC is linked data, so the runner also turns it into RDF (with the official ELM JSON-LD context) and validates it against the official ELM SHACL shapes. Everything is vendored, so this runs offline in about 0.3 s.
5. CI. A new job runs
npm ci,npm run apply-mapandnpm test. Every map in the repo is now a CEL map, so every one of them can fail the build.6. Works the same in Go. Every map entry and rule (624 of them) was evaluated with cel-go v0.28 and gave exactly the same values as the JS runner, so a Go issuer can use these files as they are.
v2: credentials that Europass can actually read
The problem. Think of an EDC as a form with official boxes. Eight v1 types wrote their own data in the margins (
studentNumber,degreeProgramme,flightInformation,visaNumber…). The JSON shows the scribbles, but Europass only reads the boxes, so to Europass a v1 degree certificate is little more than a name.The fix. v2 of these types writes everything into official ELM boxes. The input fields are exactly the same as v1, so the same data still goes in. Only the recipe and the schema change. v1 is left untouched, because the repo's rule is that existing versions never change and something may still read the v1 JSON paths.
LearningAchievement, specified by aQualification(the programme)LearningAchievementwith the ECTS points ascreditReceivedLearningEntitlement: the right to study in the programmeLearningEntitlementvalid from matriculation start to endLearningActivity(an educational programme) with its workloadLearningEntitlementof type membershipeaa/sd-jwt-vc), with Type MetadataAlso:
Identifiers on the person (with a scheme name such as "Student number")additionalNotes like "Academic year: 2026"personTitle(matriculation) has no ELM home and is not carried in the v2 EDCWrong labels are caught at the door
Some input fields need an exact label from a lookup table, like a dropdown. They are now marked, e.g.
"x-vocabulary": "country", so:"Slovenian") is an input error that names the table, before the map even runsresources/vocabularies/country.jsonMarked fields:
placeOfBirthin the v2 learning types,nationalityin visa v2, and the vocabulary fields of microcredential and certificate-of-attendance v1.SD-JWT VC type metadata
A
vctis the credential's type name. A wallet can look it up to learn what the credential is called and how to show each field. Visa and boarding-pass v2 now ship that lookup file,type-metadata.json(SD-JWT VC Type Metadata, draft 19). It holds a label for every claim, which claims are mandatory, and that the holder may choose to disclose each one (sd: allowed). Thevctis the file's raw GitHub URL onmain, so it can be fetched once this PR is merged. The runner checks that the map and the file agree.New lookup tables:
entitlementType,entitlementStatus,learningActivityType(from ELM) andcountryCode("Slovenia"→SVN, for SD-JWT VC, which has no linked data).PID and age verification
These are now CEL maps too, so every map in the repo is a CEL map and the old "move this field there" format is gone.
docType,vct) and the issuer's values frommeta: expiry and issuance date, issuing authority, country and jurisdiction, document number and trust anchor.docType. It can carry any number of age checks (ageOver18,ageOver21,ageOver65…). Plain CEL can't invent field names on the fly, so a map line can be a small template:age_over_{{NN}}←input.ageOver{{NN}}is repeated once for everyageOverNNfield in the input.Checked against the official rules, not just our own
Our schemas are written by us, so passing them only proves we agree with ourselves. Where an official, machine-readable rule exists, the runner now checks it too:
rulebook.json: allowed names, mandatory ones, encodings,docType/vctage_over_18/age_over_NNallowedThe PID check found a real bug: our PID mdoc used the SD-JWT VC address shape (
address.formatted, …) and avctelement, but the rulebook's mdoc encoding uses flatresident_address,resident_country, … and has novct. That is fixed, and the portrait is now raw bytes as the rulebook requires.Fixes to existing files
The EDC JSON Schemas rejected real, valid EDCs (including the ones Velocert issues today), so they are fixed in a separate commit:
the recipient e-mail had to be exactly
"mailto:"(no real address could pass). Now anymailto:address passes.display parameters and languages may be lists, as ELM allows
organisations may have an
eIDASIdentifier, which the ELM shapes require for the issuermicrocredential: label checks pointed at the wrong level and used labels that are not in the ELM vocabularies; an assessment's
specifiedBywas typedQualificationinstead ofLearningAssessmentSpecificationPID mdoc: the schema's
nationalitykey had a trailing space ("nationality "), so a correctnationalitywas always rejectedPID input:
nationalitywas declared a single string, but the example and both PID formats use a list (["DE", "AT"])mDL: biometric templates were written as the literal
biometric_template_xx. ISO/IEC 18013-5 §7.2.6 names them after the biometric type (biometric_template_face,biometric_template_signature_sign), so the map now uses a{{XX}}word template, the word-based sibling of{{NN}}Signed examples removed. The signed EDC examples contained a real person's email address in this public repo, and none of them matched the current maps. The address is still in git history; scrubbing it there is a decision for the maintainers. The playground shows every format signed and verified instead
Small input changes:
nationalIdCountryfield (ELM needs the country of a national ID). Anx-cel-rulemakes it required whennationalIdis set.type→written examination, visanationality→SloveniaageOver21field instead of the literal key"ageOver{{NN}}"Compatibility
_generated/…. That folder was renamed inaf1948b, so it was already out of date before this PR. A search of the Velocert, wallet and demo repos found no other reader of these maps or of the v1 field paths.credentialSubject.flightInformation(theksiashape). The v2 SD-JWT boarding pass doesn't have that, so the wallet needs to learn the newvctbefore it shows v2 as a boarding pass.Decisions
examples/<profile>-<initials>-example.jsonbuilt from its map. CI fails if one is out of date, so examples can't drift again. Regenerate withnpm run apply-map -- --write-examples. Signed examples were removed (see Fixes).iss,iat,nbf,exp,cnfandstatus, so a signed PID passes its own schema.Sources
9d7c5d2), ELM browser: EDC shapes documentationsupervision): publications.europa.eu/webapi/rdf/sparqlLearningEntitlement,LearningActivity,Identifier,Note): see the ELM ontology and EDC shapes