iOS SDK: NFC data listener

Prev Next

This feature needs to be enabled for your integration.

Contact your solutions engineer for info and configuration.

If enabled for your integration, you can receive real-time callbacks when the SDK successfully reads or fails to read NFC data from identity documents. This allows your app to get access to extracted NFC data (DG1 and DG2) for additional processing or analytics.

Use the NFC data listener when you need to:

  • Access raw NFC data (Machine Readable Zone and Face Image) for additional verification

  • Track NFC reading success/failure for analytics

  • Implement custom handling based on NFC scan results

  • Store NFC data in your own systems for compliance or audit purposes

Prerequisites

The listener will only receive callbacks if:

  • NFC reading has been enabled for your  integration by Veriff

  • The end-user's document supports NFC (e-passports, some ID cards)

  • The device has NFC hardware capability


Add NFC data listener

You must conform to the VeriffSdkDelegate protocol and assign a delegate to the VeriffSdk instance (as described in the Verification session status section in the iOS SDK guide):

veriff.delegate = self

The Veriff iOS SDK returns the NFC data extraction status by calling either nfcDataExtracted or nfcDataExtractionFailed methods:

extension VerificationService: VeriffSdkDelegate {
    func nfcDataExtracted(_ data: VeriffSdk.NFCData) {
        // ...
    }
    func nfcDataExtractionFailed() {
        // ...
    }
}

The VeriffSdk.NFCData contains DG1 and DG2 files in base64 representation.

nfcDataExtractionFailed is called for each unsuccessful scanning attempt, that can happen multiple times during the flow.


NFCData object

The NFCData object contains two properties:

Property

Type

Description

dg1

string

DATA GROUP 1 — Machine Readable Zone Information (Base64-encoded). Contains passport number, name, birth date, nationality, etc. Follows ICAO Doc 9303, part 10, Section 4.7.1.

dg2

string

DATA GROUP 2 — Encoded Identification Features — Face (Base64-encoded). Contains the face image from the document in JPEG2000 format. Follows ICAO Doc 9303, part 10, Section 4.7.2.


Decoding NFC data

The NFC data is provided as base64-encoded strings. To decode them back to binary data:

func nfcDataExtracted(_ data: Veriff.VeriffSdk.NFCData) {
    // Decode DG1 (Machine Readable Zone)
    let dg1Data = Data(base64Encoded: data.dg1)
    // Process DG1 binary data

    // Decode DG2 (Face Image)
    let dg2Data = Data(base64Encoded: data.dg2)
    // dg2Data contains JPEG2000 encoded face image
    // You can save this as a file or process it further
}


Additional info

Data Privacy

NFC data contains sensitive personal information:

  • DG1: full name, date of birth, document number, nationality

  • DG2: biometric face image

Ensure you:

  • Handle this data in compliance with GDPR, CCPA, and other privacy regulations

  • Implement appropriate security measures (encryption, secure storage)

  • Only retain data for as long as necessary

  • Have proper user consent mechanisms in place


Changelog

Date

Description

Feb 3, 2026

Documentation published