Represents a temporary CardMode.EXCLUSIVE connection session, which can be started from a CardMode.SHARED connection via Card.transaction().
Transaction.end() must be called when done.
import * as pcsc from "pcsc-mini";async function longRunningProcess(card: pcsc.Card) { const txn = card.transaction(); try { const r1 = await card.transmit(Uint8Array.of(0xca, 0xfe, 0xf0, 0x0d)); const r2 = await card.transmit(Uint8Array.of(0xfa, 0xde, 0xfa, 0xce)); return processResults(r1, r2); } catch (err) { console.error("Something went wrong:", err); } finally { txn.end(pcsc.CardDisposition.LEAVE); }} Copy
import * as pcsc from "pcsc-mini";async function longRunningProcess(card: pcsc.Card) { const txn = card.transaction(); try { const r1 = await card.transmit(Uint8Array.of(0xca, 0xfe, 0xf0, 0x0d)); const r2 = await card.transmit(Uint8Array.of(0xfa, 0xde, 0xfa, 0xce)); return processResults(r1, r2); } catch (err) { console.error("Something went wrong:", err); } finally { txn.end(pcsc.CardDisposition.LEAVE); }}
Closes the transaction and restores the previous card connection mode.
The action to take after ending the transaction.
Err
Represents a temporary CardMode.EXCLUSIVE connection session, which can be started from a CardMode.SHARED connection via Card.transaction().
Transaction.end() must be called when done.
Example: