
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
@dhairyasharma/react-native-encryption
Advanced tools
@dhairyasharma/react-native-encryption
| File Details |
| File Link http://bit.do/benchmarkfile File Size 1.09 GB |
| IOS Benchmark |
| Average of 100 Encryption 4.859 seconds Average of 100 Decryption 5.594 seconds Check Log for all IOS encryption here. Check Log for all IOS decryption here. |
| Android Benchmark |
| Average of 100 Encryption 20.373 seconds Average of 100 Decryption 21.908 seconds Check Log for all Android encryption here. Check Log for all Android decryption here. |
Install the library using either Yarn:
yarn add @dhairyasharma/react-native-encryption
or npm:
npm install --save @dhairyasharma/react-native-encryption
or git:
npm install git+https://github.com/dhairya0907/react-native-encryption.git
Linking the package manually is not required anymore with Autolinking.
cd ios && pod install && cd ..
Android Platform:
Does not require any additional steps.
import RNEncryptionModule from "@dhairyasharma/react-native-encryption";
RNEncryptionModule.encryptText(
plainText,
password
).then((res: any) => {
if (res.status == "success") {
console.log("success", res)
} else {
Alert.alert("Error", res);
}
}).catch((err: any) => {
console.log(err);
});
returns
// If text encryption is successful, it returns a JSON object with the following structure:
{
"status": "success",
"encryptedText": "encryptedText",
"iv": "iv",
"salt": "salt"
}
or
// If text encryption is unsuccessful, it returns a JSON object with the following structure:
{
"status": "Fail",
"error": "error"
}
RNEncryptionModule.decryptText(
encryptedText,
password,
iv,
salt).then((res: any) => {
if (res.status == "success") {
console.log("success", res)
} else {
Alert.alert("Error", res);
}
}).catch((err: any) => {
console.log(err);
});
returns
// If text decryption is successful, it returns a JSON object with the following structure:
{
"status": "success",
"decryptedText": "decryptedText"
}
or
// If text decryption is unsuccessful, it returns a JSON object with the following structure:
{
"status": "Fail",
"error": "error"
}
RNEncryptionModule.encryptFile(
inputFilePath,
outputEncryptedFilePath,
password
).then((res: any) => {
if (res.status == "success") {
console.log("success", res)
} else {
console.log("error", res);
}
}).catch((err: any) => {
console.log(err);
});
returns
// If file encryption is successful, it returns a JSON object with the following structure:
{
"status": "success",
"iv": "iv",
"salt": "salt"
}
or
// If file encryption is unsuccessful, it returns a JSON object with the following structure:
{
"status": "Fail",
"error": "error"
}
RNEncryptionModule.decryptFile(
encryptedFilePath,
outputDecryptedFilePath,
password,
iv,
salt
).then((res: any) => {
if (res.status == "success") {
console.log("success", res)
} else {
console.log("error", res);
}
}).catch((err: any) => {
console.log(err);
});
returns
// If file decryption is successful, it returns a JSON object with the following structure:
{
"status": "success",
"message" : "File decrypted successfully"
}
or
// If file decryption is unsuccessful, it returns a JSON object with the following structure:
{
"status": "Fail",
"error": "error"
}
NOTE
On android, Input or Output file path does not support content:// type file path. Please use file:// type file path.
You can use react-native-fetch-blob stat to get original path. See example.
You will need Files and media permission for this.
Dhairya Sharma | @dhairya0907
The library is released under the MIT license. For more information see LICENSE.
FAQs
Encryption/Decryption for React Native
The npm package @dhairyasharma/react-native-encryption receives a total of 24 weekly downloads. As such, @dhairyasharma/react-native-encryption popularity was classified as not popular.
We found that @dhairyasharma/react-native-encryption demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.