Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
nfcpassportreader
Advanced tools
Readme
Adapted from react-native-passport-reader. Individual modifications are too many to enumerate, but essentially: the workflow code was adapted to the needs of a React Native module, and the scanning code was largely left as is.
$ npm i nfcpassportreader --save
$ react-native link nfcpassportreader
In your android/app/build.gradle
add packagingOptions
:
android {
...
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
In AndroidManifest.xml
add:
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.nfc" android:required="false" />
If your app will not function without nfc capabilities, set android:required
above to true
import PassportReader from 'nfcpassportreader'
const [passportData, setPassportData] = useState(null);
const scanPassport = async () => {
const { firstName, lastName, gender, issuer, nationality, photo } = await PassportReader.scan({
documentNumber: 'ofDocumentBeingScanned',
dateOfBirth: 'yyMMdd',
dateOfExpiry: 'yyMMdd'
})
setPassportData({
firstName,
lastName,
gender,
issuer,
nationality,
photo
})
}
// Example on how to display it
return (
<View style={styles.container}>
<Text>Passport data:</Text>
<Text>{passportData.firstName}</Text>
<Text>{passportData.lastName}</Text>
<Text>{passportData.gender}</Text>
<Text>{passportData.issuer}</Text>
<Text>{passportData.nationality}</Text>
<Image
source={{ uri: passportData.photo.base64 }}
style={{ width: 150, height: 250 }}
/>
</View>
);
FAQs
Read passport using NFC
The npm package nfcpassportreader receives a total of 1 weekly downloads. As such, nfcpassportreader popularity was classified as not popular.
We found that nfcpassportreader demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.