Skip to content

This is the React Native implementation of the CryptoAdapter for @signumjs/crypto

License

Notifications You must be signed in to change notification settings

signum-network/signumjs-react-native-crypto-adapter

Repository files navigation

SignumJS Crypto Adapter for React Native EXPO

This is the React Native Expo implementation of the CryptoAdapter for @signumjs/crypto

Note: this adapter does only work with Expo - not for bare React Native!

For any Crypto operations, like signing transactions, en/decrypting P2P messages or even hash related operations you need to install this adapter.

Installation

  1. Install the package in your Expo Project (see Example)
npm install @signumjs/crypto @signumjs/react-native-expo-crypto-adapter
  1. Create or modify the Expo Apps metro.config.js to remove default crypto adapters from bundler
// metro.config.js
const { getDefaultConfig } = require('@expo/metro-config');

const defaultConfig = getDefaultConfig(__dirname);
defaultConfig.resolver.blockList = [
    /@signumjs\/crypto\/adapters\/.+$/
];
module.exports = defaultConfig;
  1. Initialize the Crypto Module to use the "native" Expo Crypto Adapter

In your entry point of your application, e.g. ./app/_layout.tsx you have to add the following code:

/**
 * The next steps are required to initialize signumjs/crypto module for Expo
 */
import {Crypto} from '@signumjs/crypto'
import {ReactNativeExpoCryptoAdapter} from "@signumjs/react-native-expo-crypto-adapter"

Crypto.init(new ReactNativeExpoCryptoAdapter());

Example

Find a complete example app here

Troubleshooting

About

This is the React Native implementation of the CryptoAdapter for @signumjs/crypto

Resources

License

Stars

Watchers

Forks

Packages

No packages published