Skip to content

Commit

Permalink
v0.1.13: Implement mfkey32v2 and mfkey64.
Browse files Browse the repository at this point in the history
  • Loading branch information
taichunmin committed Jan 28, 2023
1 parent f07b3cb commit f71ad47
Show file tree
Hide file tree
Showing 17 changed files with 1,867 additions and 784 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ Using jsDelivr CDN:

<!-- PN532.js Core -->
<script src="https://cdn.jsdelivr.net/npm/pn532.js@0/dist/pn532.min.js"></script>
<!-- PN532.js Crypto1 -->
<script src="https://cdn.jsdelivr.net/npm/pn532.js@0/dist/Crypto1.min.js"></script>
<!-- PN532.js Hf14a plugin -->
<script src="https://cdn.jsdelivr.net/npm/pn532.js@0/dist/plugin/Hf14a.min.js"></script>
<!-- PN532.js LoggerRxTx plugin -->
Expand All @@ -71,6 +73,7 @@ A pn532 instance must register exactly one adapter plugin:
const {
_, // lodash: https://cdn.jsdelivr.net/npm/lodash@4/lodash.min.js
Pn532: { Pn532, Packet, utils: Pn532utils },
Crypto1,
Pn532Hf14a,
Pn532WebbleAdapter,
Pn532WebserialAdapter,
Expand Down Expand Up @@ -239,7 +242,9 @@ console.log(JSON.stringify(resp6)) // {"success":[1,1,1,1,... (truncated)]}

* [PN532 User Manual v1.6 | NXP](https://www.nxp.com/docs/en/user-guide/141520.pdf)
* [PN532/C1 Product data sheet v3.6 | NXP](https://www.nxp.com/docs/en/nxp/data-sheets/PN532_C1.pdf)
* [MF1S50YYX_V1 v3.2 | NXP](https://www.nxp.com/docs/en/data-sheet/MF1S50YYX_V1.pdf)
* [Mifare Classic 1k ev1 v3.2 | NXP](https://www.nxp.com/docs/en/data-sheet/MF1S50YYX_V1.pdf)
* [Mifare Classic 4k ev1 v3.2 | NXP](https://www.nxp.com/docs/en/data-sheet/MF1S70YYX_V1.pdf)
* [Mifare Identifcation Procedure - AN10833 | NXP](https://www.nxp.com/docs/en/application-note/AN10833.pdf)
* [A 2018 practical guide to hacking NFC/RFID](https://smartlockpicking.com/slides/Confidence_A_2018_Practical_Guide_To_Hacking_RFID_NFC.pdf)
* [Magic Cards Notes](https://github.com/RfidResearchGroup/proxmark3/blob/master/doc/magic_cards_notes.md)
* [elechouse/PN532: NFC library for Arduino](https://github.com/elechouse/PN532)
Expand Down
1 change: 1 addition & 0 deletions documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ toc:
children:
- Pn532
- Packet
- Crypto1
- name: Plugin
children:
- Pn532Hf14a
Expand Down
1 change: 1 addition & 0 deletions layout/default.pug
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ html(lang="zh-Hant")
script(crossorigin="anonymous", src="https://cdn.jsdelivr.net/npm/bootstrap@4/dist/js/bootstrap.min.js")
//- pn532 require lodash
script(crossorigin="anonymous", src=`${baseurl}pn532${jsext}`)
script(crossorigin="anonymous", src=`${baseurl}Crypto1${jsext}`)
script(crossorigin="anonymous", src=`${baseurl}plugin/Hf14a${jsext}`)
script(crossorigin="anonymous", src=`${baseurl}plugin/LoggerRxTx${jsext}`)
script(crossorigin="anonymous", src=`${baseurl}plugin/WebbleAdapter${jsext}`)
Expand Down
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pn532.js",
"version": "0.1.12",
"version": "0.1.13",
"author": "taichunmin <[email protected]>",
"browser": "dist/pn532.min.js",
"description": "pn532.js is a JavaScript library for PN532 base on Web Bluetooth and Web Serial.",
Expand All @@ -25,30 +25,31 @@
"web-serial-polyfill": "^1.0.14"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^24.0.0",
"@rollup/plugin-commonjs": "^24.0.1",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-terser": "^0.4.0",
"cross-env": "^7.0.3",
"dayjs": "^1.11.7",
"documentation": "^14.0.1",
"dotenv": "^16.0.3",
"eslint": "^8.31.0",
"eslint": "^8.32.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-n": "^15.6.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^15.6.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-pug": "^1.2.5",
"fast-glob": "^3.2.12",
"finalhandler": "^1.2.0",
"html-minifier": "^4.0.0",
"jest": "^29.3.1",
"jest": "^29.4.1",
"jstransformer-sass": "^1.0.0",
"livereload": "^0.9.3",
"node-watch": "^0.7.3",
"pug": "^3.0.2",
"rollup": "^3.9.1",
"rollup-plugin-terser": "^7.0.2",
"rollup": "^3.11.0",
"rollup-plugin-version-injector": "^1.3.3",
"serve-static": "^1.15.0",
"web-streams-polyfill": "^3.2.1"
},
Expand Down
100 changes: 67 additions & 33 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,76 @@
import _ from 'lodash'
import { terser } from 'rollup-plugin-terser'
import { fileURLToPath } from 'node:url'
import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import terser from '@rollup/plugin-terser'
import versionInjector from 'rollup-plugin-version-injector'

// good rollup example: https://github.com/MattiasBuelens/web-streams-polyfill/blob/master/rollup.config.js
const configBrowser = {
format: 'umd',
globals: {
lodash: '_',
const configs = [
// src/main.js
{
input: 'src/main.js',
plugins: [json(), resolve(), commonjs(), versionInjector({
injectInComments: false,
logLevel: 'error',
})],
external: ['lodash'],
output: _.times(2, isMin => ({
file: 'dist/pn532.js',
format: 'umd',
name: 'Pn532',
globals: {
lodash: '_',
},
...(!isMin ? {} : { // for minify
file: 'dist/pn532.min.js',
plugins: [terser()],
}),
})),
},

// src/Crypto1.js
{
input: 'src/Crypto1.js',
plugins: [json(), resolve(), commonjs()],
external: [
'lodash',
fileURLToPath(new URL('src/main.js', import.meta.url)),
],
output: _.times(2, isMin => ({
file: 'dist/Crypto1.js',
format: 'umd',
name: 'Crypto1',
globals: {
lodash: '_',
[fileURLToPath(new URL('src/main', import.meta.url))]: 'Pn532',
},
...(!isMin ? {} : { // for minify
file: 'dist/Crypto1.min.js',
plugins: [terser()],
}),
})),
},
}

const configs = _.map([
{ name: 'Pn532', input: 'main', output: 'pn532' },
{ name: 'Pn532WebbleAdapter', input: 'plugin/WebbleAdapter', output: 'plugin/WebbleAdapter' },
{ name: 'Pn532WebserialAdapter', input: 'plugin/WebserialAdapter', output: 'plugin/WebserialAdapter' },
{ name: 'Pn532LoggerRxTx', input: 'plugin/LoggerRxTx', output: 'plugin/LoggerRxTx' },
{ name: 'Pn532Hf14a', input: 'plugin/Hf14a', output: 'plugin/Hf14a' },
], arg => ({
input: `src/${arg.input}.js`,
plugins: [json(), resolve(), commonjs()],
external: [
'lodash',
],
output: [
{
...configBrowser,
name: arg.name,
file: `dist/${arg.output}.js`,
},
{
...configBrowser,
name: arg.name,
file: `dist/${arg.output}.min.js`,
plugins: [terser()],
},
],
}))
// plugins
..._.map(['Hf14a', 'LoggerRxTx', 'WebbleAdapter', 'WebserialAdapter'], plugin => ({
input: `src/plugin/${plugin}.js`,
plugins: [json(), resolve(), commonjs()],
external: ['lodash'],
output: _.times(2, isMin => ({
file: `dist/plugin/${plugin}.js`,
format: 'umd',
name: `Pn532${plugin}`,
globals: {
lodash: '_',
},
...(!isMin ? {} : { // for minify
file: `dist/plugin/${plugin}.min.js`,
plugins: [terser()],
}),
})),
})),
]

export default configs
Loading

0 comments on commit f71ad47

Please sign in to comment.