Business · Product · Technology · AI

Separate health-card token integrity from online revocation

A Movo-X health-card case tracing signed binary claims, exact expiry, clinic-scoped staff checks, database token versions and bounded NDEF encoding.

Work directly with Omer Muneer Qazi · Reviewed 29 November 2026

The scenario: a valid code can still refer to an outdated card state

A health-card code needs to resist modification, expire according to its intended use and stop being accepted after its authorization state changes. These are different checks. A cryptographic verifier can establish integrity and encoded expiry without knowing whether the current database still accepts that card version.

The inspected Movo-X implementation separates token construction, staff-side scanning and authoritative card lookup. Eleven isolated cases examine selected format, expiry, route, role and encoding boundaries. Synthetic keys and identifiers are used throughout; no real card or patient record was accessed.

Use a defined signed format without confusing it with encryption

The token contains a format version, card and facility identifiers, token version, kind and expiration time in a fixed binary representation. A purpose-prefixed HMAC-SHA256 calculation contributes a truncated sixteen-byte authentication tag. The result is encoded with a recognizable prefix and base64url.

The existing cases check round trips, selected tampering and wrong-key refusal. A supplemental case decodes the card and facility bytes directly. Those identifiers are authenticated but not encrypted. The absence of a name or clinical text in the token does not make its identifiers anonymous or prevent correlation of copied codes.

Give each token kind an explicit lifetime

The inspected helper uses a short app-token lifetime and longer wallet/NFC lifetimes. The encoded expiration is calculated in whole seconds. Verification refuses a token at the exact expiration instant rather than allowing an extra endpoint interval.

The supplemental boundary case checks one millisecond before expiration and the exact expiration time. These tests use supplied clocks, not a distributed clock-synchronization measurement. A longer-lived token’s operating risk and refresh behaviour still depend on its audience and authoritative state checks, not simply on a passing HMAC test.

Authorize card access before issuing its display tokens

The reviewed patient QR route first obtains the card through its service operation, propagates a refusal and checks the returned revoked state before minting app and NFC tokens. Its selected response supplies expiry, a refresh hint, alternative text and an encoded NDEF message with no-store caching.

The injected route fixture checks the current supplied token version, selected output shape and revoked-card refusal. It does not execute the database authorization behind that service response. Nor does it prove that an app actually refreshes the code, writes a tag or displays an accessible QR screen correctly.

Check the staff audience and clinic before the database call

The staff adapter checks its permitted role set and validates the scanned token’s shape, integrity, expiry and facility against the staff context. It passes accepted card claims to the verification RPC rather than accepting a caller-supplied patient identity as the result.

The selected fixtures check refusal of another clinic’s token, expired or malformed input and an unpermitted role before the mock RPC. The check-in and revoke case also checks selected request-identifier, read-only and input-shape guards. These are adapter decisions with injected access context, not proof of the current deployed staff-session configuration.

Use the authoritative version lookup to revoke old tokens

The pinned SQL card lookup requires the card, tenant, facility, non-revoked state and current token version to match. The reviewed token-revoke operation increments that version. An old signature can remain cryptographically valid while failing the current authoritative lookup because its embedded version is older.

A supplemental helper case mints two versions and shows that the offline cryptographic verifier accepts both before expiry. The SQL comparison was inspected without execution. A version bump revokes earlier tokens when that comparison is consulted; it does not remotely erase a printed code or become a permanent card deletion by itself.

Keep verification, check-in and possession as separate claims

The selected staff verification path and check-in command have different operations and role rules. The command includes request identity and delegates the actual appointment/queue transition. Source SQL also has its own access, migration-review and request-reuse checks, which were reviewed only in their selected branches.

A code’s possession does not independently establish the physical presenter’s identity, and verification is not evidence that a check-in was accepted. The injected fixture checks command construction and response mapping. Actual database transitions, audit rows, replay behaviour and appointment selection need authoritative tests of their own.

Treat NDEF bytes as an encoding contract rather than hardware acceptance

The helper constructs one short well-known text record with language metadata and UTF-8 content. The existing case checks selected header and payload bytes. Supplemental ASCII and CJK cases check the payload endpoint, including the bytes consumed by the language metadata.

These are serialized-byte tests. They do not exercise a tag writer, reader device, mobile NFC permission or wallet barcode scanner. The same distinction applies to a token-bearing wallet pass: constructing a token does not establish that a platform accepted the pass or that a scanner uses the required online revocation lookup.

A practical health-card acceptance package

Keep synthetic format, wrong-key, tamper, exact-expiry, clinic-scope, staff-role and NDEF-byte fixtures. Add database tests that invalidate a prior token version and confirm current role and request-reuse rules. Then test the actual QR, wallet and NFC journeys on their intended clients and scanners.

For a CTO, the case makes integrity, lifetime, audience and current card state independently reviewable. The pinned source and eleven scoped cases establish selected software boundaries. Installed authorization, physical identity verification, device behaviour and end-to-end revocation remain separate acceptance evidence.

Compare the reviewed boundaries

Independent decisions behind one health-card scan

On smaller screens, scroll across to compare every column. Keyboard users can focus the table and use the arrow keys.

DecisionEvidence in this caseSeparate acceptance
Integrity and expirySynthetic HMAC, tamper and exact-time casesKey custody and operating clocks
Clinic and staff scopeSelected adapter refusals before mock RPCCurrent authenticated staff context
Current token versionPinned SQL comparison and bump reviewedExecuted database revocation test
QR/NFC representationInjected route shape and NDEF byte casesActual display, tag and scanner behaviour

Illustrative control flow

Pseudocode summarizing the decision boundary. It is not copied production code or a deployment instruction.

claims = verify_integrity_and_encoded_expiry(scanned_token)
require_matching_staff_clinic_and_permitted_role(claims)
current_card = authoritative_lookup(claims.card_id, claims.version)
perform_separately_authorized_checkin_if_requested(current_card)

# Base64url is readable encoding; a valid MAC does not query revocation state.

About this engineering series

Written by Omer Muneer Qazi from a review of Movo-X implementation and dated engineering records. This article explains source behaviour and historical observations; current production, clinical outcomes and store availability require their own verification. Examples are synthetic and proposed test cases are identified as such.

Explore the Movo-X engineering series → · Related implementation experience →

Discuss a similar engineering problem

Send the workflow, current platform and the decision your team needs to make. I can help define an implementation or review scope with concrete acceptance evidence.

Discuss your project on WhatsApp ↗
WhatsApp Omer about this project ↗