Coder Social home page Coder Social logo

thaismartcardreader.js's Introduction

Thai Smart Card Reader.js

This is implementation of smartcard node js module. That using PCSC API.

Installation

yarn add thaismartcardreader.js

For windows

Please install windows-build-tools as administrator before install this library.

Deprecated

  1. "card-readed" event from Reader class using "card-inserted" instead
  2. Access variable directly eg. person.cid using getter function by add prefix "get" and using camelCase eg getCid, getDoB

Example Code

You can find it in demo/GetAllData.js

API Document

Comming Soon in Version 0.3

Credit

Chakphanu for an APDU Command

familla for a report, on windows need to install windows-build-tools as administrator right.

thaismartcardreader.js's People

Contributors

sgnsys3 avatar dogrocker avatar trrekiiz avatar

Stargazers

sarawut khantiyoo avatar sirasak saengaurai avatar  avatar Supratouch Suwatno avatar Jakkaphat Chalermphanaphan avatar Trong avatar Piphop Boonchuay avatar Klongchu avatar Weerakit Wingphat avatar Mix Abcprintf avatar  avatar Sathit Seethaphon avatar Punpunjubu avatar  avatar Supakarn Laorattanakul avatar Smart avatar Thanikul Sriuthis avatar Niti Chotkaew avatar Thotsaphon Ruthamnong avatar Bundit Nuntates avatar Withun Porawiwat avatar Phumphathai Chansriwong avatar  avatar Chalermporn Posoppitakwong avatar Sarun Intaralawan avatar Tambralinga avatar Charoen Chaweechan avatar Porramate Lim avatar Lifestyle avatar  avatar Jirachai Chansivanon avatar

Watchers

James Cloos avatar Jirachai Chansivanon avatar Tambralinga avatar Chalermporn Posoppitakwong avatar  avatar

thaismartcardreader.js's Issues

Revise usage of async/await in ReaderUtils.js

functions in this file seems like an odd mix of async/await and Promise.

https://github.com/sgnsys3/thaismartcardreader.js/blob/master/src/ReaderUtils.js#L8-L21

Could we consider changing this to use Promise or just declare function as async?

(see gist for syntax hi-lighted code: https://gist.github.com/varokas/87d0a4ffdeb344c97d50c5b834c78c18)

//Mock card object
let card = {
  issueCommand: new Promise(function(resolve, reject) {
    resolve("issueCommand");
  })
}

//Mock ResponseApdu
class ResponseApdu {
    constructor(rawResponse) {
        this.rawResponse = rawResponse;
    }
}

//Option 1: Use promise (similar to issueCommand: https://github.com/tomkp/smartcard/blob/2373b010790aa11cf8e9df740c5dd1368a0aae25/src/Iso7816Application.js#L38-L63 )
let runCommandPromise = (card) => {
  return card.issueCommand.then( rawResponse => new ResponseApdu(rawResponse) )
}
runCommandPromise(card).then(response => console.log(response))

//Option 2: Declare function itself as async (which is interchangable with Promise)
let runCommandAsync = async (card) => {
    let rawResponse = await card.issueCommand;
    return new ResponseApdu(rawResponse);
}  

runCommandAsync(card).then(response => console.log(response)); //Use as Promise

//Or use as async function in someother function
async function someOtherFn(card) {
    return await runCommandAsync(card);
}

node v.16

ใช้งานกับ node v16 ได้มั้ยครับ npm i ไม่ผ่านเลย

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.