1.0.5 • Published 3 years ago

card-reader v1.0.5

Weekly downloads
9
License
MIT
Repository
github
Last release
3 years ago

DEPRECATED - Please use smartcard instead....


Card Reader

A simple wrapper around Santiago Gimeno's great pcsclite library.

Emits events for:

  • device-activated
  • device-deactivated
  • card-inserted
  • card-removed
  • issue-command
  • receive-response
  • error

Examples

var cardreader = require('../lib/card-reader');

cardreader.on('device-activated', function (reader) {
    console.log(`Device '${reader.name}' activated`);
});

cardreader.on('device-deactivated', function (reader) {
    console.log(`Device '${reader}' deactivated`);
});

cardreader.on('card-removed', function (reader) {
    console.log(`Card removed from '${reader.name}' `);
});

cardreader.on('command-issued', function (reader, command) {
    console.log(`Command '${command}' issued to '${reader.name}' `);
});

cardreader.on('response-received', function (reader, response, command) {
    console.log(`Response '${response}' received from '${reader.name}' in response to '${command}'`);
});

cardreader.on('error', function (message) {
    console.log(`Error '${message}' received`);
});

cardreader.on('card-inserted', function (reader, status) {

   console.log(`Card inserted into '${reader.name}' `);
   // issue a command...

   // ...either callback style
   cardreader.issueCommand('00A404000E315041592E5359532E4444463031', function (err, response) {
       if (err) {
           console.error(err);
       } else {
            console.log(`Response '${response.toString('hex')}`);
       }
   });
       
   // ...or as a promise
   cardreader
        .issueCommand('00A404000E315041592E5359532E4444463031')
        .then(function (response) {
            console.log(`Response '${response.toString('hex')}`);
        }).catch(function (error) {
            console.error(error);
        });
});

Compatible Readers

Tested on Mac OSX with the SCM SCR3500 Smart Card Reader. This library should work with most PC/SC readers - I'll update this page when I get to test others. If you know of any other devices that work please let me know.

1.0.5

3 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

0.0.27

8 years ago

0.0.26

8 years ago

0.0.25

8 years ago

0.0.24

8 years ago

0.0.23

8 years ago

0.0.22

8 years ago

0.0.21

8 years ago

0.0.20

8 years ago

0.0.19

8 years ago

0.0.18

8 years ago

0.0.17

8 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago