Skip to content

Releases: tomkp/smartcard

v3.7.2

18 Feb 11:55
1941bb2

Choose a tag to compare

Bug Fixes

  • Windows card event reliability: Fix timeout handler to query fresh state using SCARD_STATE_UNAWARE (#116)

    The v3.7.1 fix addressed index-based reader tracking, but the timeout handler was still checking potentially stale dwEventState. This fix ensures card events are detected within ~1 second on Windows even when PC/SC fails to set SCARD_STATE_CHANGED correctly.

    Fixes #111

Full Changelog

v3.7.1...v3.7.2

v3.7.1

17 Jan 21:56
c8cd70c

Choose a tag to compare

What's Changed

Bug Fixes

  • Improve Windows card event reliability (#112)

Documentation

  • Add reference to tomkp/emv repository (#109)
  • Improve emv library description in Related Projects
  • Fix examples README paths

Full Changelog: v3.7.0...v3.7.1

v3.7.0

29 Dec 17:46
b5b97e6

Choose a tag to compare

What's Changed

Features

  • autoGetResponse now works with card.transmit() - You can now pass { autoGetResponse: true } directly to card.transmit() when using the high-level Devices API. This automatically handles T=0 protocol status words (SW1=61, SW1=6C). (#106)
// This now works!
const response = await card.transmit(apdu, { autoGetResponse: true });

Documentation

  • Update README to document autoGetResponse option in card.transmit() (#107)

Full Changelog

v3.6.0...v3.7.0

v3.6.0

29 Dec 17:02
3ac60cb

Choose a tag to compare

What's Changed

Features

  • Add typed addListener/removeListener methods for better TypeScript support (#97)
  • Return ReadonlyMap from getCards() for immutability (#101)

Fixes

  • Add explicit buffer bounds validation in parseFeatures() to prevent potential overread (#89)

Refactoring

  • Extract isUnresponsiveCardError as pure function for testability (#91)
  • Consolidate addon type definitions (#93)
  • Extract APDU building functions (buildGetResponseCommand, correctLeInCommand) as pure utilities (#99)

Documentation

  • Update README with getCards(), getCard(), transmitWithAutoResponse(), and control codes documentation (#85, #103)

Testing

  • Add unit tests for parseFeatures() - coverage increased from 61.76% to 95.89% (#87)
  • Add createTestSetup helper to reduce test boilerplate (#95)
  • Test count increased from 71 to 99

v3.4.1

29 Dec 09:53
df106e1

Choose a tag to compare

What's Changed

  • Add ESM import support to package exports (#79)

This release adds the import condition to the package exports, allowing the package to be used in ES module projects with "type": "module".

Full Changelog: v3.4.0...v3.4.1

v3.4.0

28 Dec 14:16
2cfdd7c

Choose a tag to compare

What's Changed

Bug Fixes

  • Fix Reconnect to update Card object's protocol after success (#76)

Improvements

  • Add ESLint configuration with TypeScript support (#75)
  • Add exports field for modern bundler compatibility (#74)
  • Make Devices class injectable for testing (#77)
  • Improve test coverage from 55% to 88%

Documentation

  • Fix README Node.js version claim (18+ not 12+) (#73)

Dependencies

  • Add eslint, @eslint/js, typescript-eslint as dev dependencies

Full Changelog: v3.3.0...v3.4.0

v3.2.1

27 Dec 21:02
b767d1e

Choose a tag to compare

Bug Fixes

  • Windows compilation: Fixed MAX_ATR_SIZE undeclared identifier error on Windows builds (#64, #63)

Testing Improvements

  • Added GitHub Actions CI/CD pipeline with matrix builds (Node 18, 20, 22 × Ubuntu, macOS, Windows)
  • Added code coverage reporting with c8
  • Migrated to Node.js built-in test runner
  • Added TypeScript declaration tests with tsd
  • Enhanced mock error scenarios for better testing
  • Added protocol fallback tests for issue #34
  • Restructured test directories

Full Changelog

v3.2.0...v3.2.1

v3.2.0 - Add advanced examples for PC/SC operations

27 Dec 15:09
edb9cf4

Choose a tag to compare

What's New

Added 5 comprehensive example files demonstrating advanced PC/SC operations:

New Examples

  • error-handling.js: Proper error handling with specific PC/SC error types (CardRemovedError, TimeoutError, NoReadersError, ServiceNotRunningError, SharingViolationError)
  • wait-for-card.js: Low-level Context.waitForChange() API usage for polling-based card detection
  • control-command.js: Reader control commands and feature queries using CM_IOCTL_GET_FEATURE_REQUEST
  • reconnect.js: Protocol switching (T=0/T=1), exclusive access, and card reset operations
  • mifare-read-write.js: Complete MIFARE Classic read/write operations with authentication

Documentation

Updated examples/README.md with:

  • Documentation for all new examples
  • MIFARE Classic command reference
  • Error class documentation

Full Changelog: v3.1.0...v3.2.0

v3.1.0

22 Dec 10:27
21e8871

Choose a tag to compare

What's New

Control Code Constants and Helpers (#45)

Added helper constants for common control codes to improve developer experience:

  • SCARD_CTL_CODE(code) - Generate platform-specific control codes
  • CM_IOCTL_GET_FEATURE_REQUEST - Get CCID features control code
  • 19 CCID feature tag constants (e.g., FEATURE_VERIFY_PIN_DIRECT)
  • parseFeatures(response) - Parse TLV response from GET_FEATURE_REQUEST

Usage Example

const {
    CM_IOCTL_GET_FEATURE_REQUEST,
    FEATURE_VERIFY_PIN_DIRECT,
    parseFeatures
} = require('smartcard');

// Get supported features
const response = await card.control(CM_IOCTL_GET_FEATURE_REQUEST);
const features = parseFeatures(response);

// Check if PIN verification is supported
if (features.has(FEATURE_VERIFY_PIN_DIRECT)) {
    const verifyControlCode = features.get(FEATURE_VERIFY_PIN_DIRECT);
    // Use verifyControlCode for PIN operations
}

v3.0.0

22 Dec 10:24
f8f16b0

Choose a tag to compare

Breaking Changes

card.reconnect() is now async (#43)

card.reconnect() now returns a Promise<number> instead of number, making it consistent with other card operations.

Migration:

// Before (v2.x)
const protocol = card.reconnect();

// After (v3.0)
const protocol = await card.reconnect();

What's New

  • All card operations are now consistently async/Promise-based
  • Added ReconnectWorker for non-blocking reconnect operations