iOS SDK ยท API Reference

Tap2iD SDK โ€” iOS API Reference

Complete API reference for integrating the Tap2iD iOS SDK. Initialize, verify mDLs, handle delegates, and evaluate security checks via NFC, QR code, PDF417, or external NFC reader.

Explore API
>_ tap2id-ios-sdk โ€“โ€“docs
01
initSdk
Configure your API key via CoreSdkConfig and boot the SDK before performing any mDL verification.
02
verifyMdoc
Start verification via NFC, QR code, PDF417, or external NFC reader with a single method call.
03
Delegates
Track verification lifecycle and external NFC reader events through Tap2iDVerifySDKDelegate and NfcExternalReaderDelegate.
04
Result Models
Inspect VerificationResult โ€” extracted attributes, namespaces, authentication details, and JSON export.
05
Security & Trust
Evaluate issuer trust, device and issuer signatures, digest validity, and MSO expiry status.
06
Enums
VerificationStage, EngagementConfig, VerificationStatus, MsoStatus, and TrustResult reference.
Overview

CoreTap2iDVerifySDK

The CoreTap2iDVerifySDK protocol defines the core functionalities of the Tap2iD Verify SDK. The singleton entry point is Tap2iDVerifySDK.shared.

โ„น Register on the Verify with Credence portal first to obtain your API key before integrating the SDK.
01

initSdk

Initializes the SDK with the provided configuration. Call once at app startup before any mDL verification session.

CoreTap2iDVerifySDK โ€” initSdk()
func initSdk(
    config: CoreSdkConfig,
    initResult: @escaping (String?, String?, String?) -> Void
)

Parameters

ParameterTypeDescription
configCoreSdkConfigCore SDK configuration containing the API key. required
initResult(String?, String?, String?) -> VoidCallback returning status, message, and optional additional information. required

CoreSdkConfig

Swift
public struct CoreSdkConfig {
    public var apiKey: String
}
02

verifyMdoc

Starts verification of a mobile driver's license (mDL). Supports NFC, QR code, PDF417, and external NFC reader engagement. Returns an Error? โ€” nil means the session started successfully.

CoreTap2iDVerifySDK โ€” verifyMdoc()
func verifyMdoc(
    engagementConfig: EngagementConfig,
    delegate: Tap2iDVerifySDKDelegate?,
    readerDelegate: NfcExternalReaderDelegate?
) -> Error?

Parameters

ParameterTypeDescription
engagementConfigEngagementConfigEngagement method โ€” .nfc, .qrCode, .pdf417, or .nfcExternalReader. required
delegateTap2iDVerifySDKDelegate?Verification lifecycle delegate for stage and result callbacks. optional
readerDelegateNfcExternalReaderDelegate?External NFC reader delegate. Only required when using .nfcExternalReader. optional

EngagementConfig

Swift โ€” EngagementConfig enum
public enum EngagementConfig {
    case nfc
    case qrCode(String)
    case pdf417(String)
    case nfcExternalReader
}

stopMonitoring

Stops monitoring for NFC tags or external NFC readers. Call this when your view disappears or verification should be cancelled.

Swift
func stopMonitoring()
Delegates

Tap2iDVerifySDKDelegate

Implement this delegate to receive granular lifecycle callbacks throughout the verification process.

onVerificationStageStarted(stage: VerificationStage)
Called when a verification stage begins.
onVerificationStageError(stage: VerificationStage?, error: CoreCredenceErrorStruct?)
Called if a verification stage encounters an error.
onVerificationStageCompleted(stage: VerificationStage)
Called when a verification stage completes successfully.
onVerificationCompleted(verificationResult: VerificationResult?)
Called with the final verification result and all credential data.
Swift โ€” Delegate Implementation
extension YourClass: Tap2iDVerifySDKDelegate {

    func onVerificationStageStarted(stage: VerificationStage) {
        // Handle verification stage start
    }

    func onVerificationStageError(
        stage: VerificationStage?,
        error: CoreCredenceErrorStruct?
    ) {
        // Handle verification error
    }

    func onVerificationStageCompleted(stage: VerificationStage) {
        // Handle verification stage completion
    }

    func onVerificationCompleted(
        verificationResult: VerificationResult?
    ) {
        // Handle final verification result
    }
}

NfcExternalReaderDelegate

The NfcExternalReaderDelegate protocol defines delegate methods for handling external NFC reader and smart card connection events.

