# requestcurl http://localhost:4000/api/v2/session.create \ -u key:secret \ -d @- << EOF{ "face_verification": false, "passport_only": false}EOF # response{ "id": 123, "token": "i_dI5hs7m...", ...}<key>com.apple.developer.nfc.readersession.formats</key><array> <string>TAG</string></array><key>NFCReaderUsageDescription</key><string>For reading and processing passports and ID cards</string><key>NSCameraUsageDescription</key><string>For reading and processing passports and ID cards</string><key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key><array> <string>A0000002471001</string></array>BackendSession using the token from the previous step. At some point before starting the session, request permission to use the camera (this is not handled by the SDK).// integration example in Swiftimport PassportReader let passportReader = PassportReader()guard let session = BackendSession(token: token) else { // handle an invalid token return} passportReader.start( in: windowScene, session: session, completion: { // retrieve the session results from your backend }, failure: { error in // handle error, e.g. retry by calling start again }, cancellation: { // cancelled by the user })BackendSession reads the API host, passport_only, and face_verification from the token. You do not need to decode the token or pass those settings to start. The initializer returns nil for an invalid token. Use session.id if your app needs the session identifier for display or tracking.BackendSession handles communication with the backend. When face verification is enabled, verification runs on the device and the resulting face evidence is uploaded on success.# requestcurl http://localhost:4000/api/v2/session.get \ -u key:secret \ -d @- << EOF{ "id": 123}EOF # response{ "state": "COMPLETED", ... "given_names": "John", "surname": "Doe", "nationality": "US", "sex": "MALE", "date_of_birth": "1988-01-01", "personal_number": "...", "place_of_birth": "...", "optional_data": "...", "optional_data2": "...", "document_type": "PASSPORT", "document_number": "31195855", "expiry_date": "2031-01-01", "issuing_country": "US", "issuer": "Department of State, U.S. Government", "portrait": "dGVzdHRlc3R0ZXN0...", "document_integrity_verified": true, "active_authentication": true, "chip_authentication": true, ...}expires timestamp. After expiry, the results are no longer available through the API, even if scheduled cleanup has not yet removed the stored data. COMPLETED means the verification flow has completed. It does not mean the identity has been approved. document_integrity_verified, confirm that csca_certificate_fingerprint identifies an issuer certificate you trust, and check the document's expiry date. Apply your requirements for active_authentication, chip_authentication, and face verification. Your system makes the final acceptance decision. LocalChipReaderSession and LocalFaceVerificationSession with the separate scanning methods. This flow does not require a token or a session created through the Session API. Results are returned directly to your app and are not uploaded by these local sessions.PassportReader constructor.import PassportReader let passportReader = PassportReader(telemetry: false)// DER-encoded certificates from your trusted CSCA certificate collection.let cscaCertificates: [Data] = trustedCertificateslet chipSession = LocalChipReaderSession(cscaCertificates: cscaCertificates) passportReader.startMRZScanner( in: windowScene, completion: { keys in passportReader.startChipReader( in: windowScene, session: chipSession, keys: keys, passportOnly: false, completion: { givenNames, surname, dateOfBirth, nationality, sex, documentNumber, documentType, expiryDate, issuingCountry, issuer, optionalData, optionalData2, portrait, personalNumber, placeOfBirth, dsc, documentIntegrityVerified, chipAuthentication, activeAuthentication, smProtocol, efCardaccess, efCardsecurity, efSod, efDg1, efDg2, efDg11, efDg14, efDg15 in // use the identity data and authentication results // retain portrait for face verification }, failure: { error in // handle chip reading or verification failure }, cancellation: { // cancelled by the user } ) }, failure: { // handle MRZ scanning failure }, cancellation: { // cancelled by the user })portrait to face verification. For display, convert it separately using PassportReader.portraitToPNG(portrait).let faceSession = LocalFaceVerificationSession() passportReader.startFaceVerification( in: windowScene, session: faceSession, portrait: portrait, completion: { face, score, frames in // face is a PNG image; frames contains the captured evidence // an empty face means verification did not succeed }, failure: { // handle face verification failure }, cancellation: { // cancelled by the user })HTTPClient to use your own networking stack with BackendSession. Its post(_:headers:body:completion:) method receives the URL, headers, and sealed request bytes. Send those headers and bytes unchanged, then call completion(statusCode, data) once with the HTTP status and raw response bytes. Use status 0 for a transport failure. BackendSession handles request sealing and retries.MyHTTPClient implementation, inject it when creating the session: guard let session = BackendSession( token: token, httpClient: MyHTTPClient()) else { // handle an invalid token return}Session — pass your implementation to PassportReader.start for the complete flow. It combines ChipReaderSession and FaceVerificationSession with session initiation, failure, and cancellation handling.ChipReaderSession — pass your implementation to startChipReader to control chip authentication operations and verification of the files read from the document.FaceVerificationSession — pass your implementation to startFaceVerification to control verification of the portrait and captured frames.passportOnly and faceVerification properties on your custom Session to configure the complete flow. Your implementations can delegate operations to the local session classes or communicate with your own backend. Implement all required methods and return results through the supplied callbacks. Keep chip authentication state in the same session instance throughout a read. libpassportreader, our native library with a C interface. It provides chip authentication, certificate and document verification, face verification, and envelope processing. Your custom session sends operations to your backend, which calls the library and returns the results expected by the SDK callbacks.BackendSession currently verifies faces locally and uploads the resulting evidence.