
Security News
GitHub Actions Supply Chain Attack Puts Thousands of Projects at Risk
A compromised GitHub Action exposed secrets in CI/CD logs, putting thousands of projects at risk and forcing developers to urgently secure their workflows.
nfc-react-native
Advanced tools
nfc-react-native is a react-native module for android to write/read Mifare Classic (NFC) tags.
$ npm install nfc-react-native --save
$ react-native link nfc-react-native
android/app/src/main/java/[...]/MainApplication.java
import es.tiarg.nfcreactnative.NfcReactNativePackage;
to the imports at the top of the filenew NfcReactNativePackage()
to the list returned by the getPackages()
methodandroid/settings.gradle
:
include ':nfc-react-native'
project(':nfc-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/nfc-react-native/android')
android/app/build.gradle
:
compile project(':nfc-react-native')
import {readTag, writeTag} from 'nfc-react-native'
...
componentWillMount() {
getCardId()
.then((card) => {
console.log(card)
}).catch((err) => {
console.log(err)
})
// readTag([{ sector: 15, bloques: [2], clave: 'FFFFFFFFFFFF', tipoClave: 'A' }])
// .then((card) => {
// console.log(card)
// }).catch((err) => {
// console.log(err)
// })
// console.log('from promise')
// writeTag([{ sector: 15, bloques: [ { indice: 2, data: [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] } ], clave: 'FFFFFFFFFFFF', tipoClave: 'A' }])
// .then((card) => {
// console.log(card)
// }).catch((err) => {
// console.log(err)
// })
}
...
In your manifest add:
<uses-permission android:name="android.permission.NFC" />
....
Your main activity should look like
...
<activity
android:name=".MainActivity"
android:launchMode="singleTask"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.nfc.action.TECH_DISCOVERED"/>
</intent-filter>
<meta-data android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="@xml/nfc_tech_filter" />
</activity>
Add a xml file in res folder with the following:
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<tech-list>
<tech>android.nfc.tech.MifareClassic</tech>
</tech-list>
</resources>
Contributions are welcome :raised_hands:
This repository is distributed under MIT license
FAQs
NFC Wrapper
The npm package nfc-react-native receives a total of 15 weekly downloads. As such, nfc-react-native popularity was classified as not popular.
We found that nfc-react-native 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
A compromised GitHub Action exposed secrets in CI/CD logs, putting thousands of projects at risk and forcing developers to urgently secure their workflows.
Research
Security News
A malicious Maven package typosquatting a popular library is secretly stealing OAuth credentials on the 15th of each month, putting Java developers at risk.
Security News
Socket and Seal Security collaborate to fix a critical npm overrides bug, resolving a three-year security issue in the JavaScript ecosystem's most popular package manager.