Tonomy ID is the cross-platform mobile wallet (Android and iOS) for public and private Antelope blockchains. This application allows you to sign transactions on the block chain, share your DID and Verifiable Credentials containing your identity with others in a consensual way and log into web2 and web3 applications. If you lose your phone several mechanisms exist to allow you to recover your account without trusting anyone with custody of your private keys.
Tonomy ID is a React Native application in typescript.
MAKE SURE YOU ARE WORKING FROM THE DEVELOPMENT
BRANCH!!!
- Linux debian distribution (Ubuntu 20.0.4 LTS used)
- Nodejs v20+ suggested installed with nvm
- eas-cli ^12.6.2 installed globally
MAKE SURE YOU ARE WORKING FROM THE DEVELOPMENT
BRANCH!!!
npm install -g [email protected]
yarn
This is to create an expo build so you can down an .apk
or .ipa
file from https://expo.dev which you can use to run the app. You can't Run from the Official Expo App.
-
Create an expo account to build the app. https://expo.dev/signup
-
(for first time build only)
export EXPO_FIRST_TIME=true
-
(for every time after first time only) Change the value of
"projectId"
in./src/config/config.json
to the vale of the"Project ID"
in https://expo.dev -
(for IOS only) Run
yarn run build:ios:create
to create a device profile for your phone. Follow the steps below:If you provide your Apple account credentials we will be able to generate all necessary build credentials and fully validate them.
This is optional, but without Apple account access you will need to provide all the missing values manually and we can only run minimal validation on them.
- Do you want to log in to your Apple account? (Y/n)
- Login to your Apple Developer account to continue
- Enter Apple ID and Password
- Select Team [Stichting Tonomy - Company/Organization (6BLD42QR78)]
- Select Provider [Stichting Tonomy (125811354)]
- How would you like to register your devices?
- Select Website - generate a registration URL to be opened on your devices
After choosing Website, it will generate the URL and QR code. Open the link or scan the QR code and follow the instructions to install the development profile on ios device.
-
Run
yarn run build:ios
(ios) oryarn run build:android
(android) to build the app for your phone -
Return to https://expo.dev/ and click on the Tonomy ID project build and download the App.
-
Install the created app on your phone.
MAKE SURE YOU ARE WORKING FROM THE DEVELOPMENT
BRANCH!!!
You NEED to follow the above Pre-run build
steps above before you can start the app!
DEBUG=tonomy* yarn run start
# install as dependency
npx expo install expo-sqlite
# install as devDependency
npx expo install typescript -- -D
To check or fix compatibility issues
npx expo install typescript --check
npx expo install --fix
To check other expo issues
npx expo-doctor
yarn run updateSdkVersion development
# or
yarn run updateSdkVersion master
# or
yarn run updateSdkVersion testnet
Run production (United Citizen Wallet), testnet (Pangea Testnet) or staging (Tonomy ID Staging) locally without needing to wait for deploy to Play store. This has the advantage of being able to see logs as it runs
Instructions for staging
. Change to testnet
or production
below to change environment:
- Change to
"appName": "Tonomy ID Development"
inconfig.staging.json
- Run
DEBUG=tonomy* EXPO_NODE_ENV=staging yarn run start
- Connect via QR and load the app
To run it with the same building as production:
- Scroll down >> "Open React Native dev men"
- Click "Settings"
- Turn ON "JS Minify"
- Turn OFF "JS Dev Mode"
- Reload
This is now running in production mode connected to the staging/testnet environment.
View debug logs of production apps installed from Google Play App Store, Apple App Store or Testflight
- Install adb on your pc (https://dl.google.com/android/repository/platform-tools-latest-windows.zip)
- Put the location of the folder inside Path env system variable or you can navigate to the folder and call adb.exe directly
- Run
adb logcat *:S ReactNative:V ReactNativeJS:V
or./adb.exe logcat*:S ReactNative:V ReactNativeJS:V
in the command line to catch debug messages of reactNative only. Tryadb logcat -s ReactNative:V ReactNativeJS:V
if that doesn't work. - Enable developer mode on your phone.
- Enable USB debug on your phone.
- Connect your phone to the pc with a usb cable.
- Open the the react native app you want to debug.
TODO
Check if upgrading from one app version to the next will break anything for users
Note: this will NOT work if new expo/react-native packages have been installed in the upgrade
git checkout testnet
yarn
git checkout {{previousVersionCommitId}}
DEBUG=tonomy* EXPO_NODE_ENV=testnet yarn run start
# Then login or create an account, checkout assets and do a few other things.
# Then stop the app
git checkout testnet
DEBUG=tonomy* EXPO_NODE_ENV=testnet yarn run start
# See if you stay logged in, or if any other errors occure
- Delete the app storage from OS settings
- Install previous version using apk from the github action (Build Android APK) install it https://github.com/Tonomy-Foundation/Tonomy-ID/actions/workflows/build-apk.yaml
- Create account or login with the existing account
- Go to the latest version of the app from the github actions
- Test again and if face any error mention it in github issues with the replicate steps
- iOS use testflight versions
- Delete the app storage from OS settings → General → iPhone Storage.
- Install previous version from the testflight
- Create account or login with the existing account
- Go to the testflight update the app to the latest version
- Test again and if face any error mention it in github issues with the replicate steps
https://learn.habilelabs.io/best-folder-structure-for-react-native-project-a46405bdba7
Set the configuration variables in the desired file in ./src/config
config.json
is used by default. Staging config file is choosing based on the value of environment variable EXPO_NODE_ENV
Values for EXPO_NODE_ENV
- EXPO_NODE_ENV=development - uses the default
./src/config/config.json
- EXPO_NODE_ENV=test - same as
development
. this is set whenyarn run test
is run - EXPO_NODE_ENV=local - same as
development
. this resolves the@tonomy/tonomy-id-sdk
package to the local repository at../Tonomy-ID-SDK
which is used for theTonomy-ID-Integration
repository when locally testing all software together. - EXPO_NODE_ENV=staging - uses
./src/config/config.staging.json
- EXPO_NODE_ENV=testnet - uses
./src/config/config.testnet.json
- EXPO_NODE_ENV=production - throws an error. Will be used for the production deploy.
Values for EXPO_PLATFORM
- EXPO_PLATFORM=android - tells
prepare.app.config.ts
to configure app for Android - EXPO_PLATFORM=ios - tells
prepare.app.config.ts
to configure app for iOS
Other environment variables override the values in the config file:
- BLOCKCHAIN_URL
- SSO_WEBSITE_ORIGIN
- VITE_COMMUNICATION_URL
- SENTRY_SECRET_KEY which must be set on any production environments
Linting is done with eslint
. Install the recommended VS Code plugin to see markers in your code.
yarn run lint
See errors.ts. All errors have a registered unique code enum.
Uses debug package. Use export DEBUG="tonomy*"
to see all debug logs.
Release versioning is done automatically with https://github.com/marketplace/actions/automated-version-bump. This will do a major, minor or patch release based on words in the commits. See Workflow for details.