Getting Started | Usage | Contributing | License
An Expo Module with support for mDOC (e.g., mDL) data transfer, as specified in ISO/IEC 18013-5.
First, install the module using your package manager.
npm install expo-mdoc-data-transferThen add the config plugin to your app.json, so the required permissions and native configuration are applied:
{
"expo": {
"plugins": ["expo-mdoc-data-transfer"]
}
}Then prebuild the application so the Expo Module wrapper can be added as native dependency:
npx expo prebuildFor iOS installations, you need to follow the following steps:
- Add
expo-build-propertieswithios.useFrameworks: "dynamic" - If you want to use the new architecture (more efficient), add
expo-build-propertieswithnewArchEnabled: true
Run USE_FRAMEWORKS=dynamic npx pod-install after installing the npm package.
The Android implementation is built on top of Multipaz, which requires a minimum SDK version of 26. Add expo-build-properties with android.minSdkVersion: 26:
{
"expo": {
"plugins": [
"expo-mdoc-data-transfer",
[
"expo-build-properties",
{
"android": {
"minSdkVersion": 26
}
}
]
]
}
}The config plugin takes care of the rest of the native setup for you:
- Adds the Bluetooth (
BLUETOOTH_SCAN,BLUETOOTH_ADVERTISE,BLUETOOTH_CONNECT, and the legacyBLUETOOTH/BLUETOOTH_ADMIN) andNFCpermissions to the manifest. - Registers the NFC engagement
HostApduService, so the device can be engaged by tapping it against a reader. - Forces a single Bouncy Castle version (
bcprov-jdk18on/bcutil-jdk18on) and excludes the conflictingjdk15to18artifacts. - Excludes a duplicate
META-INFentry that otherwise fails the packaging step.
The Bluetooth permissions are declared in the manifest, but on Android they still have to be granted at runtime before starting an engagement. You are responsible for requesting them, for example using PermissionsAndroid from React Native:
import { PermissionsAndroid, type Permission } from 'react-native'
await PermissionsAndroid.requestMultiple([
'android.permission.BLUETOOTH_CONNECT',
'android.permission.BLUETOOTH_SCAN',
'android.permission.BLUETOOTH_ADVERTISE',
'android.permission.ACCESS_FINE_LOCATION',
'android.permission.ACCESS_COARSE_LOCATION',
] as Permission[])ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION are only required on Android 11 and below, where Bluetooth scanning is gated behind the location permission.
Finally, build and run the app on a physical device — Bluetooth and NFC are not available on an emulator:
npx expo run:androidYou can import expo-mdoc-data-transfer in your application.
Is there something you'd like to fix or add? Great, we love community contributions! To get involved, please follow our contribution guidelines.
This repository is licensed under the Apache 2.0 license.