Tap2iD SDK for Windows - API Reference

API reference for the Tap2iD Windows SDK. Covers SDK initialization and mDL verification over BLE and NFC.

Overview

The Tap2iD Windows SDK verifies ISO 18013-5 mobile driver's licenses (mDLs) over BLE and NFC. Use Tap2iDSdk: initialize it once with your license key, then call VerifyMdoc for each session.

  • Language: C# / .NET 8.0
  • Platform: Windows 10 / 11 (x64)
  • Transport: BLE, NFC.
  • Standard: ISO/IEC 18013-5:2021

Installation

Add the Credence ID Nexus repository to your NuGet sources in Visual Studio, then install Tap2iDSdk. Requires .NET 8.0 and Windows 11+.

Register on the Verify with Credence to get your license key before integrating the SDK.

NuGet Source URL

nuget.config
https://nexus.credenceid.com/repository/tap2id-sdk-nuget/

Auto-installed dependencies

BluetoothWinUI
BluetoothBumble
Tap2idBluetoothCommon
Logging
01

Initialize SDK

Call InitSdk once at startup, before any mDL verification. Pass your license key in CoreSdkConfig, and attach result callbacks through InitSdkResultListener.

Tap2iDSdk: InitSdk()
/// Initializes the SDK with the provided configuration.
public void InitSdk(
    CoreSdkConfig        coreSdkConfig,
    InitSdkResultListener sdkInitlistener
);

CoreSdkConfig

PropertyTypeDefaultDescription
ApiKeystring""Your Verify with Credence license key. required
PackageNamestring""Application package identifier. optional

InitSdkResultListener delegates

OnInitializationSuccess(SdkInitializationResult result)
Invoked when initialization completes successfully.
OnInitializationFailure(Tap2iDResultError error, string ErrorMessage)
Invoked on failure. Provides structured error code and diagnostic message.

Example

C#
var config   = new CoreSdkConfig { ApiKey = "YOUR_API_KEY_HERE" };
var listener = new InitSdkResultListener
{
    OnInitializationSuccess = result  => Console.WriteLine("SDK ready"),
    OnInitializationFailure = (e, msg) => Console.WriteLine($"Failed: {e}: {msg}")
};
sdk.InitSdk(config, listener);
02

Verify mDL

Call VerifyMdocAsync with the engagement string from a QR scan, NFC tap, or BLE discovery. Subscribe to DelegateVerifyState for progress updates.

Tap2iDSdk: VerifyMdocAsync()
public Task<Tap2iDResult> VerifyMdocAsync(
    MdocConfig          mdocConfig,
    DelegateVerifyState State,
    CancellationToken   cancellationToken = default
);

MdocConfig Properties

PropertyTypeDefaultDescription
DeviceEngagementStringstring""Encoded engagement payload. Required for QR code engagement
EngagementModeDeviceEngagementModeQrCodePhysical capture method (QrCode or Nfc).
BleWriteOptionBleWriteOptionWriteBLE write mode: Write or WriteWithoutResponse.
IsReaderAuthenticationboolfalsePresent verifier certificate to holder device.
NfcReaderNameFilterstring?nullSubstring to select a specific NFC reader. optional
NfcDeviceEngagementTimeoutint30sNFC engagement wait time. Range: 5–300.
BleConnectionTimeoutint10sBLE scan + connect phase. Range: 5–300.
BleConsentAndDataTransferTimeoutint30sConsent + data transfer after connection. Range: 5–300.

VerifyState Lifecycle

DeviceEngagementStarted
DeviceEngagementEnded
DeviceConnectionStarted
DeviceConnectionEnded
UserConsentStarted
UserConsentEnded
DataTransferStarted
DataTransferEnded
DataValidationStarted
DataValidationEnded

Example

C#: QR Code Verification
var config = new MdocConfig
{
    DeviceEngagementString           = qrCodeData,
    EngagementMode                   = DeviceEngagementMode.QrCode,
    BleConnectionTimeout             = 15,
    BleConsentAndDataTransferTimeout = 45
};
Tap2iDResult result = await sdk.VerifyMdocAsync(config, new DelegateVerifyState
{
    OnVerifyState = state => Console.WriteLine($"→ {state}")
});
03

VerifiedDocument

PropertyTypeDescription
DocTypestringISO document type, e.g. org.iso.18013.5.1.mDL
AuthenticationAuthenticationResultCryptographic and trust verification for this document.
NamespacesList<NamespaceData>Attributes organized by namespace → key → value.
Always check ResultError before accessing Documents: a non-OK result may return an empty or partial list.
04

Retrieve Data

Iterate through Namespaces and their Items to access attribute values. Binary fields like portrait and signature_usual_mark are returned as byte[].

