npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-native-romanian-eid-sdk

v1.0.0

Published

Romanian eID & Passport NFC Reader SDK for React Native

Downloads

96

Readme

Romanian eID SDK for React Native

Romanian eID & Passport NFC Reader SDK for React Native. Read Romanian electronic identity documents (ePassports and ID cards) using NFC technology.

npm version License

Features

  • NFC Passport Reading - Read Romanian ePassports using BAC/PACE protocols
  • NFC ID Card Reading - Read Romanian electronic ID cards using PACE
  • MRZ Scanning - Camera-based MRZ (Machine Readable Zone) scanning
  • OCR Scanning - Extract data from old non-NFC ID cards using OCR
  • CSCA Validation - Validate document authenticity with CSCA certificates
  • Biometric Extraction - Extract photos and signatures from documents
  • ICAO 9303 Compliant - Full compliance with international standards
  • License Management - Secure JWT-based license system
  • TypeScript Support - Full TypeScript definitions included

Installation

npm install react-native-romanian-eid-sdk
# or
yarn add react-native-romanian-eid-sdk

iOS Setup

  1. Install CocoaPods dependencies:
cd ios && pod install
  1. Add required capabilities to your Info.plist:
<!-- NFC Reading -->
<key>NFCReaderUsageDescription</key>
<string>This app needs NFC to read electronic identity documents</string>

<!-- NFC ISO7816 Identifiers -->
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
    <string>A0000002471001</string>
    <string>A000000077030C60000000FE00000500</string>
    <string>E828BD080FA000000167454441544100</string>
</array>

<!-- Camera (for MRZ/OCR scanning) -->
<key>NSCameraUsageDescription</key>
<string>This app needs camera access to scan documents</string>
  1. Enable NFC capability in Xcode:

    • Open your project in Xcode
    • Select your target → Signing & Capabilities
    • Click "+ Capability" → Near Field Communication Tag Reading
  2. Add the RomanianEIDSDK.xcframework to your project (already included in the pod).

Android Setup

  1. Add permissions to AndroidManifest.xml:
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.CAMERA" />

<uses-feature
    android:name="android.hardware.nfc"
    android:required="false" />
<uses-feature
    android:name="android.hardware.camera"
    android:required="false" />
  1. TODO for Android developer: Complete the native Android implementation in android/src/main/java/com/rnromanianeidsdk/RNRomanianEIDSDKModule.java. See inline comments for detailed instructions.

Quick Start

1. Initialize SDK

import EIDReader from 'react-native-romanian-eid-sdk';

// Initialize with your license key
await EIDReader.initialize('YOUR_LICENSE_KEY_JWT');

2. Read a Passport

// Scan MRZ first (optional, or enter manually)
const mrzResult = await EIDReader.startMRZScanning();

// Read passport via NFC
const result = await EIDReader.readPassport(mrzResult.mrzKey, {
  enableCSCAValidation: true,
  timeout: 60,
});

console.log('Name:', result.fullName);
console.log('Document:', result.documentNumber);
console.log('Photo:', result.facialImageBase64); // base64 encoded image

3. Read an ID Card

// Read electronic ID card via NFC
const result = await EIDReader.readIDCard(
  '123456', // CAN (6 digits)
  '1234',   // PIN (4-8 digits)
  {
    enableCSCAValidation: true,
    readPhoto: true,
    readSignature: true,
    timeout: 90,
  }
);

console.log('CNP:', result.cnp);
console.log('Name:', result.fullName);
console.log('Address:', result.permanentAddress);

4. Scan Old ID Card (OCR)

// For old non-NFC ID cards
const result = await EIDReader.startOCRScanning();

if (result.isReliable) {
  console.log('CNP:', result.cnp);
  console.log('Name:', result.fullName);
  console.log('Confidence:', result.confidence);
} else {
  console.warn('Low confidence:', result.validationIssues);
}

API Reference

Main Methods

initialize(license: string): Promise<boolean>

Initialize SDK with license key.

await EIDReader.initialize('eyJhbGciOiJIUzI1NiIs...');

readPassport(mrzKey: string, options?: PassportReadOptions): Promise<PassportResult>

Read Romanian ePassport via NFC.

Parameters:

  • mrzKey - MRZ key (format: DocumentNumber+DOB+Expiry with check digits)
  • options - Optional configuration

