
Security News
Deno Goes the Way of the Dinosaur
Cloudflare is acquiring Deno’s team, which will provide another year of bug fixes and security updates before ending support for the runtime.
ISO/IEC 18013-5 mDL profile: element identifiers, age attestations and driving privileges
The mDL profile of ISO/IEC 18013-5:2021: what its element identifiers are, how each one is encoded, and the handful of rules that are easy to get wrong when issuing or verifying one.
@m-doc/core reads and writes the
document; this package says what belongs in it. It defines no value models of
its own — everything here is constants, types and functions over the claims you
already have.
Part of m-doc. Used throughout the runnable examples.
npm i @m-doc/mdl
An mDL conveys age without revealing a date of birth, through age_over_NN
elements. §7.2.5 defines what a request for one means, and it is not "return the
element with that name":
provide the nearest age attestation equal to or larger than NN with value TRUE, or smaller than NN with value FALSE
import { resolveAgeAttestation } from '@m-doc/mdl'
// The document holds only age_over_21, and that answers a request for 18
resolveAgeAttestation({ age_over_21: true }, 18)
// → { identifier: 'age_over_21', age: 21, value: true }
// Not being over 65 says nothing about being over 18
resolveAgeAttestation({ age_over_65: false }, 18)
// → undefined
Issuing works from the other side. §7.2.5 requires the values to hold at the
MSO's validFrom, not at the moment of issuance, so that is what you pass:
import { ageAt, buildAgeAttestations, readAgeAttestations } from '@m-doc/mdl'
buildAgeAttestations(birthDate, validFrom, [16, 18, 21, 65])
// → { age_over_16: true, age_over_18: true, age_over_21: false, age_over_65: false }
readAgeAttestations(claims) // every age_over_NN present, ascending
// → [{ identifier: 'age_over_18', age: 18, value: true }, …]
ageAt(birthDate, someDate) // whole years
The claim arrives as decoded CBOR — an array of Maps. Read it into something
typed:
import { privilegesFor, readDrivingPrivileges } from '@m-doc/mdl'
readDrivingPrivileges(claims.driving_privileges)
// → [{ vehicleCategoryCode: 'B', issueDate: DateOnly, codes: [{ code: '01', sign: '=', value: '1' }] }]
privilegesFor(claims.driving_privileges, 'B')
Every element Table 5 names has one fixed encoding — there is no choosing.
import { encodingFor, MDL_ELEMENT_ENCODING } from '@m-doc/mdl'
encodingFor('family_name') // 'tstr'
encodingFor('birth_date') // 'full-date'
encodingFor('portrait') // 'bstr'
encodingFor('height') // 'uint'
encodingFor('driving_privileges') // 'structure'
encodingFor('issue_date') // 'tdate-or-full-date' — Table 5 allows either
encodingFor('age_over_65') // 'bool' — any NN, not only the listed ones
encodingFor('org.example.custom') // undefined
MDL_ELEMENT_ENCODING is the map itself, if you would rather iterate it.
encodingFor is the one to call, because it also answers for age_over_NN,
where NN is open-ended.
import {
MDL_DOC_TYPE, // 'org.iso.18013.5.1.mDL'
MDL_NAMESPACE, // 'org.iso.18013.5.1'
jurisdictionNamespace, // jurisdictionNamespace('DE') → 'org.iso.18013.5.1.DE'
MDL_MANDATORY_ELEMENTS, // Table 5, presence M
MDL_OPTIONAL_ELEMENTS, // Table 5, presence O
parseAgeOverIdentifier, // 'age_over_18' → 18
Sex, // ISO/IEC 5218
EYE_COLOURS,
HAIR_COLOURS,
} from '@m-doc/mdl'
The identifier types are exported too — MdlElementIdentifier,
MdlMandatoryElementIdentifier, MdlOptionalElementIdentifier,
AgeOverIdentifier, MdlEncoding, EyeColour, HairColour, SexValue — so a
typo in an element name is a compile error rather than a claim nobody reads.
import { findMissingMandatoryElements, isExpired, isNotYetValid } from '@m-doc/mdl'
findMissingMandatoryElements(claims) // Table 5 elements the document lacks
isExpired(claims) // undefined where expiry_date was not disclosed
isNotYetValid(claims, someDate)
findMissingMandatoryElements is a finding on a document that was meant to be
complete — one straight from an issuer. A presented mDL is allowed to disclose a
subset; that is the point of selective disclosure.
isExpired and isNotYetValid return undefined rather than false when the
date they need was not disclosed, so "we do not know" never reads as "it is
fine".
Node 20.19 or newer. Ships ESM and CJS, with type declarations for both. Depends
only on @m-doc/core, and only for its DateOnly type.
Apache-2.0.
FAQs
ISO/IEC 18013-5 mDL profile: element identifiers, age attestations and driving privileges
The npm package @m-doc/mdl receives a total of 33 weekly downloads. As such, @m-doc/mdl popularity was classified as not popular.
We found that @m-doc/mdl demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.

Security News
Cloudflare is acquiring Deno’s team, which will provide another year of bug fixes and security updates before ending support for the runtime.

Security News
Anthropic’s free OSS Scanner uses Mythos and other Claude models to find open source vulnerabilities and send maintainers reports with proposed fixes.

Security News
On Front Lines’ Early Adopters: CISO podcast, Andrew Becherer shares lessons from Datadog, weighs the long-term costs of AI-built tools, and explains how founders can actually gain a CISO’s trust.