Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable walletconnect #450

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
12cd003
refactor: feature toggle using hathor unleash client
andreabadesso Jan 26, 2024
2321a4b
feat: handling feature updates
andreabadesso Jan 29, 2024
5b96742
feat: added SES to the project and enabled lockdown
andreabadesso Jan 22, 2024
dc8b070
chore: added patch-package and patch to react-native
andreabadesso Jan 26, 2024
d64cf5b
chore: removed unused diff from react-native patch
andreabadesso Jan 29, 2024
d79c37e
chore: added allow-scripts
andreabadesso Jan 29, 2024
599365f
chore: added updated allowScript config
andreabadesso Jan 29, 2024
d176271
chore: added sha256sum of lockdown file
andreabadesso Jan 29, 2024
b79ad5a
refactor: moved lavamoat lockdown to a patch instead of entrypoint
andreabadesso Jan 29, 2024
7cfdc44
refactor: removed ses from package.json, reading from file
andreabadesso Jan 29, 2024
f5b5aa3
chore: fix lint by ignoring lockdown
andreabadesso Jan 29, 2024
ca46bdb
chore: allowing root postinstall and running allow-scripts on npm run…
andreabadesso Jan 30, 2024
2821355
chore: added comment explaining why we can't use hermes
andreabadesso Jan 30, 2024
e46a8b7
chore: uninstall ses as we're using a downloaded file
andreabadesso Jan 30, 2024
126ec60
chore: removed unused diff from react-native patch
andreabadesso Jan 30, 2024
c7d3c22
chore: no need to remove polyfill promise as injecting it on initiali…
andreabadesso Jan 30, 2024
9848a0c
chore: updated react-native patch to include react-native-mmkv and us…
andreabadesso Apr 11, 2024
ae2af0f
feat: added ses saga and restarting bundle when ses is disabled
andreabadesso Apr 12, 2024
ffff5b3
chore: added a document explaining how to update SES
andreabadesso Apr 11, 2024
4929736
chore: added postinstall to setup script and updated packages
andreabadesso Apr 12, 2024
7f75836
chore: fixed allow-scripts version
andreabadesso Apr 15, 2024
fcbc5f0
chore: added patch-package to postinstall
andreabadesso Apr 15, 2024
98b3ac1
chore: added MKMV to podfile.lock
andreabadesso Apr 15, 2024
caa2295
chore: reading ses enabled from constant
andreabadesso Apr 15, 2024
3c7a128
feat: yield fatal error when SES should be enabled but is not
andreabadesso Apr 24, 2024
ea15c73
refactor: improved verifySesEnabled method
andreabadesso Apr 24, 2024
81ad09c
feat: enabled walletconnect by default
andreabadesso Mar 25, 2024
4abca5c
chore: added dependencies and shims needed by walletconnect
andreabadesso Apr 11, 2024
7f40ae1
refactor: using logger to log errors
andreabadesso Apr 12, 2024
7f7d83b
feat: only show walletconnect button when ses is enabled
andreabadesso Apr 12, 2024
9701573
refactor: using object destructuring in shims
andreabadesso Apr 24, 2024
6471cb6
docs: added comment indicating which shims are needed by wallet-connect
andreabadesso Apr 24, 2024
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
1 change: 1 addition & 0 deletions .babelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lockdown.umd.js
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "airbnb",
"parser": "@babel/eslint-parser",
"ignorePatterns": ["lockdown.umd.js"],
"plugins": [
"react"
],
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ignore-scripts=true
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lockdown.umd.js
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ See the instructions to run on (Windows)[./WINDOWS.md].

## Install

`npm install`
`npm run setup`

### Check SES integrity

The SES lockdown file should match the commited sha256 sum

`sha256sum -c SHA256SUMS`

### Podfile install for iOS

Expand Down
21 changes: 21 additions & 0 deletions SES_AND_LAVAMOAT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# LavaMoat and SES (Secure Ecmascript) maintenance

### Hermes

SES does not yet work with Hermes, so we had to disable it on both platforms https://github.com/facebook/hermes/issues/957

### SES injection

LavaMoat does not yet fully support react-native, there is a compatibility tracker [here](https://github.com/LavaMoat/docs/issues/12). Until then, we're using [SES](https://github.com/endojs/endo/tree/master/packages/ses) directly, injecting it directly into the InitializeCore which is the entrypoint for the react-native's bundle so it hardens our app as soon as possible in the process.

This is done through a patch on the react-native package, using `patch-package`.

We are currently using version `1.0.1` of SES, which is the latest version that works with react-native, it is loaded from the project root, `lockdown.umd.js`.


### Updating SES

As soon as react-native is fully supported by LavaMoat, we will replace the current patch with its official package and install it using npm, but until then, in order to update SES we should do the following steps:

1. Update the `lockdown.umd.js` file to the latest supported SES lockdown file
2. Update the sha256sum of the lockdown library in the SHA256SUMS file
1 change: 1 addition & 0 deletions SHA256SUMS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f6220be2d2bad5babb5b8e50ecca6b7b2bb6751eb6548ca65f44e30e29abb93c lockdown.umd.js
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { setJSExceptionHandler } from 'react-native-exception-handler';
import App from './src/App';
import { name as appName } from './app.json';
import { errorHandler } from './src/errorHandler';

import {
setBackgroundMessageListener,
setNotifeeBackgroundListener,
Expand Down
42 changes: 4 additions & 38 deletions ios/HathorMobile.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@
00E356EB1AD99517003FC87E /* Frameworks */,
00E356EC1AD99517003FC87E /* Resources */,
D6CF71901D46C404F80C1CBF /* [CP] Copy Pods Resources */,
3E7666BE09278503C27A1C65 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand All @@ -192,7 +191,6 @@
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
E7A3890494F2D10544808206 /* [CP] Copy Pods Resources */,
98C5A10E99F2B977B3288BDB /* [CP-User] [RNFB] Core Configuration */,
05236F6C0A91F8F7AC940133 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -275,23 +273,6 @@
shellPath = /bin/sh;
shellScript = "set -e\n\nexport NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n";
};
05236F6C0A91F8F7AC940133 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-HathorMobile/Pods-HathorMobile-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-HathorMobile/Pods-HathorMobile-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-HathorMobile/Pods-HathorMobile-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
092A93BEE8FA44D1787A8BF9 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand All @@ -314,23 +295,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
3E7666BE09278503C27A1C65 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-HathorMobile-HathorMobileTests/Pods-HathorMobile-HathorMobileTests-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-HathorMobile-HathorMobileTests/Pods-HathorMobile-HathorMobileTests-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-HathorMobile-HathorMobileTests/Pods-HathorMobile-HathorMobileTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
98C5A10E99F2B977B3288BDB /* [CP-User] [RNFB] Core Configuration */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -596,7 +560,7 @@
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -639,6 +603,7 @@
OTHER_LDFLAGS = (
"$(inherited)",
" ",
"-Wl -ld_classic ",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
Expand Down Expand Up @@ -678,7 +643,7 @@
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
Expand Down Expand Up @@ -717,6 +682,7 @@
OTHER_LDFLAGS = (
"$(inherited)",
" ",
"-Wl -ld_classic ",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
Expand Down
3 changes: 2 additions & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ target 'HathorMobile' do
:path => config[:reactNativePath],

# Hermes is now enabled by default. Disable by setting this flag to false.
:hermes_enabled => flags[:hermes_enabled],
# We can't use Hermes with SES (https://github.com/facebook/hermes/issues/957)
:hermes_enabled => false,
:fabric_enabled => flags[:fabric_enabled],
# Enables Flipper.
#
Expand Down
Loading