Issue and verify digitally signed SMART Health Cards for vaccination history sourced from Epic immunization records, using an ES256-signed FHIR Verifiable Credential and QR-encoded JWS. MuleSoft handles the /.well-known/jwks.json key publication, credential minting, and offline QR verification.
Tags: healthcare, epic, fhir, smart-on-fhir, us-core, patient-access, api-led, interoperability
Vaccine Credentials / SMART Health Cards
Objective: Patients and verifiers need proof of vaccination that is tamper-evident, machine-readable, and verifiable offline without calling back to the issuer for every scan. Epic holds the authoritative Immunization records, but a raw FHIR export is neither signed nor QR-portable, and paper cards are trivially forged. Done looks like this: a patient authorizes access through MyChart, MuleSoft pulls their Immunization and Patient resources from Epic, packages them into a minified FHIR Health Card VC, signs it with a rotating ES256 key whose public half is published at a stable JWKS endpoint, and returns a scannable QR (or .smarthealthcard file). Any conformant verifier can then validate the signature and issuer offline, and revoked credentials are caught via a published revocation feed. This accelerator packages the Vaccine Credentials / SMART Health Cards Epic Data Sharing Playbook as a MuleSoft-anchored solution plan.
What's Getting Built
- Vaccine Credentials Experience API (Experience API) — handles the MyChart SMART launch, publishes JWKS, and verifies scanned health cards against the revocation feed ·
POST /credentials/$issue, GET /.well-known/jwks.json, POST /verify, GET /revocation
- Health Card Minting (Process API) — assembles the minified FHIR Health Card VC, signs it as a zip-deflated ES256 JWS, and encodes the shc:/ numeric QR ·
POST /mint, SIGN JWS ES256 zip:DEF, PUBLISH shc:/ QR
- Epic FHIR Reader (System API) — reads the patient's Patient and completed Immunization resources from Epic Bridges with the patient's SMART token ·
GET /Patient/{id}, GET /Immunization?patient={id}&status=completed
- JWKS Key Store (Object Store) — holds the rotating ES256 signing key thumbprints and retired public keys within their grace window until dependent cards expire ·
GET /keys/{kid}, PUT /keys/{kid}, DELETE /keys/{kid}
- Anypoint MQ (target) — queues bulk re-issuance after key rotation and dead-letters failed mints keyed by correlation ID with PHI redacted ·
PUBLISH reissue, CONSUME reissue, PUBLISH dlq
Prerequisites
- Epic FHIR R4 API access with the Immunization and Patient read scopes enabled, plus a registered SMART on FHIR app in the Epic App Orchard / open.epic client registry
- A SMART on FHIR patient-standalone launch with OAuth2 authorization code + PKCE so the patient authenticates via MyChart
- An ES256 (P-256) signing key pair with the private key held in Anypoint Secrets Manager or an external HSM/KMS, and a stable HTTPS origin for the issuer iss value
- Anypoint Platform with API-led layering (System/Process/Experience) and Anypoint MQ for asynchronous minting and dead-letter handling
- Agreement with the SMART Health Cards spec version (health card VC + JWS + numeric QR encoding) and enrollment of the issuer key in the VCI directory if federated trust is required
- DataWeave 2.x for FHIR-to-VC transformation and a QR/JWS library or connector for numeric-mode QR generation
1. Epic interfaces and standards
This accelerator implements the Vaccine Credentials / SMART Health Cards Epic Data Sharing Playbook. Register the connecting app on Epic on FHIR and confirm the customer has the relevant Epic modules licensed before building.
- Bridges FHIR R4 Immunization resource (vaccineCode CVX, occurrenceDateTime, lotNumber, performer)
- FHIR R4 Patient resource (US Core: name, birthDate) as the VC subject
- MyChart patient-standalone SMART on FHIR launch (OAuth2 authorization code + PKCE)
- SMART Health Cards framework: FHIR Health Card VC, ES256-signed JWS, numeric QR encoding, /.well-known/jwks.json
- US Core Immunization profile for required-element conformance
Architecture
2. Business requirements
- Issue a SMART Health Card only after the patient authenticates and authorizes through MyChart; never mint from an unauthenticated backend pull.
- Include only the minimum-necessary elements the spec requires: patient name, birth date, and the Immunization entries (CVX code, date, lot, performer) — omit address, MRN, and unrelated history.
- Support both a scannable QR and a downloadable .smarthealthcard JSON file so verifiers can accept whichever channel they use.
- Guarantee offline verification: a verifier must validate signature and issuer from the QR alone, using the public JWKS, without a callback to Epic or MuleSoft.
- Treat the issuer identity (iss) as a long-lived commitment — the origin and JWKS must stay stable across key rotations.
3. Ingestion and FHIR-to-VC mapping
- Pull Patient and Immunization?patient={id}&status=completed from the Epic System API using the patient's SMART token, not a system-level scope.
- In DataWeave, strip the FHIR resources to the minified Health Card form: remove resource ids, drop narrative text, and rewrite references to short resource:0 / resource:1 URIs.
- Map each Immunization to vaccineCode (CVX system http://hl7.org/fhir/sid/cvx), occurrenceDateTime, lotNumber, and performer.actor.display only.
- Set the VC type array to include https://smarthealth.cards#health-card, #immunization, and #covid19 when applicable so verifiers can filter.
- Reject records lacking a CVX code or completed status rather than emitting a partial card a verifier cannot trust.
4. Signing, key rotation, and JWKS publication
- Sign the VC as a compact JWS with alg ES256, zip-deflate the payload (zip: DEF header), and set kid to the RFC7638 thumbprint of the signing key.
- Publish the public keys at a stable /.well-known/jwks.json served by the Experience API, listing only current and grace-period keys.
- Rotate signing keys on a schedule but keep retired public keys in the JWKS until all cards signed with them expire, or verifiers will fail valid cards.
- Hold the private key in Anypoint Secrets Manager or an external KMS; never let it appear in logs, flow variables persisted to disk, or the DLQ payload.
- Encode the final QR in SMART numeric mode (shc:/ prefix, ord/chunk headers) so scanners decode it as a health card, not opaque text.
5. Verification and revocation
- Expose a verify endpoint that accepts a scanned shc:/ string, decodes numeric mode, inflates the payload, and validates the JWS against the cached JWKS.
- Check the iss against an allowlist (or the VCI issuer directory) so a valid signature from an untrusted issuer is still rejected.
- Publish a CRL-style revocation feed (rid values with a ctr counter per the spec) so credentials tied to corrected or erroneous immunization records can be invalidated.
- Cache remote JWKS with a bounded TTL and honor key rotation; do not hard-fail verification if one issuer's directory is briefly unreachable — degrade to cached keys.
- Return a structured verdict (valid / signature-invalid / untrusted-issuer / revoked / expired) rather than a bare boolean, so the Experience layer can message the patient precisely.
6. Orchestration and operations
- Mint synchronously for interactive MyChart requests, but queue bulk re-issuance (after a key rotation or CVX catalog update) through Anypoint MQ.
- Stamp every mint and verify with a correlation ID and log the kid used, never the payload PHI, so you can trace a bad card to a key without leaking data.
- Alert on the absence of a successful JWKS fetch from downstream verifiers — a silent JWKS outage breaks every card in the field, and dashboards rarely surface a request that simply stopped arriving.
- Route Epic FHIR failures and signing errors to a dead-letter queue keyed by correlation ID, with the PHI redacted from the DLQ record.
- Track key-expiry runway as a metric and page before a signing key's grace window closes, not after cards start failing.
7. Security and compliance
- Encrypt PHI in transit and at rest.
- Audit-log every access to and modification of patient data, and carry a correlation ID end to end.
- Enforce minimum-necessary access for integration operators and support users.
- Never persist the QR payload or the raw JWS to logs or the DLQ — it embeds the patient's name, birth date, and vaccination history.
- Bind minting to the patient's own SMART on FHIR token; a system-level Immunization scope would let one call mint a card for any patient.
- Isolate the ES256 private key in a KMS/HSM and grant the signing flow key-use, not key-export, permission.
- Serve /.well-known/jwks.json over TLS from the same stable origin as iss; a JWKS on a mismatched or mutable origin lets an attacker substitute keys.
Sample payload — Minified FHIR Health Card VC payload (pre-JWS, decoded from shc:/)
{
"iss": "https://health.example.org/issuer",
"nbf": 1755648000,
"vc": {
"type": [
"https://smarthealth.cards#health-card",
"https://smarthealth.cards#immunization",
"https://smarthealth.cards#covid19"
],
"credentialSubject": {
"fhirVersion": "4.0.1",
"fhirBundle": {
"resourceType": "Bundle",
"type": "collection",
"entry": [
{
"fullUrl": "resource:0",
"resource": {
"resourceType": "Patient",
"name": [{ "family": "Rivera", "given": ["Ana"] }],
"birthDate": "1984-03-11"
}
},
{
"fullUrl": "resource:1",
"resource": {
"resourceType": "Immunization",
"status": "completed",
"vaccineCode": {
"coding": [{ "system": "http://hl7.org/fhir/sid/cvx", "code": "208" }]
},
"patient": { "reference": "resource:0" },
"occurrenceDateTime": "2024-10-02",
"lotNumber": "FL8291",
"performer": [{ "actor": { "display": "Example Health Pharmacy" } }]
}
}
]
}
}
}
}
Testing and validation
- Round-trip a minted card through an independent SMART Health Cards verifier (e.g. the reference verifier) to confirm the JWS validates and the QR decodes.
- Validate the minified fhirBundle against the US Core Immunization profile and the Health Card VC schema before signing.
- Tamper with one byte of the deflated payload and confirm verification returns signature-invalid, not a soft pass.
- Rotate the signing key and confirm cards signed with the retired key still verify while it remains in the JWKS, then fail once removed.
- Add a rid to the revocation feed and confirm the verify endpoint reports revoked for the matching card.
- Verify the QR is emitted in numeric mode with the shc:/ prefix and chunk headers, and that a multi-chunk card reassembles in order.
Phased rollout
Phase 1 — Connect
- Register the SMART on FHIR app in the Epic client registry and confirm patient-standalone launch returns Immunization and Patient reads.
- Stand up the System API against the Epic FHIR R4 sandbox and generate the ES256 key pair in the KMS.
Phase 2 — Map and test
- Build the DataWeave FHIR-to-minified-VC transform and the JWS/QR numeric-mode builder, validating against the reference verifier.
- Publish /.well-known/jwks.json and exercise the verify + revocation endpoints with tampered, rotated, and revoked cards.
Phase 3 — Production
- Cut over to the production Epic FHIR endpoint, lock the iss origin, and enroll the issuer key in the VCI directory if federated trust is required.
- Enable Anypoint MQ bulk re-issuance and turn on JWKS-fetch and key-expiry alerting before onboarding patients.
Success metrics
- Median interactive mint latency from MyChart authorization to returned QR (target under 3 seconds)
- Verification success rate at external verifiers, split by valid / signature-invalid / untrusted-issuer / revoked
- Key-expiry runway in days before the active signing key's grace window closes
- JWKS endpoint availability and downstream fetch success rate
- Count of cards rejected pre-signing for missing CVX or non-completed status
Troubleshooting
- Verifiers report the signature is invalid on freshly minted cards. — Likely cause: The payload was signed without zip-deflate, or the kid does not match the RFC7638 thumbprint of the published key. Fix: Confirm the JWS header sets zip: DEF and that kid is the base64url-encoded SHA-256 JWK thumbprint of the exact key published in JWKS.
- A scanner reads the QR as plain garbled text instead of a health card. — Likely cause: The QR was encoded in byte/alphanumeric mode rather than SMART numeric mode with the shc:/ prefix. Fix: Regenerate the QR in numeric mode with the shc:/ prefix and ord/chunk headers so scanners route it to health-card handling.
- Cards minted last month suddenly fail verification everywhere. — Likely cause: A key rotation removed the retired public key from JWKS before those cards expired. Fix: Restore the retired public key to JWKS and keep every key listed until all cards signed with it have passed their expiry window.
- A corrected immunization record still verifies as valid on old cards. — Likely cause: The credential was never added to the revocation feed after the source record changed. Fix: Publish the card's rid to the revocation feed with an incremented ctr and confirm the verify endpoint returns revoked.
Deliverable: A deployable Anypoint blueprint that issues W3C-signed SMART Health Cards from Epic Immunization data and exposes a QR/JWS verification API, packaged as System/Process/Experience APIs with a rotating ES256 key store, revocation feed, and DataWeave FHIR-to-VC mappings.