Skip to content

Case study 12 · Identity and documents

React Native modules for passport chips and POS terminals

On two projects I wrote a hardware protocol natively and gave React Native a single API for it: a German passport's NFC chip, and over 100 payment terminals.

EngagementTwo engagements · German financial institution, 2020 · cross-border remittance, 2022 · both via agencyPublished

100+ terminals

the headline number

1 constraint

Neither the passport chip nor the payment terminal had a library worth using.

The story in 5 steps

Stack

  • Java
  • Kotlin
  • Swift
  • Turbo Modules
  • React Native
  • Android
  • NFC / ICAO 9303

01 · Context

Twice I had to make React Native talk to hardware that had no library worth using: the NFC chip in a German passport and a Chinese payment terminal running Android.

In both cases I implemented the protocol in the platform's own language and gave JavaScript a narrow interface, so platform details stayed out of the JavaScript code.

02 · Could not change

React Native works well until an app needs something the platform can do and JavaScript cannot reach.

Reading an e-passport means implementing a protocol, ICAO 9303, which requires an authentication handshake before the chip returns any data.
The Chinese payment terminal was harder still, because its SDK documentation was sparse and written in Spanish.
In both cases the bridge between the native code and JavaScript was the whole job.

03 · What I did

The passport reader (2020). I implemented the chip protocol in Java for Android, ported the same logic to Swift for iOS and exposed it to React Native through a Turbo Module.

Porting the same logic, instead of writing a second implementation from scratch, was the important decision.
An external service decoded the retrieved data, and my part was reading it off the chip.
The payment terminal (2022)I exposed the terminal's card, printer and hardware functions to React Native through a Turbo Module in Java.

04 · Result

Cryptographically signed passport data read from the chip on both platforms, from one protocol implementation

Over 100 payment terminals locked to a single app and updated over the network
Failed updates that cost nothing: the terminal kept working and retried

05 · Differently

On the passport module I ported the Java implementation to Swift by hand and verified it by testing.

Related services

The services that draw on this work.

Related writing

Posts that came out of this project.

Case study 12

Working on a similar problem? We reply within one business day.

The first call takes 30 minutes, and you’re under no obligation.

Tell us about your projectcontact@microtech.consulting