Secure Keystore is a library exclusively for Android platform. The devices which have a Hardware Keystore can use this library to perform encryption, decryption and computation of HMAC on the native side using the Hardware backed security features.
The Secure Keystore is an independent module published as NPM module which provides Android APIs for the same on React. On a React Native application, this can be installed via
For RSA based Key Pair
For symmetric key
deviceSupportsHardware: boolean
Checks if the device supports hardware keystore.
generateKey(alias: string) => void
Generates a symmetric key for encryption and decryption.
generateKey(alias: string) => string
Generates an asymmetric RSA key Pair for signing.
encryptData(alias: string, data: string) => string
Encrypts the given data using the key that is assigned to the alias. Returns back encrypted data as a string.
decryptData(alias: string, encryptionText: string) => string
Decrypts the given encryptionText
using the key that is assigned to the alias. Returns back the data as a string.
sign(alias: string, data: string) => string
Creates a signature for the given data using the key that is assigned to the alias. Returns back the signature as a string.
hasAlias(alias: string) => boolean
Checks if the given alias is present in the keystore.