Options:

{
  enableCSCAValidation?: boolean; // Default: true
  timeout?: number;                // Default: 60 seconds
}

Returns: PassportResult with document data and biometrics.

readIDCard(can: string, pin: string, options?: IDCardReadOptions): Promise<IDCardResult>

Read Romanian electronic ID card via NFC.

Parameters:

  • can - Card Access Number (6 digits printed on card)
  • pin - Personal PIN (4-8 digits)
  • options - Optional configuration

Options:

{
  enableCSCAValidation?: boolean; // Default: true
  readPhoto?: boolean;             // Default: true
  readSignature?: boolean;         // Default: true
  timeout?: number;                // Default: 90 seconds
}

Returns: IDCardResult with personal data, addresses, and biometrics.

startMRZScanning(): Promise<MRZScanResult>

Open camera to scan MRZ from passport.

Returns: MRZScanResult with parsed MRZ data and mrzKey for NFC reading.

startOCRScanning(): Promise<OCRScanResult>

Open camera to scan old non-NFC ID card using OCR.

Returns: OCRScanResult with extracted data and confidence scores.

isNFCAvailable(): Promise<boolean>

Check if NFC is available and SDK is initialized.

getLicenseInfo(): Promise<LicenseInfo>

Get current license information.

Event Listeners

// Progress updates during NFC reading
const subscription = EIDReader.onReadProgress((event) => {
  console.log(`${event.percentage}%: ${event.message}`);
});

// Remember to unsubscribe
subscription.remove();
// or
EIDReader.removeAllListeners();

Result Types

PassportResult

{
  success: boolean;
  documentNumber: string;
  fullName: string;
  dateOfBirth: string;
  nationality: string;
  sex: string;
  dateOfExpiry: string;
  cnp?: string;
  placeOfBirth?: string;
  residenceAddress?: string;
  phoneNumber?: string;
  facialImageBase64?: string;      // JPEG base64
  signatureImageBase64?: string;   // PNG base64
  cscaValidated: boolean;
  cscaCountry?: string;
  errorMessage?: string;
}

IDCardResult

{
  success: boolean;
  documentNumber: string;
  cnp: string;
  fullName: string;
  dateOfBirth: string;
  sex: string;
  dateOfExpiry: string;
  issuingAuthority?: string;
  placeOfBirth?: string;
  citizenship?: string;
  permanentAddress?: string;
  temporaryAddress?: string;
  foreignAddress?: string;
  facialImageBase64?: string;
  signatureImageBase64?: string;
  cscaValidated: boolean;
  errorMessage?: string;
}

Error Handling

try {
  const result = await EIDReader.readPassport(mrzKey);
} catch (error) {
  switch (error.code) {
    case 'NFC_NOT_AVAILABLE':
      console.error('NFC not available on this device');
      break;
    case 'INVALID_MRZ':
      console.error('Invalid MRZ key');
      break;
    case 'USER_CANCELLED':
      console.log('User cancelled the operation');
      break;
    case 'READ_TIMEOUT':
      console.error('Reading timed out');
      break;
    case 'LICENSE_INVALID':
      console.error('Invalid or expired license');
      break;
    default:
      console.error('Error:', error.message);
  }
}

Example App

A complete example app is included in the example/ directory. To run it:

# Install dependencies
cd example
yarn install

# iOS
cd ios && pod install && cd ..
yarn ios

# Android
yarn android

The example app demonstrates:

  • Passport reading with MRZ scanning
  • ID card reading with CAN/PIN input
  • OCR scanning for old cards
  • License status display

Requirements

iOS

  • iOS 15.0 or later
  • NFC-capable device (iPhone 7 or later)
  • Valid iOS Developer account (for NFC entitlement)

Android

  • Android API 21 (Lollipop) or later
  • NFC-capable device
  • Note: Android implementation needs to be completed (see TODO in source)

License

This SDK is commercial software. A valid license key is required for use.

For licensing information, contact: [email protected]

Support

Security & Privacy

  • All NFC communication is encrypted (BAC/PACE protocols)
  • No data is sent to external servers
  • CSCA validation performed locally
  • Biometric data never leaves the device
  • License validation done via JWT

Credits

Developed by Up2Date Software

© 2025 Up2Date. All rights reserved.