The primary purpose of this PR was to implement a React Native wrapper for the pairing crypto library and to be published as an NPM package. But it also slightly modified the build scripts for the Obj-c and Java wrappers to accommodate the bundling requirements.
Development
The wrappers/react-native package comes with a set of independent build scripts, which will manage to build the dependant native libraries (eg: C, Obj-c, Java, and Rust wrappers) automatically.
To build all the libraries:
yarn build:all
which essentially executes the following scripts:
yarn build: transpile TS source code to CJS and ESM module, and output type definitions
the build artifacts can be found in the lib directory
./scripts/build-ios.sh: builds the ios native module and its dependencies
the build artifacts can be found in the ios/lib directory
./scripts/build-android.sh: builds the android native module and its dependencies
the build artifacts can be found in the android/lib directory
The package also comes with an example React Native App that integrates all the library functions in a simple UI:
It loads the generated test fixtures into the App via a babel plugin (remember to restart metro after updating the fixtures)
Each button in the App is a test case, the Res value indicates whether the function result matches the expected value
To run Detox tests:
yarn detox:build # build both iOS and Android apps
yarn detox:ios # run iOS tests
yarn detox:android # run Android tests
Usage
The React Native wrapper will be published as a standalone NPM package that is also bundled with the native library dependencies. And the package also enables RN auto-linking, that being said, it doesn't require any special setup on the consumers of this package (such as Mobile Wallet).
yarn add @mattrglobal/pairing-crypto-rn
# For iOS, the podspec will be detected and installed automatically
cd ios && pod install
# For Android, it will just work magically :)
echo "Magic!"
Description
The primary purpose of this PR was to implement a React Native wrapper for the pairing crypto library and to be published as an NPM package. But it also slightly modified the build scripts for the Obj-c and Java wrappers to accommodate the bundling requirements.
Development
The
wrappers/react-native
package comes with a set of independent build scripts, which will manage to build the dependant native libraries (eg: C, Obj-c, Java, and Rust wrappers) automatically.To build all the libraries:
which essentially executes the following scripts:
yarn build
: transpile TS source code to CJS and ESM module, and output type definitionslib
directory./scripts/build-ios.sh
: builds the ios native module and its dependenciesios/lib
directory./scripts/build-android.sh
: builds the android native module and its dependenciesandroid/lib
directoryE2E Tests
The package also comes with an example React Native App that integrates all the library functions in a simple UI:
Res
value indicates whether the function result matches the expected valueTo run Detox tests:
Usage
The React Native wrapper will be published as a standalone NPM package that is also bundled with the native library dependencies. And the package also enables RN auto-linking, that being said, it doesn't require any special setup on the consumers of this package (such as Mobile Wallet).
Others
NPM Package: https://www.npmjs.com/package/@mattrglobal/pairing-crypto-rn