Releases: tomkp/smartcard
Releases · tomkp/smartcard
v3.7.2
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 setSCARD_STATE_CHANGEDcorrectly.Fixes #111
Full Changelog
v3.7.1
v3.7.0
What's Changed
Features
- autoGetResponse now works with card.transmit() - You can now pass
{ autoGetResponse: true }directly tocard.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
autoGetResponseoption incard.transmit()(#107)
Full Changelog
v3.6.0
What's Changed
Features
- Add typed
addListener/removeListenermethods for better TypeScript support (#97) - Return
ReadonlyMapfromgetCards()for immutability (#101)
Fixes
- Add explicit buffer bounds validation in
parseFeatures()to prevent potential overread (#89)
Refactoring
- Extract
isUnresponsiveCardErroras 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
v3.4.1
v3.4.0
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
Bug Fixes
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 - Add advanced examples for PC/SC operations
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
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 codesCM_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
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
ReconnectWorkerfor non-blocking reconnect operations