React Security Native App uses Keychain

Tram Ho

Security is always an absolutely important issue of the software. For mobile applications, normally we will have to secure information such as account name, password, touch id, credit card information etc.

The react-native-keychain library provides keychain / keystore so we can store and retrieve stored information securely for the application.


  1. Run the command:

  1. If React Native version <= 0.59, run the following command to link the library:

  1. Run pod install in the ios / directory to install iOS dependencies
  2. If you want to support FaceID, add the NSFaceIDUsageDescription entry to Info.plist


Take a look at the example below, we will store and access login information with Keychain offline.


This function will store username / password information in secure storage. Note that this function will only store strings, so if you want to store information in object form, we must convert to JSON string to store offline.


This function will help us retrieve login information stored in secure storage.


This function will delete all saved logins and reset it.


This function will be used to check the biometrics that the device supports

Use with server

The library also provides an API to store server information along with a username and password.


For Android, this module will implement CipherStorage based on API level:

  • API level 16-22 will en / de crypt use Facebook Conceal
  • API level 23+ will en / de crypt use the Android Keystore

The encrypted information will be stored in SharedPreference.


Share the news now

Source : Viblo