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.
- Install the package in your Expo Project (see Example)
npm install @signumjs/crypto @signumjs/react-native-expo-crypto-adapter
- 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;
- 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());
Find a complete example app here