@epicchain/bs-react-native-decrypt
v1.0.0
Published
Native Decrypt for EpicChain Blockchain is a built-in feature that ensures secure and seamless encryption and decryption of data directly within the EpicChain network
Maintainers
Readme
EpicChain React Native Decrypt SDK - @epicchain/bs-react-native-decrypt
Overview
@epicchain/bs-react-native-decrypt is a vital tool for mobile developers creating blockchain-enabled applications with React Native. This package offers secure, native methods for decrypting EpicChain private keys and other sensitive data, supporting both Android and iOS platforms. It ensures private keys and critical data are securely stored and accessed within mobile environments, making it a cornerstone for safe and efficient mobile blockchain application development.
Features
- Native Decryption Support: Utilizes secure native code for Android and iOS to decrypt sensitive blockchain data.
- Secure Key Management: Ensures private keys are handled with the highest security standards.
- Cross-Platform Compatibility: Works seamlessly on both Android and iOS React Native applications.
- Blockchain-Optimized: Tailored for the EpicChain blockchain ecosystem.
- Ease of Integration: Simple setup and API for integrating decryption functionality into your apps.
Installation
To integrate the package into your project, use npm or yarn:
npm install @epicchain/bs-react-native-decryptor
yarn add @epicchain/bs-react-native-decryptAdditional Setup
iOS
After installation, ensure you install the native dependencies:
cd ios && pod installAndroid
No additional setup is required for Android. The package automatically links native dependencies.
Usage
Example: Decrypting a Private Key
Below is a high-level outline of how to decrypt private keys using this package.
- Import the package in your React Native project:
import { decryptPrivateKey } from '@epicchain/bs-react-native-decrypt';- Use the decryption method with appropriate parameters:
const encryptedKey = 'encrypted-private-key-string';
const passphrase = 'your-secure-passphrase';
async function decryptKey() {
try {
const privateKey = await decryptPrivateKey(encryptedKey, passphrase);
console.log('Decrypted Private Key:', privateKey);
} catch (error) {
console.error('Decryption failed:', error);
}
}
decryptKey();API Reference
decryptPrivateKey(encryptedKey: string, passphrase: string): Promise<string>
Decrypts an encrypted private key using the provided passphrase.
Parameters:
encryptedKey(string): The encrypted private key string.passphrase(string): The passphrase used for decryption.
Returns:
- A promise that resolves to the decrypted private key as a string.
secureStorageEnabled(): Promise<boolean>
Checks if the device has secure storage enabled (e.g., Keychain on iOS or Keystore on Android).
Returns:
- A promise that resolves to
trueif secure storage is enabled, otherwisefalse.
storeKeySecurely(key: string, value: string): Promise<void>
Stores a key-value pair securely on the device.
Parameters:
key(string): The key under which the value will be stored.value(string): The value to store securely.
Returns:
- A promise that resolves when the key-value pair is securely stored.
retrieveSecureKey(key: string): Promise<string>
Retrieves a securely stored value by its key.
Parameters:
key(string): The key for the stored value.
Returns:
- A promise that resolves to the stored value.
Contributing
We welcome contributions to enhance this package! If you have ideas for improvements or fixes, please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature-name). - Make your changes and commit them (
git commit -am 'Add new feature'). - Push to the branch (
git push origin feature-name). - Open a pull request.
License
This package is licensed under the MIT License. See the LICENSE file for more details.
Support
For questions, issues, or feature requests, please reach out to our support team at [email protected].
