Socket
Socket
Sign inDemoInstall

react-native-keychain

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-keychain

Keychain Access for React Native


Version published
Weekly downloads
192K
increased by5.34%
Maintainers
1
Weekly downloads
 
Created

What is react-native-keychain?

The react-native-keychain package provides a secure way to store and retrieve sensitive information such as passwords, tokens, and other credentials in a React Native application. It leverages the native keychain services on iOS and the Keystore system on Android to ensure data is stored securely.

What are react-native-keychain's main functionalities?

Storing Credentials

This feature allows you to securely store a username and password in the device's keychain or keystore.

import * as Keychain from 'react-native-keychain';

async function saveCredentials(username, password) {
  await Keychain.setGenericPassword(username, password);
}

Retrieving Credentials

This feature allows you to retrieve stored credentials from the device's keychain or keystore.

import * as Keychain from 'react-native-keychain';

async function getCredentials() {
  const credentials = await Keychain.getGenericPassword();
  if (credentials) {
    console.log('Credentials successfully loaded for user ' + credentials.username);
  } else {
    console.log('No credentials stored');
  }
}

Resetting Credentials

This feature allows you to reset or delete the stored credentials from the device's keychain or keystore.

import * as Keychain from 'react-native-keychain';

async function resetCredentials() {
  await Keychain.resetGenericPassword();
}

Storing Internet Credentials

This feature allows you to securely store internet credentials (e.g., server, username, password) in the device's keychain or keystore.

import * as Keychain from 'react-native-keychain';

async function saveInternetCredentials(server, username, password) {
  await Keychain.setInternetCredentials(server, username, password);
}

Retrieving Internet Credentials

This feature allows you to retrieve stored internet credentials from the device's keychain or keystore.

import * as Keychain from 'react-native-keychain';

async function getInternetCredentials(server) {
  const credentials = await Keychain.getInternetCredentials(server);
  if (credentials) {
    console.log('Internet credentials successfully loaded for server ' + server);
  } else {
    console.log('No internet credentials stored for server ' + server);
  }
}

Other packages similar to react-native-keychain

Keywords

FAQs

Package last updated on 16 Sep 2019

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