Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion .github/workflows/release-android-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,23 @@ jobs:
google-services-file: ${{ secrets.google-services-file }}
if: ${{ env.google-services-file != '' }}
run: echo ${{ env.google-services-file }} | base64 --decode >> ${{ inputs.root-path }}/android/app/google-services.json


- name: Optimize Gradle for CI
run: |
echo "org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=1024m" >> ${{ inputs.root-path }}/android/gradle.properties
echo "org.gradle.parallel=true" >> ${{ inputs.root-path }}/android/gradle.properties
echo "org.gradle.caching=true" >> ${{ inputs.root-path }}/android/gradle.properties

- name: Cache Gradle
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Build APK
run: |
if [ ${{ inputs.release-type }} = 'internal' ]; then
Expand Down
2 changes: 1 addition & 1 deletion dapps/W3MEthers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"private": true,
"scripts": {
"android": "react-native run-android",
"android:build": "cd android && ./gradlew clean && ./gradlew assembleRelease",
"android:build": "cd android && ./gradlew clean && ./gradlew assembleRelease -PreactNativeArchitectures=arm64-v8a",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
Expand Down
2 changes: 1 addition & 1 deletion dapps/W3MEthers5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"private": true,
"scripts": {
"android": "react-native run-android",
"android:build": "cd android && ./gradlew clean && ./gradlew assembleRelease",
"android:build": "cd android && ./gradlew clean && ./gradlew assembleRelease -PreactNativeArchitectures=arm64-v8a",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
Expand Down
4 changes: 2 additions & 2 deletions dapps/W3MWagmi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"private": true,
"scripts": {
"android": "yarn run copy:debug && react-native run-android --appId com.walletconnect.web3modal.rnsample.debug",
"android:build": "yarn run copy:production && cd android && ./gradlew clean && ./gradlew assembleRelease",
"android:build:internal": "yarn run copy:internal && cd android && ./gradlew clean && ./gradlew assembleInternal",
"android:build": "yarn run copy:production && cd android && ./gradlew clean && ./gradlew assembleRelease -PreactNativeArchitectures=arm64-v8a",
"android:build:internal": "yarn run copy:internal && cd android && ./gradlew clean && ./gradlew assembleInternal -PreactNativeArchitectures=arm64-v8a",
"ios": "react-native run-ios",
"ios:internal": "react-native run-ios --scheme 'W3MWagmi Internal' ",
"lint": "eslint .",
Expand Down
1 change: 1 addition & 0 deletions wallets/rn_cli_wallet/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
ENV_PROJECT_ID='39bc93c...'
ENV_RELAY_URL='wss://relay.walletconnect.org'
ENV_SENTRY_DSN=''
ENV_TON_CENTER_API_KEY=''

# for android builds. for iOS check xcode.env file
SENTRY_DISABLE_AUTO_UPLOAD=true
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
diff --git a/dist/native/getSecureRandom.js b/dist/native/getSecureRandom.js
index b769fd9ad676132979c406b5c77bea98838a2104..b3a153661498e349dd502295cf61075d29892fb6 100644
--- a/dist/native/getSecureRandom.js
+++ b/dist/native/getSecureRandom.js
@@ -8,9 +8,10 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSecureRandomWords = exports.getSecureRandomBytes = void 0;
-const getRandomBytes = require('expo-crypto').getRandomBytes;
function getSecureRandomBytes(size) {
- return Buffer.from(getRandomBytes(size));
+ const bytes = new Uint8Array(size);
+ crypto.getRandomValues(bytes);
+ return Buffer.from(bytes);
}
exports.getSecureRandomBytes = getSecureRandomBytes;
function getSecureRandomWords(size) {
diff --git a/dist/native/pbkdf2_sha512.js b/dist/native/pbkdf2_sha512.js
index fe733396a95b9374665953bb102cdaa0f4d69e9c..4eecb6bb5f46c796316ae3cd5a461aaa5b4862fe 100644
--- a/dist/native/pbkdf2_sha512.js
+++ b/dist/native/pbkdf2_sha512.js
@@ -11,7 +11,8 @@ exports.pbkdf2_sha512 = void 0;
async function pbkdf2_sha512(key, salt, iterations, keyLen) {
const keyBuffer = typeof key === 'string' ? Buffer.from(key, 'utf-8') : key;
const saltBuffer = typeof salt === 'string' ? Buffer.from(salt, 'utf-8') : salt;
- let pbkdf2 = require('react-native-fast-pbkdf2').default;
+ var crypto = require("crypto");
+ let pbkdf2 = crypto.pbkdf2Sync;
- let res = await pbkdf2.derive(keyBuffer.toString('base64'), saltBuffer.toString('base64'), iterations, keyLen, 'sha-512');
+ let res = crypto.pbkdf2Sync(keyBuffer, saltBuffer, iterations, keyLen, 'sha512');
- return Buffer.from(res, 'base64');
+ return res;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
diff --git a/src/index.js b/src/index.js
index b83863f4b3d09df1159eb2c05d43e20a05d55767..926895a1f697905d48bf32f32fc538de3ce1b252 100644
--- a/src/index.js
+++ b/src/index.js
@@ -38,20 +38,68 @@ function salt(password) {
function mnemonicToSeedSync(mnemonic, password) {
const mnemonicBuffer = Uint8Array.from(Buffer.from(normalize(mnemonic), 'utf8'));
const saltBuffer = Uint8Array.from(Buffer.from(salt(normalize(password)), 'utf8'));
- const res = pbkdf2_1.pbkdf2(sha512_1.sha512, mnemonicBuffer, saltBuffer, {
- c: 2048,
- dkLen: 64,
- });
- return Buffer.from(res);
+
+ // Use react-native-quick-crypto's native PBKDF2
+ try {
+ var crypto = require("crypto");
+ const res = crypto.pbkdf2Sync(
+ mnemonicBuffer,
+ saltBuffer,
+ 2048, // iterations
+ 64, // key length
+ 'sha512'
+ );
+ return Buffer.from(res);
+ } catch (e) {
+ console.warn('Native pbkdf2Sync failed, falling back to JS implementation', e);
+ // Fallback to original implementation
+ const res = pbkdf2_1.pbkdf2(sha512_1.sha512, mnemonicBuffer, saltBuffer, {
+ c: 2048,
+ dkLen: 64,
+ });
+ return Buffer.from(res);
+ }
}
exports.mnemonicToSeedSync = mnemonicToSeedSync;
+
function mnemonicToSeed(mnemonic, password) {
const mnemonicBuffer = Uint8Array.from(Buffer.from(normalize(mnemonic), 'utf8'));
const saltBuffer = Uint8Array.from(Buffer.from(salt(normalize(password)), 'utf8'));
- return pbkdf2_1.pbkdf2Async(sha512_1.sha512, mnemonicBuffer, saltBuffer, {
- c: 2048,
- dkLen: 64,
- }).then((res) => Buffer.from(res));
+
+ // Use react-native-quick-crypto's native PBKDF2
+ try {
+ var crypto = require("crypto");
+ return new Promise((resolve, reject) => {
+ crypto.pbkdf2(
+ mnemonicBuffer,
+ saltBuffer,
+ 2048, // iterations
+ 64, // key length
+ 'sha512',
+ (err, res) => {
+ if (err) {
+ reject(err);
+ } else {
+ resolve(Buffer.from(res));
+ }
+ }
+ );
+ }).catch((err) => {
+ console.warn('Native pbkdf2 failed, falling back to JS implementation', err);
+ // Fallback to original implementation
+ return pbkdf2_1.pbkdf2Async(sha512_1.sha512, mnemonicBuffer, saltBuffer, {
+ c: 2048,
+ dkLen: 64,
+ }).then((res) => Buffer.from(res));
+ });
+ } catch (e) {
+ console.warn('Native pbkdf2 not available, using JS implementation', e);
+ // Fallback to original implementation
+ return pbkdf2_1.pbkdf2Async(sha512_1.sha512, mnemonicBuffer, saltBuffer, {
+ c: 2048,
+ dkLen: 64,
+ }).then((res) => Buffer.from(res));
+ }
}
exports.mnemonicToSeed = mnemonicToSeed;
function mnemonicToEntropy(mnemonic, wordlist) {
1 change: 1 addition & 0 deletions wallets/rn_cli_wallet/declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ declare module 'react-native-config' {
ENV_RELAY_URL: string;
ENV_SENTRY_DSN: string;
ENV_SENTRY_TAG: string;
ENV_TON_CENTER_API_KEY: string;
}

export const Config: NativeConfig;
Expand Down
7 changes: 3 additions & 4 deletions wallets/rn_cli_wallet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import 'react-native-gesture-handler';
import '@walletconnect/react-native-compat';
import {AppRegistry} from 'react-native';
import {name as appName} from './app.json';
import crypto from 'react-native-quick-crypto';
import crypto, { install } from 'react-native-quick-crypto';

import App from './src/screens/App';
install();

const polyfillDigest = async (algorithm, data) => {
const algo = algorithm.replace('-', '').toLowerCase();
Expand All @@ -13,11 +13,10 @@ const polyfillDigest = async (algorithm, data) => {
return hash.digest();
};

// eslint-disable-next-line no-undef
globalThis.crypto = crypto;
// eslint-disable-next-line no-undef
globalThis.crypto.subtle = {
digest: polyfillDigest,
};

import App from './src/screens/App';
AppRegistry.registerComponent(appName, () => App);
6 changes: 0 additions & 6 deletions wallets/rn_cli_wallet/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,10 @@ end

# Use it to require both react-native's and this package's scripts:
node_require('react-native/scripts/react_native_pods.rb')
node_require('react-native-permissions/scripts/setup.rb')

platform :ios, min_ios_version_supported
prepare_react_native_project!

setup_permissions([
'Camera',
'Notifications'
])


linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Expand Down
38 changes: 3 additions & 35 deletions wallets/rn_cli_wallet/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1783,7 +1783,7 @@ PODS:
- React-RCTFBReactNativeSpec
- ReactCommon/turbomodule/core
- SocketRocket
- react-native-compat (2.22.2):
- react-native-compat (2.22.4):
- boost
- DoubleConversion
- fast_float
Expand Down Expand Up @@ -2619,34 +2619,6 @@ PODS:
- ReactCommon/turbomodule/core
- SocketRocket
- Yoga
- RNPermissions (5.4.2):
- boost
- DoubleConversion
- fast_float
- fmt
- glog
- hermes-engine
- RCT-Folly
- RCT-Folly/Fabric
- RCTRequired
- RCTTypeSafety
- React-Core
- React-debug
- React-Fabric
- React-featureflags
- React-graphics
- React-ImageManager
- React-jsi
- React-NativeModulesApple
- React-RCTFabric
- React-renderercss
- React-rendererdebug
- React-utils
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- SocketRocket
- Yoga
- RNScreens (4.16.0):
- boost
- DoubleConversion
Expand Down Expand Up @@ -2890,7 +2862,6 @@ DEPENDENCIES:
- "RNCClipboard (from `../node_modules/@react-native-clipboard/clipboard`)"
- RNDeviceInfo (from `../node_modules/react-native-device-info`)
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
- RNPermissions (from `../node_modules/react-native-permissions`)
- RNScreens (from `../node_modules/react-native-screens`)
- "RNSentry (from `../node_modules/@sentry/react-native`)"
- RNSVG (from `../node_modules/react-native-svg`)
Expand Down Expand Up @@ -3076,8 +3047,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-device-info"
RNGestureHandler:
:path: "../node_modules/react-native-gesture-handler"
RNPermissions:
:path: "../node_modules/react-native-permissions"
RNScreens:
:path: "../node_modules/react-native-screens"
RNSentry:
Expand Down Expand Up @@ -3131,7 +3100,7 @@ SPEC CHECKSUMS:
React-logger: 30adf849117e87cf86e88dca1824bb0f18f87e10
React-Mapbuffer: 499069c3dcd4b438a70fcc2a65e8a4185ea9170b
React-microtasksnativemodule: f0238469cb9894fd18c419137d312665b8fc05b3
react-native-compat: 3573295702a92c9b13cc0ee3dd47499c5aee0c32
react-native-compat: 67bb1df21b252406f83fe8c0302c8479b53c03b0
react-native-config: 644074ab88db883fcfaa584f03520ec29589d7df
react-native-get-random-values: d16467cf726c618e9c7a8c3c39c31faa2244bbba
react-native-mmkv: ac7507625cd74bac0eb5333604a7cd7b08fe9e3e
Expand Down Expand Up @@ -3176,7 +3145,6 @@ SPEC CHECKSUMS:
RNCClipboard: 4b58c780f63676367640f23c8e114e9bd0cf86ac
RNDeviceInfo: bcce8752b5043a623fe3c26789679b473f705d3c
RNGestureHandler: f1dd7f92a0faa2868a919ab53bb9d66eb4ebfcf5
RNPermissions: 304745e60937128f77f79a64e342295549d829da
RNScreens: 0bbf16c074ae6bb1058a7bf2d1ae017f4306797c
RNSentry: bbaa7ef3a4b131bc947de327ed9e47a054ce0978
RNSVG: 8c0bbfa480a24b24468f1c76bd852a4aac3178e6
Expand All @@ -3185,6 +3153,6 @@ SPEC CHECKSUMS:
VisionCamera: 30b358b807324c692064f78385e9a732ce1bebfe
Yoga: edeb9900b9e5bb5b27b9a6a2d5914e4fe4033c1b

PODFILE CHECKSUM: 198cfec3fad83c0e3af1672f94f8de0ffc5f2180
PODFILE CHECKSUM: 37b3abb743131d0d701e76db155ef06d7f5954ad

COCOAPODS: 1.14.3
21 changes: 12 additions & 9 deletions wallets/rn_cli_wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"private": true,
"scripts": {
"android": "yarn run copy:debug && react-native run-android --mode=debug --appId com.walletconnect.web3wallet.rnsample.debug",
"android:build": "yarn run copy:production && cd android && ./gradlew clean && ./gradlew assembleRelease",
"android:build:internal": "yarn run copy:internal && cd android && ./gradlew clean && ./gradlew assembleInternal",
"android:build": "yarn run copy:production && cd android && ./gradlew clean && ./gradlew assembleRelease -PreactNativeArchitectures=arm64-v8a",
"android:build:internal": "yarn run copy:internal && cd android && ./gradlew clean && ./gradlew assembleInternal -PreactNativeArchitectures=arm64-v8a",
"ios": "react-native run-ios --scheme 'RNWallet-Debug'",
"ios:internal": "react-native run-ios --scheme 'RNWallet-Internal'",
"bundle:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'",
Expand All @@ -32,13 +32,16 @@
"@react-navigation/native-stack": "7.3.27",
"@react-navigation/stack": "7.4.9",
"@reown/appkit-ui-react-native": "1.0.1",
"@reown/walletkit": "1.2.11",
"@reown/walletkit": "1.3.0",
"@sentry/react-native": "7.3.0",
"@walletconnect/react-native-compat": "2.22.2",
"@ton/core": "0.62.0",
"@ton/crypto": "3.3.0",
"@ton/ton": "15.4.0",
"@walletconnect/react-native-compat": "2.22.4",
"bip39": "3.1.0",
"dayjs": "1.11.11",
"ed25519-hd-key": "^1.3.0",
"ethers": "5.7.2",
"ethers": "5.8.0",
"fast-xml-parser": "4.4.1",
"react": "19.1.1",
"react-native": "0.82.0",
Expand All @@ -50,7 +53,6 @@
"react-native-get-random-values": "1.11.0",
"react-native-mmkv": "3.3.3",
"react-native-modal": "14.0.0-rc.1",
"react-native-permissions": "5.4.2",
"react-native-quick-base64": "2.2.2",
"react-native-quick-crypto": "0.7.17",
"react-native-safe-area-context": "5.6.1",
Expand Down Expand Up @@ -101,9 +103,10 @@
"tmp": "0.2.4",
"on-headers": "1.1.0",
"brace-expansion": "1.1.12",
"@ethersproject/pbkdf2@5.7.0": "patch:@ethersproject/pbkdf2@npm%3A5.7.0#./.yarn/patches/@ethersproject-pbkdf2-npm-5.7.0-5b8e51d4b9.patch",
"@ethersproject/pbkdf2@^5.7.0": "patch:@ethersproject/pbkdf2@npm%3A5.7.0#./.yarn/patches/@ethersproject-pbkdf2-npm-5.7.0-5b8e51d4b9.patch",
"@ethersproject/pbkdf2@^5.8.0": "patch:@ethersproject/pbkdf2@npm%3A5.7.0#./.yarn/patches/@ethersproject-pbkdf2-npm-5.7.0-5b8e51d4b9.patch"
"@ton/crypto-primitives@2.1.0": "patch:@ton/crypto-primitives@npm%3A2.1.0#./.yarn/patches/@ton-crypto-primitives-npm-2.1.0-3d1ea62176.patch",
"@ethersproject/pbkdf2@5.8.0": "patch:@ethersproject/pbkdf2@npm%3A5.8.0#./.yarn/patches/@ethersproject-pbkdf2-npm-5.8.0-b720e81bcc.patch",
"@ethersproject/pbkdf2@^5.8.0": "patch:@ethersproject/pbkdf2@npm%3A5.8.0#./.yarn/patches/@ethersproject-pbkdf2-npm-5.8.0-b720e81bcc.patch",
"bip39@3.1.0": "patch:bip39@npm%3A3.1.0#./.yarn/patches/bip39-npm-3.1.0-03958ed434.patch"
},
"packageManager": "yarn@3.8.7"
}
Loading