From 799fb6740242ac9eda2fdcbb08d112ca7872fc1a Mon Sep 17 00:00:00 2001 From: Alaa Elattar Date: Thu, 1 May 2025 11:58:55 +0300 Subject: [PATCH 1/9] update readme docs --- README.md | 80 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 66 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index fd019c539..4fea57537 100644 --- a/README.md +++ b/README.md @@ -8,29 +8,55 @@ It contains an ultra secure 2FA authenticator for authenticating through third p Inside the app, you can manage your Threefold Tokens(TFT). -## Features +## Features ✨ -### Threefold news +### Wallet -Inside the app, there is a "News" section where you can find all the latest Threefold news! +In the ThreeFold Connect app, you can: -### Wallet +- Manage your ThreeFold Tokens (TFT) across multiple wallets +- Import existing wallets using seed phrases or secret keys +- Send and receive tokens on both TFChain and the Stellar network +- Bridge tokens between TFChain, Stellar and Solana networks +- Verify your identity for KYC requirements +- Monitor your balance in real-time +- Manage contacts for easy transfers -In the Threefold Connect app, it is possible to manage your TFT and view your transaction history on the TF chain. +### Farm -### Farmers +In the ThreeFold Connect app, you can: -If you own a Threefold node, you can manage your farm here. +- Create and manage both v3 and v4 farms +- View farm details and configurations +- Track node status (online/offline) in real-time -### Support +### Node Monitoring -If you have Threefold related questions, we provide a support chat where we will answer your questions as soon as possible! +- Receive proactive notifications when nodes go offline +- Smart notification system that categorizes offline nodes: + - Recent outages (0-1 hour): Notifications every 15 minutes + - Short outages (1-4 hours): Notifications every hour + - Medium outages (4-24 hours): Notifications every 4 hours + - Extended outages (1-3 days): Notifications every 12 hours + - Long outages (3-7 days): Notifications once daily + - Very long outages (beyond 7 days): Notifications suppressed +### DAO + +Inside the app, you can vote on proposals and view the results of your votes. + +### Threefold News + +Inside the app, there is a "News" section where you can find all the latest Threefold news! ### Identity When you are using the secure 2FA authentication, some third party apps require certain information (eg. phone number). In this tab you can verify your email, phone number and identity to provide this data to the third party application. This allows you total granular control over which data you choose to share or not share. +### Support + +If you have Threefold related questions, we provide a support chat where we will answer your questions as soon as possible! + ## New codebase In June 2022, a new codebase has been written for this project. It is built on turborepository. This codebase is still in development and not ready yet, you can find this under v2 branch. @@ -68,12 +94,38 @@ uwsgi --http :5000 --gevent 1000 --http-websockets --master --wsgi-file __main__ ## App -Make sure you have at least Flutter 2.8.1 installed. If everything is installed properly, execute the following commands: +### Setup and Run the Mobile App + +1. **Prerequisites** + - Install Flutter 3.27.2 + +2. **Configure the App** + - Navigate to the app directory: `cd app` + - Copy configuration templates: + + ```bash + dart run build_runner build + ``` + +3. **Initialize the Environment** + - Run the initialization script: + + ```bash + ./build.sh --init + ``` + + - Switch to local development environment: -Copy the file in /lib/app_config_local.template into /lib/app_config_local.dart and change the configuration to your local IP's + ```bash + ./build.sh --switch --local + ``` -After that, use the build.sh script to set up the right environment +4. **Run the App** + - Connect your Android/iOS device or start an emulator + - Launch the app: -`./build.sh --init && ./build.sh --switch --local` + ```bash + flutter run + ``` -Connect your phone / start an emulator and everything should work properly. +After completing these steps, the app should be running on your device or emulator with your local backend configuration. \ No newline at end of file From 817bd044ae16d04157e240e9357f37e3fa06becb Mon Sep 17 00:00:00 2001 From: Alaa228 Date: Mon, 5 May 2025 16:48:04 +0300 Subject: [PATCH 2/9] Update README.md Co-authored-by: Zainab Elgohary <40770501+zaelgohary@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4fea57537..ff3c8c5b3 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ In the ThreeFold Connect app, you can: ### DAO -Inside the app, you can vote on proposals and view the results of your votes. +Inside the app, you can vote on TFChain proposals and view the results of your votes. ### Threefold News From e7f015c40fe42c0a390a76216048e01e8f62e5b2 Mon Sep 17 00:00:00 2001 From: Alaa Elattar Date: Mon, 5 May 2025 16:49:11 +0300 Subject: [PATCH 3/9] remove `new codebase` section --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index ff3c8c5b3..93e86880e 100644 --- a/README.md +++ b/README.md @@ -57,10 +57,6 @@ When you are using the secure 2FA authentication, some third party apps require If you have Threefold related questions, we provide a support chat where we will answer your questions as soon as possible! -## New codebase - -In June 2022, a new codebase has been written for this project. It is built on turborepository. This codebase is still in development and not ready yet, you can find this under v2 branch. - ## Local development ### External repositories From 0a93f7105381dbcef6df2dc91c197cbf05d160bb Mon Sep 17 00:00:00 2001 From: Alaa Elattar Date: Tue, 13 May 2025 14:04:42 +0300 Subject: [PATCH 4/9] update readme files --- README.md | 101 ++++------------------------------------ app/README.md | 125 +++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 121 insertions(+), 105 deletions(-) diff --git a/README.md b/README.md index 93e86880e..fa4ee610f 100644 --- a/README.md +++ b/README.md @@ -4,119 +4,34 @@ Threefold Connect is a mobile app that serves as your main gateway to the Threefold Grid and various other Threefold products and services. -It contains an ultra secure 2FA authenticator for authenticating through third party applications. - -Inside the app, you can manage your Threefold Tokens(TFT). - -## Features ✨ - -### Wallet - -In the ThreeFold Connect app, you can: - -- Manage your ThreeFold Tokens (TFT) across multiple wallets -- Import existing wallets using seed phrases or secret keys -- Send and receive tokens on both TFChain and the Stellar network -- Bridge tokens between TFChain, Stellar and Solana networks -- Verify your identity for KYC requirements -- Monitor your balance in real-time -- Manage contacts for easy transfers - -### Farm - -In the ThreeFold Connect app, you can: - -- Create and manage both v3 and v4 farms -- View farm details and configurations -- Track node status (online/offline) in real-time - -### Node Monitoring - -- Receive proactive notifications when nodes go offline -- Smart notification system that categorizes offline nodes: - - Recent outages (0-1 hour): Notifications every 15 minutes - - Short outages (1-4 hours): Notifications every hour - - Medium outages (4-24 hours): Notifications every 4 hours - - Extended outages (1-3 days): Notifications every 12 hours - - Long outages (3-7 days): Notifications once daily - - Very long outages (beyond 7 days): Notifications suppressed - -### DAO - -Inside the app, you can vote on TFChain proposals and view the results of your votes. - -### Threefold News - -Inside the app, there is a "News" section where you can find all the latest Threefold news! - -### Identity - -When you are using the secure 2FA authentication, some third party apps require certain information (eg. phone number). In this tab you can verify your email, phone number and identity to provide this data to the third party application. This allows you total granular control over which data you choose to share or not share. - -### Support - -If you have Threefold related questions, we provide a support chat where we will answer your questions as soon as possible! - ## Local development -### External repositories - -Threefold News: - -Wallet v3: - -Farmer: - -Support: - -## Frontend - -Make sure the correct configuration is inside config.js. After that start the frontend by doing: - -`yarn && yarn serve` - -## Backend - -Go inside virtual environment: - -`source ./venv/bin/activate` - -Start UWSGI backend: - -```bash -uwsgi --http :5000 --gevent 1000 --http-websockets --master --wsgi-file __main__.py --callable app -s 0.0.0.0:3030 -: 1643024584:0;uwsgi --http :5000 --gevent 1000 --http-websockets --master --wsgi-file __main__.py --callable app -s 0.0.0.0:3030 -``` +- check [app/README.md](app/README.md) ## App ### Setup and Run the Mobile App 1. **Prerequisites** - - Install Flutter 3.27.2 -2. **Configure the App** - - Navigate to the app directory: `cd app` - - Copy configuration templates: + - Install Flutter 3.27.2 - ```bash - dart run build_runner build - ``` +2. **Initialize the Environment** -3. **Initialize the Environment** - Run the initialization script: ```bash ./build.sh --init ``` - - Switch to local development environment: + - Switch to your preferred environment (local, testing, staging, or production): ```bash - ./build.sh --switch --local + ./build.sh --switch --staging ``` -4. **Run the App** +3. **Run the App** + - Connect your Android/iOS device or start an emulator - Launch the app: @@ -124,4 +39,4 @@ uwsgi --http :5000 --gevent 1000 --http-websockets --master --wsgi-file __main__ flutter run ``` -After completing these steps, the app should be running on your device or emulator with your local backend configuration. \ No newline at end of file +After completing these steps, the app should be running on your device or emulator with staging backend configuration. diff --git a/app/README.md b/app/README.md index 77d317e52..d3bced132 100644 --- a/app/README.md +++ b/app/README.md @@ -1,6 +1,10 @@ -# threebotlogin +# Threefold Connect -A decentralized login application +Decentralized login application for Threefold grid. + +It contains an ultra secure 2FA authenticator for authenticating through third party applications. + +Inside the app, you can manage your Threefold Tokens(TFT). ## Getting Started @@ -15,11 +19,116 @@ For help getting started with Flutter, view our [online documentation](https://flutter.dev/docs), which offers tutorials, samples, guidance on mobile development, and a full API reference. +## Features ✨ + +### Wallet + +In the ThreeFold Connect app, you can: + +- Manage your ThreeFold Tokens (TFT) across multiple wallets +- Import existing wallets using seed phrases or secret keys +- Send and receive tokens on both TFChain and the Stellar network +- Bridge tokens between TFChain, Stellar and Solana networks +- Verify your identity for KYC requirements +- Monitor your balance in real-time +- Manage contacts for easy transfers + +### Farm + +In the ThreeFold Connect app, you can: + +- Create and manage both v3 and v4 farms +- View farm details and configurations +- Track node status (online/offline) in real-time + +### Node Monitoring + +- Receive proactive notifications when nodes go offline +- Smart notification system that categorizes offline nodes: + - Recent outages (0-1 hour): Notifications every 15 minutes + - Short outages (1-4 hours): Notifications every hour + - Medium outages (4-24 hours): Notifications every 4 hours + - Extended outages (1-3 days): Notifications every 12 hours + - Long outages (3-7 days): Notifications once daily + - Very long outages (beyond 7 days): Notifications suppressed + +### DAO + +Inside the app, you can vote on TFChain proposals and view the results of your votes. + +### Signing + +Inside the app you can sign content with one of your wallets. + +The content is hashed using md5 and signed using the private key of the wallet. + +There are 3 ways to sign: + +- **Sign with text** + - Enter custom text directly in the app + - Select which wallet to sign with + - Optionally specify a destination URL to send the signed data +- **Sign with QR Code** + - Scan a QR code containing content to be signed + - The app decodes the QR code and displays the content for review + - Choose which wallet to use for signing + - The QR code may contain: + - Direct content to sign + - A source URL to fetch content from + - An optional destination URL for the signed data +- **Sign with link** + - Click on a specially formatted link + - The app automatically fetches content from the link + - Review the content before signing + - Select a wallet to sign with + +### Threefold News + +Inside the app, there is a "News" section where you can find all the latest Threefold news! + +### Identity + +When you are using the secure 2FA authentication, some third party apps require certain information (eg. phone number). In this tab you can verify your email, phone number and identity to provide this data to the third party application. This allows you total granular control over which data you choose to share or not share. + +### Support + +If you have Threefold related questions, we provide a support chat where we will answer your questions as soon as possible! + + +## Local development + +### Frontend + +Make sure the correct configuration is inside config.js. After that start the frontend by doing: + +`yarn && yarn serve` + +### Backend + +Go inside virtual environment: + +`source ./venv/bin/activate` + +Start UWSGI backend: + +```bash +uwsgi --http :5000 --gevent 1000 --http-websockets --master --wsgi-file __main__.py --callable app -s 0.0.0.0:3030 +: 1643024584:0;uwsgi --http :5000 --gevent 1000 --http-websockets --master --wsgi-file __main__.py --callable app -s 0.0.0.0:3030 +``` + ## How to run the app on Android 1. Connect your android device (make sure you have a new android version) -2. Choose your environment `testing|staging|production` -3. Run `./build.sh --run --testing|staging|production` +2. Choose your environment `local|testing|staging|production` +3. Run `./build.sh --run --local|testing|staging|production` + +## How to run the app on IOS + +1. Connect your ios device (make sure you have a new ios version) or start an emulator +2. Choose your environment `local|testing|staging|production` +3. Run `./build.sh --run --local|testing|staging|production` +4. Run `pod install` in the `ios` folder +5. Open the app in XCode and run it from there ### Local run @@ -29,11 +138,3 @@ samples, guidance on mobile development, and a full API reference. 4. Run [openkyc](https://github.com/threefoldtech/threefold_connect_openkyc/blob/master/readme.md.old#L83) 5. Copy the file in `app_config_local.template` into `app_config_local.dart` and change the configuration to your local IP's 6. Run the app using `./build.sh --run --local` - -## Known issues - -- - -## TODO - -- signingConfigs From a88f04ea8a9a095773308707ed47a78665cb1e7b Mon Sep 17 00:00:00 2001 From: Alaa Elattar Date: Tue, 13 May 2025 14:15:12 +0300 Subject: [PATCH 5/9] update local development section && provide how to build apk --- README.md | 6 ++++-- app/README.md | 32 ++++++++++++++++++++------------ backend/README.md | 41 +++++++++++++++++++++++++++-------------- 3 files changed, 51 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index fa4ee610f..ae04e95fc 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,14 @@ Threefold Connect is a mobile app that serves as your main gateway to the Threefold Grid and various other Threefold products and services. +## App + ## Local development +- check [frontend/README.md](frontend/README.md) +- check [backend/README.md](backend/README.md) - check [app/README.md](app/README.md) -## App - ### Setup and Run the Mobile App 1. **Prerequisites** diff --git a/app/README.md b/app/README.md index d3bced132..26cbc39e3 100644 --- a/app/README.md +++ b/app/README.md @@ -94,27 +94,35 @@ When you are using the secure 2FA authentication, some third party apps require If you have Threefold related questions, we provide a support chat where we will answer your questions as soon as possible! +## How to build an APK -## Local development +To build an APK for distribution or testing: -### Frontend +1. Initialize the environment if you haven't already: -Make sure the correct configuration is inside config.js. After that start the frontend by doing: + ```bash + ./build.sh --init + ``` -`yarn && yarn serve` +2. Choose your target environment: -### Backend + ```bash + ./build.sh --switch --[local|testing|staging|production] + ``` -Go inside virtual environment: +3. Build the APK: -`source ./venv/bin/activate` + ```bash + # For debug build + ./build.sh --build --[local|testing|staging|production] --debug -Start UWSGI backend: + # For release build + ./build.sh --build --[local|testing|staging|production] --release + ``` -```bash -uwsgi --http :5000 --gevent 1000 --http-websockets --master --wsgi-file __main__.py --callable app -s 0.0.0.0:3030 -: 1643024584:0;uwsgi --http :5000 --gevent 1000 --http-websockets --master --wsgi-file __main__.py --callable app -s 0.0.0.0:3030 -``` +4. The generated APK will be available at: + - Debug APK: `build/app/outputs/flutter-apk/app-debug.apk` + - Release APK: `build/app/outputs/flutter-apk/app-release.apk` ## How to run the app on Android diff --git a/backend/README.md b/backend/README.md index 3d12cb7dc..732f3e1b8 100644 --- a/backend/README.md +++ b/backend/README.md @@ -2,31 +2,44 @@ The (temporary) backend for 3Bot login. +## Run service + +Go inside virtual environment: + +`source ./venv/bin/activate` + +Start UWSGI backend: + +```bash +uwsgi --http :5000 --gevent 1000 --http-websockets --master --wsgi-file __main__.py --callable app -s 0.0.0.0:3030 +: 1643024584:0;uwsgi --http :5000 --gevent 1000 --http-websockets --master --wsgi-file __main__.py --callable app -s 0.0.0.0:3030 +``` + ## Data to save ### User A user is someone that authenticates using 3botlogin. -| Key | Type | Example | Description | -| --- | --- | --- | --- | -| double_name | String | ivan.coene | The name of the user (case insensitive) | -| sid | String | EWFWEGFWGWGWDS | Socket ID | -| email | String | | The email of the user (case insensitive) | -| public_key | string | G1gcbyeTnR2i...H8_3yV3cuF | The public key of the user to verify access | -| device_id | String | abc | The ID of the device where we can send notifications to | +| Key | Type |  Example | Description | +| ----------- | ------- | ------------------------- | ------------------------------------------------------- | +| double_name |  String | ivan.coene | The name of the user (case insensitive) | +| sid |  String | EWFWEGFWGWGWDS | Socket ID | +| email |  String | | The email of the user (case insensitive) | +| public_key |  string | G1gcbyeTnR2i...H8_3yV3cuF | The public key of the user to verify access | +| device_id |  String | abc | The ID of the device where we can send notifications to | ### Login attempt When a user tries to log in, an entry is added -| Key | Type | Example | Description | -| --- | --- | --- | --- | -| double_name | String | ivan.coene | The name of the user (case insensitive) | -| state_hash | String | 1gcbyeTnR2iZSfx6r2qIuvhH8 | The "identifier" of a login-attempt | -| timestamp | Datetime | 2002-12-25 00:00:00-06:39 | The time when this satehash came in | -| scanned | Boolean | false | Flag to keep the QR-scanned state | -| singed_statehash | String | 1gcbyeTnR2iZSfx6r2qIuvhH8 | The signed version of the state hash| +| Key | Type |  Example | Description | +| ---------------- | -------- | -------------------------- | --------------------------------------- | +| double_name |  String | ivan.coene | The name of the user (case insensitive) | +| state_hash | String | 1gcbyeTnR2iZSfx6r2qIuvhH8 |  The "identifier" of a login-attempt | +|  timestamp | Datetime |  2002-12-25 00:00:00-06:39 | The time when this satehash came in | +| scanned | Boolean | false | Flag to keep the QR-scanned state | +| singed_statehash | String | 1gcbyeTnR2iZSfx6r2qIuvhH8 |  The signed version of the state hash | ## Run in dev mode From 1104fbc2e64b9d2c6456b2b0423795c7e2f5d583 Mon Sep 17 00:00:00 2001 From: Alaa Elattar Date: Wed, 14 May 2025 15:56:21 +0300 Subject: [PATCH 6/9] move flutter version inside app dir --- README.md | 30 ------------------------------ app/README.md | 4 ++++ 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index ae04e95fc..a82d48916 100644 --- a/README.md +++ b/README.md @@ -12,33 +12,3 @@ Threefold Connect is a mobile app that serves as your main gateway to the Threef - check [backend/README.md](backend/README.md) - check [app/README.md](app/README.md) -### Setup and Run the Mobile App - -1. **Prerequisites** - - - Install Flutter 3.27.2 - -2. **Initialize the Environment** - - - Run the initialization script: - - ```bash - ./build.sh --init - ``` - - - Switch to your preferred environment (local, testing, staging, or production): - - ```bash - ./build.sh --switch --staging - ``` - -3. **Run the App** - - - Connect your Android/iOS device or start an emulator - - Launch the app: - - ```bash - flutter run - ``` - -After completing these steps, the app should be running on your device or emulator with staging backend configuration. diff --git a/app/README.md b/app/README.md index 26cbc39e3..3cd511fab 100644 --- a/app/README.md +++ b/app/README.md @@ -96,6 +96,10 @@ If you have Threefold related questions, we provide a support chat where we will ## How to build an APK +### Prerequisites + +- Flutter 3.27.2 + To build an APK for distribution or testing: 1. Initialize the environment if you haven't already: From 783969a8a21456a7f5e3fbd7e3b17ffd195420f3 Mon Sep 17 00:00:00 2001 From: Alaa228 Date: Wed, 14 May 2025 16:30:14 +0300 Subject: [PATCH 7/9] Update app/README.md Co-authored-by: AhmedHanafy725 <41957921+AhmedHanafy725@users.noreply.github.com> --- app/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/README.md b/app/README.md index 3cd511fab..172d16b34 100644 --- a/app/README.md +++ b/app/README.md @@ -60,7 +60,7 @@ Inside the app, you can vote on TFChain proposals and view the results of your v Inside the app you can sign content with one of your wallets. -The content is hashed using md5 and signed using the private key of the wallet. +The content is hashed by md5 and signed by sr25519 using one of your wallets. There are 3 ways to sign: From 13e133508044e50100fb250a1a97616f552ba598 Mon Sep 17 00:00:00 2001 From: Alaa Elattar Date: Wed, 14 May 2025 16:33:27 +0300 Subject: [PATCH 8/9] clarify that qrcode scanner works with json --- app/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/README.md b/app/README.md index 172d16b34..a73346e28 100644 --- a/app/README.md +++ b/app/README.md @@ -73,9 +73,9 @@ There are 3 ways to sign: - The app decodes the QR code and displays the content for review - Choose which wallet to use for signing - The QR code may contain: - - Direct content to sign - - A source URL to fetch content from - - An optional destination URL for the signed data + - Direct content to sign (JSON key: `content`) + - A source URL to fetch content from (JSON key: `src`) + - An optional destination URL for the signed data (JSON key: `dest`) - **Sign with link** - Click on a specially formatted link - The app automatically fetches content from the link From 7e3eff5c835c2157f68ec3d64d881dbe38ac8e97 Mon Sep 17 00:00:00 2001 From: Alaa Elattar Date: Sun, 18 May 2025 14:58:15 +0300 Subject: [PATCH 9/9] remove grid2 links from readme of backend --- backend/README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/backend/README.md b/backend/README.md index 732f3e1b8..0ed04e9a0 100644 --- a/backend/README.md +++ b/backend/README.md @@ -59,9 +59,3 @@ sudo apt-get install sqlite3 ## Config file Rename config.ini.example to config.ini and add your API key. - -## From version 2.0.0 the app has switched to the grids explorer - - - -