Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

physikey-kit-react-native

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

physikey-kit-react-native

**This package is a wrapper for [react-native-nfc-manager](https://github.com/revtel/react-native-nfc-manager), which streamlines and enhances common NFC read and write tasks with additional UI enhancements.**

  • 1.0.4
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
10
decreased by-96.55%
Maintainers
0
Weekly downloads
 
Created
Source

This package is a wrapper for react-native-nfc-manager, which streamlines and enhances common NFC read and write tasks with additional UI enhancements.

PhysiKey Kit

A React Native package that simplifies writing and reading data to and from NFC tags using react-native-nfc-manager. This package also provides an optional scan modal component for Android devices to enhance the user experience during NFC scanning.

Features

  • NFC Write: Write a list of strings to an NFC tag.
  • NFC Read: Read a list of strings from an NFC tag.

Installation

  1. Install the package using npm or yarn:
npm install physikey-kit-react-native
# or
yarn add physikey-kit-react-native
  1. Install the peer dependencies react-native-nfc-manager:
npm install react-native-nfc-manager react-native-gzip
# or
yarn add react-native-nfc-manager react-native-gzip
  1. Follow the setup instructions for react-native-nfc-manager, including enabling NFC permissions on Android, as described in its documentation.

Basic Usage

NFC Writing Function

Use writeToCard to write an array of strings to an NFC tag. The function returns a promise that resolves to an object containing the status (success) and a message.

import { writeToCard } from 'physikey-kit-react-native';

const textList = ['Hello', 'World'];

const writeTextToCard = async () => {
  try {
    const result = await writeToCard(textList);
    if (result.success) {
      console.log('Write successful:', result.message);
    } else {
      console.log('Write failed:', result.message);
    }
  } catch (error) {
    console.error('An error occurred:', error.message);
  }
}

writeTextToCard();

NFC Reading Function

Use readFromCard to read data from an NFC tag. The function returns a promise that resolves to an object containing the success status and the read contents as a list of strings (or an error message if unsuccessful).

import { readFromCard } from 'physikey-kit-react-native';

const readTextFromCard = async () => {
  try {
    const result = await readFromCard();
    if (result.success) {
      console.log('Read successful:', result.message);
    } else {
      console.log('Read failed:', result.message);
    }
  } catch (error) {
    console.error('An error occurred:', error.message);
  }
};

readTextFromCard();

License

This project is licensed under the ISC License.

Keywords

FAQs

Package last updated on 14 Nov 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc