npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

egk

v1.2.1

Published

NodeJS library for reading public health insurance cards from germany (eGK) and austria (e-Card)

Downloads

12

Readme

node-egk

A Node.js package for reading the unencrypted data from public health insurance cards from germany (eGK) and austria (e-Card)

Installation

  • Install Node.js
  • Install PCSC Lite. On Debian/Ubuntu systems this can be done using apt install libpcsclite1 libpcsclite-dev pcscd.
  • npm install egk

Supported card readers

This library was written and tested using the Identiv uTrust 2770 R but should work with any reader that provides a PC/SC driver.

Usage

See example/index.js for a full example on how to use this module. Basically, you just have to subscribe to a "card was inserted"-event and call getInsurantData when it occurs:

const eGKReader = require('egk');
const egk = new eGKReader();

egk.on('card-connect', async (reader, atr) => {    
    try {
        // Note that this library uses promises/async&await for asynchronous operations and does not 
        // provide a callback. 
        const data = await egk.getInsurantData(atr, "DE");
        // do stuff
    } catch (err) {
        console.log("Error: ", err);
    }
});

This results in a JSON object representing the insurants data:

{
   "cardType":"egk",
   "insurantId":"P123456789",
   "dob":"19881005",
   "firstName":"Max",
   "lastName":"Musterman",
   "sex":"M",
   "street":"Musterstr.",
   "houseNumber":"1",
   "zipCode":"12345",
   "city":"Musterstadt",
   "country": "DE"
}

API

Events

Event | Description ------|------------| reader-connect | Emitted when a smartcard reader is present. Returns the name of the reader. | reader-disconnect | Emitted when the smartcard reader is removed. Returns the name of the reader. | card-connect | Emitted when a card is inserted into the reader. Returns the name of the reader and the atr from the card. | card-disconnect | Emitted when the card is removed from the reader. Returns the name of the reader. | error | Emitted when the underlying smartcard library reported an error, for example if an unsupported card was inserted into the reader. Returns an Error object. |

Functions

Function | Description | Returns | ---------|-------------|---------| getInsurantData(atr, fallbackType) | Reads the unencrypted insurance data file from a german or austrian health insurance card, depending on the cards ATR response. You can pass a fallback card-type ("AT" or "DE") that is used if the ATR detection fails. | A promise resolving with a JSON object or rejecting with an Error. | getInsurantDataDE() | Same as above, but expects a german health insurance card. The ATR value is ignored. | A promise resolving with a JSON object or rejecting with an Error. | getInsurantDataAT() | Same as above, but expects an austrian health insurance card. The ATR value is ignored. | A promise resolving with a JSON object or rejecting with an Error. | dispose() | Removes all resources and event handlers used by the pcsc library. | - |