{"_id":"@dogrocker/thaismartcardreader","_rev":"1-78b14cef9d703fe360f35ba83d93a9f8","name":"@dogrocker/thaismartcardreader","dist-tags":{"latest":"0.2.3"},"versions":{"0.2.3":{"name":"@dogrocker/thaismartcardreader","version":"0.2.3","description":"Fork version, Read data from thai smartcard via NodeJS","main":"src/index.js","repository":{"type":"git","url":"git+https://github.com/dogrocker/thaismartcardreader.js.git"},"author":{"name":"Pureewat Kaewpoy"},"license":"MIT","dependencies":{"smartcard":"^1.0.23","utf8":"^3.0.0"},"keywords":["thai","smartcard","reader","citizenid","thailand"],"gitHead":"8c1369e43913e9cb259522ac424791f23b8f6e79","bugs":{"url":"https://github.com/dogrocker/thaismartcardreader.js/issues"},"homepage":"https://github.com/dogrocker/thaismartcardreader.js#readme","_id":"@dogrocker/thaismartcardreader@0.2.3","_npmVersion":"6.2.0","_nodeVersion":"10.7.0","_npmUser":{"name":"dogrocker","email":"kanin.pean@gmail.com"},"dist":{"integrity":"sha512-6vRG70drSosQV6tXLFzGXglyaQKJAE32MM8gATuFDOnL/5tc9jq0cGNCyokNf9ZEESp9SNXAMhEvvUvDAqGYRA==","shasum":"a53c11a685242c32da583a21b7adc7d73bbe6575","tarball":"https://registry.npmjs.org/@dogrocker/thaismartcardreader/-/thaismartcardreader-0.2.3.tgz","fileCount":9,"unpackedSize":19440,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbWC3fCRA9TVsSAnZWagAAZj0P/3xS30aDPV9ds1SOCPcc\n7MnuSw2WE7ItsJVwvJ386T9TT5Ttmk2jmQDs8ehxt1pYLb2unliXENyP1jZB\nBBOjBeNnUsSQD/BTbQefgo/BEfrtZ4mvTiWYZhnPotBoMQQx4Q4X54G8lUpN\n9JBtHRXEO2dLdXbAk0ioJ/LKNsiGPZnxIkXYqgwtIEB8zlI8qOS+bFb9cCL9\nThjYIM4PaQ9iHZnavPjBatIh93z9mDBuqrtGvIdsX85kI0HhqTRRV8wzolbC\nbeS5QKQuJzdYIJoCZKcdbKAnCgRadJWNHpaWHUdKH77hU5aetPkOs1JyR2mK\nb+6G8bKOlTETRYeDs7Sky6MMYtBqiwYzojExQleYPlbLucwSMLKeD2E2PcXY\n2QpU8yVW3rhnMKRdmU/r0+78IowIjpYGeK81FwrRVJ1xzBe0pur40QCMrx10\nVtVJzO8Fq40gOk6mEBA86JgZb0RYR41CIp28FxrWqvFgoTT9j0oJwrWvU5lz\nGXTZ2VqREMMY6PrdWqSodMIK2ZKfR+ud6j2zlVLtSGMArFEWVCSZ8ipBDN7Q\nzRB9McRh9nCqFk07VIbdJ2qZJ7GHGQwHkx8m42zDR5eckuQZJ59uCuKQy4Vr\nFVFNTJPubGVFkK+6vnqdrlV8gvQI1+kpSS5NQIOtaltW7TVxkqO+tSrm4jrV\nkepe\r\n=xRT9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH++DhXdoUe1m61KzsikQsq20BiysgH9Waf4xLOBmvDbAiAZfnCSuZ3hzf+Olh67rVJvmgrNYING8BidvhDepQMJ/Q=="}]},"maintainers":[{"name":"dogrocker","email":"kanin.pean@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/thaismartcardreader_0.2.3_1532505567901_0.7618028540102286"},"_hasShrinkwrap":false}},"time":{"created":"2018-07-25T07:59:27.648Z","0.2.3":"2018-07-25T07:59:27.971Z","modified":"2022-04-05T05:06:40.197Z"},"maintainers":[{"name":"dogrocker","email":"kanin.pean@gmail.com"}],"description":"Fork version, Read data from thai smartcard via NodeJS","homepage":"https://github.com/dogrocker/thaismartcardreader.js#readme","keywords":["thai","smartcard","reader","citizenid","thailand"],"repository":{"type":"git","url":"git+https://github.com/dogrocker/thaismartcardreader.js.git"},"author":{"name":"Pureewat Kaewpoy"},"bugs":{"url":"https://github.com/dogrocker/thaismartcardreader.js/issues"},"license":"MIT","readme":"# Thai Smart Card Reader.js\nThis is implementation of [smartcard](https://github.com/tomkp/smartcard) node js module. That using PCSC API.\n\n## Installation\n```\nyarn add thaismartcardreader.js\n```\n\n## Deprecated\n1. \"card-readed\" event from Reader class using \"card-inserted\" instead\n2. Access variable directly eg. person.cid using getter function by add prefix \"get\" and using camelCase eg getCid, getDoB\n\n## Example Code\n\n```javascript\nconst fs = require('fs')\nconst { Reader } = require('thaismartcardreader.js')\nconst path = require('path')\n\nconst myReader = new Reader()\n\nprocess.on('unhandledRejection', (reason) => {\n    console.log('From Global Rejection -> Reason: ' + reason);\n});\n\nconsole.log('Waiting For Device !')\nmyReader.on('device-activated', async (event) => {\n  console.log('Device-Activated')\n  console.log(event.name)\n  console.log('=============================================')\n})\n\nmyReader.on('error', async (err) => {\n  console.log(err)\n})\n\nmyReader.on('image-reading', (percent) => {\n  console.log(percent)\n})\n\nmyReader.on('card-inserted', async (person) => {\n  const cid = await person.getCid()\n  const thName = await person.getNameTH()\n  const enName = await person.getNameEN()\n  const dob = await person.getDoB()\n  const issueDate = await person.getIssueDate()\n  const expireDate = await person.getExpireDate()\n  const address = await person.getAddress()\n  const issuer = await person.getIssuer()\n\n  console.log(`CitizenID: ${cid}`)\n  console.log(`THName: ${thName.prefix} ${thName.firstname} ${thName.lastname}`)\n  console.log(`ENName: ${enName.prefix} ${enName.firstname} ${enName.lastname}`)\n  console.log(`DOB: ${dob.day}/${dob.month}/${dob.year}`)\n  console.log(`Address: ${address}`)\n  console.log(`IssueDate: ${issueDate.day}/${issueDate.month}/${issueDate.year}`)\n  console.log(`Issuer: ${issuer}`)\n  console.log(`ExpireDate: ${expireDate.day}/${expireDate.month}/${expireDate.year}`)\n\n  console.log('=============================================')\n  console.log('Receiving Image')\n  const photo = await person.getPhoto()\n  console.log(`Image Saved to ${path.resolve('')}/${cid}.bmp`)\n  console.log('=============================================')\n  const fileStream = fs.createWriteStream(`${cid}.bmp`)\n  const photoBuff = Buffer.from(photo)\n  fileStream.write(photoBuff)\n  fileStream.close()\n})\n\nmyReader.on('device-deactivated', () => { console.log('device-deactivated') })\n```\n\n## API Document\n\nComming Soon in Version 0.3\n\n## Credit\n[Chakphanu](https://github.com) for an [APDU Command](https://github.com/chakphanu/ThaiNationalIDCard/blob/master/APDU.md)","readmeFilename":"Readme.md"}