C#: Extracting Document Data
foreach (var doc  in result.Documents)
foreach (var ns   in doc.Namespaces)
foreach (var item in ns.Items)
{
    if (item.Key == "portrait" && item.Value is byte[] img)
        { /* render as ImageSource */ continue; }

    Console.WriteLine($"{item.Key}: {item.Value}");
}
Primary mDL namespace: org.iso.18013.5.1. Common fields: family_name, given_name, birth_date, document_number, portrait, driving_privileges.
05

Security Status

Each VerifiedDocument has an AuthenticationResult with five checks. Review them before trusting the data.

C#: Security Checks
var auth = doc.Authentication;
bool isTrusted    = auth.TrustAttributes.IsIssuerTrusted;
bool deviceSigned = auth.SecurityChecks.IsDeviceSignedValid;
bool issuerSigned = auth.SecurityChecks.IsIssuerSignedValid;
bool digestsValid = auth.SecurityChecks.AreDigestsValid;
var  msoStatus    = auth.MsoValidity.Status; // Valid | NotYetValid | Expired

foreach (var err in auth.ValidationErrors)
    Console.WriteLine($"Error: {err.Message}");
PropertyTypeDescription
TrustAttributes.IsIssuerTrustedboolIssuing CA found in the SDK trust store.
SecurityChecks.IsDeviceSignedValidboolECDSA/MAC device signature passes verification.
SecurityChecks.IsIssuerSignedValidboolMobile Security Object signature is valid.
SecurityChecks.AreDigestsValidboolData item hashes match MSO digests.
MsoValidity.StatusMsoStatusValid, NotYetValid, or Expired.
ValidationErrorsList<ValidationError>Detailed issues. Empty when all checks pass.

Reference

Class Reference

NfcCommunicationException

Thrown when an error occurs during NFC data exchange.

ConstructorDescription
NfcCommunicationException(string message)Creates exception with descriptive message.
NfcCommunicationException(string message, Exception inner)Wraps the underlying NFC failure.

CommunicationBleCentralClientMode

Manages the BLE Central role for reading from a holder device acting as a peripheral.

MemberTypeDescription
SetTimeout(int)voidOverrides BLE operation timeout in seconds.
BleWriteOptionBleWriteOptionAcknowledged write or fire-and-forget mode.
ConsentStartedEventHandler?Fires when holder device begins consent flow.
ConsentEndedEventHandler?Fires when consent flow completes.
MessageReceivedMessageReceivedHandler?Raw BLE message as byte[].
Reference

Error Codes

Returned via Tap2iDResult.ResultError and the OnInitializationFailure callback.

SDK / License

Enum nameValueDescription
OK0No error.
LicenceError1License is invalid.
NoNFCTagDetected2No NFC tag was presented.
LicenceExpiredLicenceError10License expired.
ApiExceptionLicenseError11Failed to verify license.

Transaction / Connection

Enum nameValueDescription
ERROR_INVALID_BARCODE / ERROR_INVALID_QR_CODE111Invalid QR code.
ERROR_NFC_STATIC_HANDOVER112NFC connection failed.
ERROR_NFC_NEGOTIATED_HANDOVER113NFC connection failed.
ERROR_NFC_NOT_ENABLED114NFC not enabled.
ERROR_DE_CONNECTION_TIMEOUT115Bluetooth connection timed out.
ERROR_NFC_TAG116NFC connection failed, not an ID.
ERROR_GENERAL117Unknown error.
OperationCancelled130Operation cancelled by caller.
ERROR_GENERAL_NFC_DEVICE_ENGAGEMENT132Unknown NFC error during device engagement.
ERROR_TAG_LOST133NFC tag lost.
ERROR_BLE_CONNECTION212Bluetooth connection failed.
ERROR_BLE_L2CAP213Bluetooth L2CAP connection failed.
ERROR_DR_CONNECTION_TIMEOUT214Data retrieval timed out.
ERROR_CONSENT_DENIED_FOR_ALL216Holder denied sharing all data.
ERROR_CONSENT_DENIED_FOR_FEW217Holder denied sharing some data.
ERROR_DR_UNKNOWN_ERROR218Data retrieval failed, unknown error.
ERROR_CONSENT_DENIED_FOR_ALL_ATTRIBUTE219Consent denied, no attribute returned.
Hardware

Supported Hardware

BLE Dongles

The BLE transport uses the Bumble library and requires a compatible USB Bluetooth adapter.

VID/PIDDevice
0BDA / A728Realtek BLE Adapter
0BDA / 8771Startech Adapter / USBA-BLUETOOTH-V5-C2

NFC Readers

Any PC/SC-compatible USB NFC reader. Most readers work with the standard Windows drivers.

QR / Barcode

Any built-in or USB webcam, or USB barcode scanner operating as a standard HID / keyboard wedge device.

Credence ID recommends the Mini BT540 or Mini BT542 USB adapters for best Bluetooth range and reliability.