Swift โ€” NfcExternalReaderDelegate
public protocol NfcExternalReaderDelegate: AnyObject {

    func didDetectReaders()         // External NFC reader detected
    func didDisconnectFromReader()   // External reader disconnected
    func didDetectSmartCard()        // Smart card detected
    func didDisconnectFromSmartCard() // Smart card disconnected
}
Reference

VerificationStage

Represents each stage in the mDL verification pipeline, reported via onVerificationStageStarted, onVerificationStageCompleted, and onVerificationStageError.

Swift โ€” VerificationStage enum
public enum VerificationStage {
    case NFC_ENGAGEMENT
    case QR_ENGAGEMENT
    case PDF417
    case CONNECTION
    case SEND_MDOC_REQUEST
    case READ_MDOC_RESPONSE
    case PARSE_MDOC_RESPONSE
    case VALIDATE_MDOC_RESPONSE
}
NFC_ENGAGEMENT
QR_ENGAGEMENT
PDF417
CONNECTION
SEND_MDOC_REQUEST
READ_MDOC_RESPONSE
PARSE_MDOC_RESPONSE
VALIDATE_MDOC_RESPONSE

Result Models

Verification Result Model

The VerificationResult delivered via onVerificationCompleted contains all extracted credential documents and the overall verification status.

Swift โ€” VerificationResult
public struct VerificationResult {
    public let documents: [VerifiedDocument]
    public let status: VerificationStatus
}

public struct VerifiedDocument {
    public let docType: String
    public let nameSpaces: [VerifiedNamespace]
    public let authentication: AuthenticationDetails
}

public struct VerifiedNamespace {
    public let name: String
    public let attributes: [String: Any?]
    public let requestedAttributeStatus: [String: Bool]
}

public struct AuthenticationDetails {
    public let security: SecurityDetails
    public let msoValidity: MsoValidityDetails
    public let trust: TrustDetails
    public let errors: [String]
}
PropertyTypeDescription
documents[VerifiedDocument]Array of verified documents from the mDL response.
statusVerificationStatusOverall result: success, partialSuccess, or failure.
docTypeStringISO document type, e.g. org.iso.18013.5.1.mDL.
nameSpaces[VerifiedNamespace]Credential attributes organised by namespace.
authenticationAuthenticationDetailsSecurity, MSO validity, and trust details for the document.
โœฆ Primary mDL namespace: org.iso.18013.5.1. Common fields: family_name, given_name, birth_date, document_number, portrait. Use attributes on VerifiedNamespace to access them.

JSON Export

Convert the full verification result to a JSON string for logging or transmission.

Swift
extension VerificationResult {
    public func toJsonString() -> String?
}

// Usage
if let json = verificationResult?.toJsonString() {
    print(json)
}
Security & Trust

Security & Trust Models

Each AuthenticationDetails exposes three independent structs to evaluate before trusting the credential data.

Swift โ€” Security & Trust structs
public struct SecurityDetails {
    public let isIssuerSignedValid: Bool
    public let isDeviceSignedValid: Bool
    public let areDigestsValid: Bool
}

public struct MsoValidityDetails {
    public let status: MsoStatus
    public let signedTimestamp: Int64?
    public let validFromTimestamp: Int64?
    public let validUntilTimestamp: Int64?
}

public struct TrustDetails {
    public let isIssuerTrusted: Bool
    public let chainStatus: TrustResult
    public let issuerDistinguishedName: String?
}
PropertyTypeDescription
isIssuerSignedValidBoolMobile Security Object (MSO) signature is valid.
isDeviceSignedValidBoolECDSA/MAC device signature passes verification.
areDigestsValidBoolData item hashes match the MSO digests.
msoValidity.statusMsoStatusvalid, notYetValid, expired, or unknown.
trust.isIssuerTrustedBoolIssuing CA found in the SDK trust store.
trust.chainStatusTrustResultverified, untrustedRoot, or unchecked.

Reference

Enumerations

VerificationStatus

success
partialSuccess
failure
Swift
public enum VerificationStatus {
    case success
    case partialSuccess
    case failure
}

MsoStatus

valid
notYetValid
expired
unknown
Swift
public enum MsoStatus {
    case valid
    case notYetValid
    case expired
    case unknown
}

TrustResult

verified
untrustedRoot
unchecked
Swift
public enum TrustResult {
    case verified
    case untrustedRoot
    case unchecked
}