Skip to content

Add SMART Health Links eligibility example#36

Open
aleksandrkislitsyn wants to merge 2 commits into
mainfrom
add-smart-health-link-example
Open

Add SMART Health Links eligibility example#36
aleksandrkislitsyn wants to merge 2 commits into
mainfrom
add-smart-health-link-example

Conversation

@aleksandrkislitsyn

Copy link
Copy Markdown
Contributor

Summary

Adds an Aidbox-integrated SMART Health Links (SHL) example built on Bun + TypeScript. It securely shares the result of a long-running real-time eligibility (RTE) check with an unauthenticated client:

  1. Client kicks off the check → receives a shlink: carrying an encryption key
  2. Polls a manifest (can-changefinalized) while the async job runs
  3. Fetches the encrypted file (JWE, alg: dir / enc: A256GCM) and decrypts it client-side

The SHL key is the only secret — the server stores only ciphertext.

What's included

  • Bun + TypeScript service — native Bun.serve, no build step. Mints links, runs the async RTE job, manages manifest lifecycle, delivers the encrypted file.
  • Aidbox integration — init bundle with a SHLink custom resource and an shl-app App routing $kickoff (authenticated), manifest/{shlId}, and file/{fileId} (public).
  • Self-contained browser viewer (src/viewer.html, served at GET /) — resolves a shlink: and decrypts it with WebCrypto, with a step-by-step view of each HTTP call behind the flow.
  • QR code — the viewer renders the minted link as a scannable QR via an inline, dependency-free QR encoder (byte mode, EC level M, versions 1–20), so a phone wallet can pick up the link. No CDN — satisfies the viewer's strict CSP.

Output

A FHIR CoverageEligibilityResponse, encrypted as a JWE.

Verification

  • bunx tsc --noEmit passes.
  • Full stack runs via docker compose up --build (Aidbox + app); kickoff mints links and the viewer decrypts the result.
  • The QR encoder was round-trip tested against an independent decoder across every version 1–13 (including realistic ~300-char shlink payloads).

🤖 Generated with Claude Code

Adds an Aidbox-integrated SMART Health Links (SHL) example built on Bun +
TypeScript. It shares the result of an async real-time eligibility (RTE)
check with an unauthenticated client: kick off the check, receive a
shlink: carrying the encryption key, poll the manifest until finalized,
then decrypt the CoverageEligibilityResponse client-side.

Includes a self-contained browser viewer (src/viewer.html) that resolves
and decrypts links with WebCrypto, with a step-by-step view of each HTTP
call. The viewer renders the minted link as a scannable QR code via an
inline, dependency-free QR encoder (no CDN, satisfying the strict CSP).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant