@authtech/tag-manager
v0.2.7
Published
test
Downloads
25
Readme
@authtech/tag-manager
NFC card reader for Authtech implementations
Installation
Install the package in your project directory with:
npm install @authtech/tag-manager
Installing dependencies
To use this package, you need to install the following dependencies:
In your project directory, run:
npm install react-native-nfc-manager
Usage
Read NFC data
import { startSession, clearSession, readTag, decryptTagData } from '@authtech/tag-manager';
// ...
const AUTHTECH_API_KEY = 'pk_test_TYooMQauvdEDq54NiTphI7jx'
try {
await startSession()
const tagData = await readTag()
} finally {
await clearSession()
}
Decrypt TAG data
const decryptedData = await decryptTagData(tagData, AUTHTECH_API_KEY)
React Hook
import { useTagManager } from '@authtech/tag-manager';
// ...
const { data, state, read, clear } = useTagManager({ apiKey: AUTHTECH_API_KEY })
return (
<View>
<Text>{state}</Text>
<Button onPress={read}>Read</Button>
</View>
)
API
readTag()
Reads the NFC tag and returns the data as a string.
requestDecrypt(tagData, apiKey)
Decrypts the tag data and returns the decrypted data as a object.
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT