Socket
Socket
Sign inDemoInstall

nfcpassportreader

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "nfcpassportreader",
"version": "1.0.0",
"version": "1.0.1",
"description": "Read passport using NFC",

@@ -5,0 +5,0 @@ "main": "index.android.js",

# react-native-passport-reader
# NFC Passport Reader
Adapted from [passport-reader](https://github.com/tananaev/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.
Adapted from [react-native-passport-reader](https://github.com/tradle/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.
## Getting started
```sh
$ npm install react-native-passport-reader --save
$ react-native link react-native-passport-reader
$ npm i nfcpassportreader --save
$ react-native link nfcpassportreader
```

@@ -36,20 +37,9 @@

```js
import PassportReader from 'react-native-passport-reader'
import PassportReader from 'nfcpassportreader'
// { scan, cancel, isSupported }
async function scan () {
// 1. start a scan
// 2. press the back of your android phone against the passport
// 3. wait for the scan(...) Promise to get resolved/rejected
const [passportData, setPassportData] = useState(null);
const {
firstName,
lastName,
gender,
issuer,
nationality,
photo
} = await PassportReader.scan({
// yes, you need to know a bunch of data up front
// this is data you can get from reading the MRZ zone of the passport
const scanPassport = async () => {
const { firstName, lastName, gender, issuer, nationality, photo } = await PassportReader.scan({
documentNumber: 'ofDocumentBeingScanned',

@@ -60,4 +50,26 @@ dateOfBirth: 'yyMMdd',

const { base64, width, height } = photo
setPassportData({
firstName,
lastName,
gender,
issuer,
nationality,
photo
})
}
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>
);
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc