LocalReader

interface LocalReader

Local NFC reader abstraction. We provide a Kotlin Multiplatform implementation compatible with iOS, Android and JVM-based desktops using a PCSC reader (Windows, macOS, linux). You can provide your own version or support different hardware by implementing this interface.

Since

1.0.0

Functions

Link copied to clipboard
abstract fun closePhysicalChannel()

Closes safely the current physical channel.

Link copied to clipboard
abstract fun getName(): String
Link copied to clipboard
abstract fun getPowerOnData(): String

Returns the power-on data. The power-on data is defined as the data retrieved by the reader when the card is detected.

Link copied to clipboard
abstract fun openPhysicalChannel()

Attempts to open the physical channel with the card.

Link copied to clipboard
abstract fun release()

Releases the reader and safely stops any ongoing NFC polling operations.

Link copied to clipboard
abstract fun setScanMessage(message: String)

Used to set the scan instructions to the user, for applicable NFC readers. Main usage is for iOS: the provided message is displayed in the iOS system-driven NFC popup

Link copied to clipboard
abstract fun startCardDetection(onCardDetected: () -> Unit)

Starts monitoring the reader for card detection events asynchronously.

Link copied to clipboard
abstract fun transmitApdu(commandApdu: ByteArray): ByteArray

Transmits an Application Protocol Data Unit (APDU) command to the smart card and receives the response.

Link copied to clipboard
abstract suspend fun waitForCardPresent(): Boolean

Suspends until a card is detected.