npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-aes-256

v1.1.0

Published

This React Native library provides a secure and convenient way to encrypt and decrypt data using the industry-standard AES-256 algorithm. It seamlessly integrates with your React Native application, allowing you to protect sensitive information on both An

Downloads

108

Readme

react-native-aes-256 Library

This React Native library provides a secure and convenient way to encrypt and decrypt data using the industry-standard AES-256 algorithm. It seamlessly integrates with your React Native application, allowing you to protect sensitive information on both Android and iOS platforms.

Key Features:

  • Robust AES-256 Encryption: Leverages the highly secure AES-256 encryption algorithm for reliable data protection.
  • Native Module Integration: Utilizes a native module for enhanced performance and platform-specific security features.
  • Simplified API: Offers a user-friendly API with functions for encryption, decryption, and secure key/IV generation.
  • Error Handling: Includes error checking for invalid key and IV lengths, preventing potential issues.

Installation

  1. Dependency Installation: Install the library using npm or Yarn:

    npm install react-native-aes-256
    yarn add react-native-aes-256
  2. Platform-Specific Linking:

    • iOS: Run pod install in your iOS project directory.
    • Android: Rebuild your app after installing the package.

Usage

  1. Import the functions:

    import { encrypt, decrypt, generateSecureKey, generateSecureIV } from 'react-native-aes-256';
  2. Encryption:

    // Optional you can use any 32 character string
    const secureKey = await generateSecureKey('your_password'); 
    
    // Optional you can use any 16 character string
    const iv = await generateSecureIV('another_password'); 
    
    const encryptedData = await encrypt(secureKey, iv, 'your_data_to_encrypt');
  3. Decryption:

    const decryptedData = await decrypt(secureKey, iv, encryptedData);

API Reference

  • encrypt(secureKey: string, iv: string, toBeEncrypted: string): Promise<string>: Encrypts a string using the provided key and IV.
  • decrypt(secureKey: string, iv: string, toBeDecrypted: string): Promise<string>: Decrypts a string using the provided key and IV.
  • generateSecureKey(password: string): Promise<string>: Generates a secure key from a password.
  • generateSecureIV(password: string): Promise<string>: Generates a secure initialization vector (IV) from a password.

Error Handling

  • The encrypt and decrypt functions reject promises with informative error messages if the key or IV lengths are invalid.
  • The IV length should be 16
  • The SecrueKey length should be 32

Security Considerations

  • Always store keys and IVs securely. Avoid hardcoding them in your code.

Example

A basic example of encrypting and decrypting data can be found in the example folder.

License

This library is licensed under the (MIT License).