Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
NodeJS binding of Freefare to access Mifare cards (classic, Ultralight and DESfire) via libNFC
NodeJS binding of LibFreefare. LibFreefare is a library to manipulate Mifare NFC smart cards (Classic, DESFire, Ultralight, etc) over LibNFC. Your reader has to be compatible with LibNFC to work with this Library (Check out the compatibility matrix to know if your device is compatible)
Due to lack of time and testing material, the binding is not complete :
If you need Freefare function which are currently not bound, submit an issue, a pull request or contact me by email.
You need at least NodeJS v6. Go to NodeJs website to know how to get it for your system.
You also need LibFreefare. Under debian you can do
apt-get install libfreefare0 libfreefare-dev
Finally use npm. to install this package
npm install freefare
You can find examples under the examples/
directory
When a Freefare object is created, it automatically initialize LibNFC. Once initialized, you can list available NFC devices.
Give a list of available NFC devices
Returns: Promise.<Array.<Device>>
, A promise to the Device
list.
A NibNFC compatible device that can read NFC tag.
The open()
method have to be executed before any other.
Open device for further communication
Returns: Promise
, A promise to the end of the action.
Close device to release memory and device
Returns: Promise
, A promise to the end of the action.
List of detected tags
Returns: Promise.<Array.<(Tag|MifareUltralightTag|MifareClassicTag|MifareDesfireTag)>>
, A promise to the list of Tag
Abort command blocking the device like open().
Returns: Promise
, A promise to the end of the action.
A Freefare compatible NFC tag
Get Tag type
Returns: string
, The tag type between MIFARE_CLASSIC_1K
, MIFARE_CLASSIC_4K
, MIFARE_DESFIRE
, MIFARE_ULTRALIGHT
, MIFARE_ULTRALIGHT_C
Get Tag friendly name
Returns: string
, The tag friendly name
Get Tag UID
Returns: string
, The tag UID
A MIFARE Ultralight tag
Extends: Tag
Open tag for further communication
Returns: Promise
, A promise to the end of the action.
Close tag to release memory and device
Returns: Promise
, A promise to the end of the action.
Read a page on the tag
Parameters
Number
, The page number between 0 and 11Returns: Promise.<Buffer>
, A promise to the read data (in a 4 bytes buffer)
Write a page on the tag
Parameters
Number
, The page number between 0 and 11Buffer
, A buffer of 4 bytes to be written on the pageReturns: Promise
, A promise to the end of the action.
A MIFARE Classic tag
Extends: Tag
Open tag for further communication
Returns: Promise
, A promise to the end of the action.
Close tag to release memory and device
Returns: Promise
, A promise to the end of the action.
After openning the tag, an authentication is required for further operation.
Parameters
Number
, The block number between 0 and 63 (for 1k)Buffer
, The keyString
, "A" or "B"Returns: Promise
, A promise to the end of the action.
Read the given block
Parameters
Number
, The block number between 0 and 63 (for 1k)Returns: Promise.<Buffer>
, A promise to the read data (in a 16 bytes buffer)
Write on the given block
Parameters
Number
, The block number between 0 and 63 (for 1k)Buffer
, A 16 byte buffer (for 1k)Returns: Promise
, A promise to the end of the action.
Initialize a value block, with the given value and address
Parameters
Number
, The block number between 0 and 63 (for 1k)Number
, The Int32 value that will be storedString
, A 1 byte address which can be used to save the storage address of a block, when implementing a powerful backup managementReturns: Promise
, A promise to the end of the action.
Read a value block
Parameters
Number
, The block number between 0 and 63 (for 1k)Returns: Promise.<Object>
, A promise to an object containing value and adr : {adr: 0, value: 0}
Increment the block value by a given amount and store it in the internal data register
Parameters
Number
, The block number between 0 and 63 (for 1k)Number
, The amount that will be added to the valueReturns: Promise
, A promise to the end of the action.
Decrement the block value by a given amount and store it in the internal data register
Parameters
Number
, The block number between 0 and 63 (for 1k)Number
, The amount that will be remove from the valueReturns: Promise
, A promise to the end of the action.
Put a block value from in the internal data register
Parameters
Number
, The block number between 0 and 63 (for 1k)Returns: Promise
, A promise to the end of the action.
Restore the internal data register to the given block value
Parameters
Number
, The block number between 0 and 63 (for 1k)Returns: Promise
, A promise to the end of the action.
A MIFARE DESFire tag
Extends: Tag
Open tag for further communication
Returns: Promise
, A promise to the end of the action.
Close tag to release memory and device
Returns: Promise
, A promise to the end of the action.
Authenticate with a DES key
Parameters
Number
, The number of the keyBuffer
, The 8 byte keyReturns: Promise
, A promise to the end of the action.
Authenticate with a 3DES key
Parameters
Number
, The number of the keyBuffer
, The 16 byte keyReturns: Promise
, A promise to the end of the action.
List application IDs (AID)
Returns: Promise.<Array.<Number>>
, A promise to the AID list
Select an application
Parameters
Buffer
, Application id in 3 byte BufferReturns: Promise
, A promise to the end of the action.
List file IDs (AID)
Returns: Promise.<Array.<Number>>
, A promise to the File ID list
Read the given file
Parameters
Number
, The file IDNumber
, The number of bytes before we start reading in the fileNumber
, The number of bytes we will read in the fileReturns: Promise.<Buffer>
, A promise to the read data
Write on the given file
Parameters
Number
, The file IDNumber
, The number of bytes before we start reading in the fileNumber
, The number of bytes we will read in the fileBuffer
, A data bufferReturns: Promise
, A promise to the end of the action.
FAQs
NodeJS binding of Freefare to access Mifare cards (classic, Ultralight and DESfire) via libNFC
The npm package freefare receives a total of 5 weekly downloads. As such, freefare popularity was classified as not popular.
We found that freefare demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.