Models

Public model types are Sendable and designed to cross Swift concurrency boundaries cleanly.

TypeRole
CardInfoCard type, UID, ATQA, SAK, ATS, selected AID, FeliCa system code, and ISO 15693 metadata.
CardTypeSpecific card classification and iOS operability.
MemoryDumpPages, blocks, files, NDEF payloads, facts, capabilities, exports, and diffs.
PassportModelParsed eMRTD data groups, MRZ, images, security info, SOD, raw groups, and security report.
TransitBalanceNormalized balance, currency, validity, and recent transactions.
NFCErrorEvery failure the library throws. See Errors.

MemoryDump

exportLibNFCMFD(), exportFlipperNFC() and exportProxmark3MFU() require a page-based Type 2 dump. They throw NFCError.unsupportedOperation when the dump has no pages, and NFCError.malformedDump when any page is not exactly 4 bytes, instead of padding or truncating. importProxmark3MFU accepts the 56-byte mfu_dump_t header format and plain 4-byte-page binaries. When the file length also matches a known plain page dump, the plain reading wins unless the header is plausible on its own: a GET_VERSION response or all zeros, followed by a page with a consistent BCC0. Malformed imports throw NFCError.malformedDump. diffSummary(against:) matches entries by key and never traps on repeated keys.

PassportModel

dataGroupReadStatus maps each data group to a PassportDataGroupReadResult whose state is read, notPresent, unavailable, failed or notRead, plus a detail string. securityReport holds one PassportSecurityStageResult for each of cardAccess, pace, bac, chipAuthentication, passiveAuthentication and activeAuthentication.

Stagesucceededfallbackfailed
Passive AuthenticationHashes match, EF.SOD signature valid, and the Document Signer certificate (DSC) has a validated certification path to a CSCA in trustAnchorsDER (fullyVerified).Hashes match but the DSC has no validated certification path to a CSCA in trustAnchorsDER (no anchors, or signature not checked).Invalid signature, certification path validation failed, hash mismatch, unparseable EF.SOD, unsupported hash algorithm.
Active AuthenticationValid signature, Passive Authentication fully verified, and DG15 matches its hash in EF.SOD.Valid signature over a DG15 that is not authenticated (no anchors, certification path validation failed, DG15 not covered, no PA).Invalid signature, failed command, or a DG15 that does not match its hash in EF.SOD.

ActiveAuthenticationResult.status is .verified only for an authenticated DG15 key. A valid signature over an unauthenticated key is .verifiedUnauthenticatedKey, and success stays the purely cryptographic outcome. Chip Authentication is reported from DG14 but not performed: the stage is notSupported when advertised.

// Offline re-checks on a saved model; no NFC involved.
let pa = model.reverifyPassiveAuthentication(trustAnchorsDER: cscas)
let rejudged = model.reverifyingSecurity(trustAnchorsDER: cscas)   // PA + AA stages rebuilt

reverifyPassiveAuthentication re-parses EF.SOD, re-hashes the raw data groups and verifies the CMS signature, plus certification path validation when anchors are given. reverifyingSecurity also re-classifies the stored AA result with ActiveAuthenticationResult.classified(by:) and rebuilds both stages with PassportSecurityStageResult.passiveAuthentication(_:sodPresent:) and activeAuthentication(_:passiveAuthentication:). Fields like mrz are not re-derived. To rebuild every field from the stored bytes, use PassportModel(rawDataGroups:cardAccessRaw:performPassiveAuthentication:trustAnchorsDER:dataGroupReadStatus:), which applies the reader's parsers and Passive Authentication offline and leaves the chip-only stages skipped.

TransitTransaction

amount is an unsigned magnitude in the card currency's stored unit, or nil when the record has no recognized amount. Direction comes from type: .topup adds to the balance, .trip and .purchase deduct from it. balanceAfter is nil when the source does not expose it.