diff --git a/.gitbook/assets/inji_android_github_actions.png b/.gitbook/assets/inji_android_github_actions.png deleted file mode 100644 index d16be69..0000000 Binary files a/.gitbook/assets/inji_android_github_actions.png and /dev/null differ diff --git a/.gitbook/assets/inji_github_actions_android_ios.jpg b/.gitbook/assets/inji_github_actions_android_ios.jpg new file mode 100644 index 0000000..56866f8 Binary files /dev/null and b/.gitbook/assets/inji_github_actions_android_ios.jpg differ diff --git a/.gitbook/assets/inji_ios_github_actions.png b/.gitbook/assets/inji_ios_github_actions.png deleted file mode 100644 index b0046cc..0000000 Binary files a/.gitbook/assets/inji_ios_github_actions.png and /dev/null differ diff --git a/inji-wallet/inji-mobile/build-and-deployment/README.md b/inji-wallet/inji-mobile/build-and-deployment/README.md index 6efd1e8..af7967a 100644 --- a/inji-wallet/inji-mobile/build-and-deployment/README.md +++ b/inji-wallet/inji-mobile/build-and-deployment/README.md @@ -6,16 +6,19 @@ icon: list-tree ### Repositories -{% embed url="https://github.com/mosip/inji-wallet" %} +{% embed url="https://github.com/inji/inji-wallet" %} ### Prerequisite -* [Gradle](https://gradle.org/install/) +* [Node](https://nodejs.org/en/download) v18.17.1 and npm 8.19.3 +* [Gradle](https://gradle.org/install/) 8.6 * [Java 17](https://www.oracle.com/ph/java/technologies/downloads/#java17) -* [Expo](https://docs.expo.dev/home/get-started/installation/) -* [Android SDK](https://developer.android.com/) -* [Node](https://nodejs.org/en/download) -* [XCode](https://developer.apple.com/xcode/) for iOS development +* [Expo](https://docs.expo.dev/get-started/installation) 51.0.0 (React Native 0.74.5) +* [Android Studio](https://developer.android.com/studio) (latest stable release) +* [Android SDK](https://developer.android.com/) with Build-Tools 35.0.0, compileSdk 35, minSdk 24, targetSdk 35, NDK 21.4.7075529, Kotlin 1.9.22 +* [XCode](https://developer.apple.com/xcode/) 15 or higher, for iOS development (Minimum Deployment Target: 14.0) +* [CocoaPods](https://cocoapods.org/) > 1.12 and Ruby >= 2.6.10, for iOS development +* [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/), for running the Mimoto backend locally To perform **offline sharing using BLE**, we recommend below: @@ -30,14 +33,14 @@ The below sections describe the steps for building the android application in Ma #### Step 1: -Configure Node & npm (recommended to use v16.19.0) +Configure Node & npm (recommended to use v18.17.1) ``` brew install nvm -nvm install 16.19.0 +nvm install 18.17.1 -nvm use 16.19.0 +nvm use 18.17.1 ``` #### Step 2: @@ -55,14 +58,14 @@ Configure Gradle & Java ``` curl -s "https://get.sdkman.io" | bash -sdk install gradle 7.5.1 +sdk install gradle 8.6 sdk install java 17.0.13-amzn ``` #### Step 4: -Configure Expo, refer [here](https://docs.expo.dev/get-started/installation/). +Configure Expo, refer [here](https://docs.expo.dev/get-started/installation). #### Step 5: @@ -143,7 +146,7 @@ curl -s "" | bash * Use the command below in Git terminal. ``` -sdk install gradle 7.5.1 +sdk install gradle 8.6 ``` * To check the installed gradle version. @@ -161,11 +164,7 @@ Restart system #### Step 5: -* Install expo - -``` -npm install --global expo-cli -``` +* No global install needed — Expo is already a project dependency and is used via `npx expo` (the legacy global `expo-cli` is deprecated). #### Step 6: @@ -192,8 +191,8 @@ wget -qO- | ba update the nvm version ``` -nvm install 16.19.0 -nvm use 16.19.0 +nvm install 18.17.1 +nvm use 18.17.1 ``` #### Step 9: @@ -232,13 +231,13 @@ sdk.dir = * Inji application currently supports two themes: **gradient** and **purple**. * The default theme of the app is gradient. -* To change the theme of the application, go to `.env` file and change the value of `APPLICATION_THEME` to `purple` or `orange` to apply gradient theme +* To change the theme of the application, go to `.env` file and change the value of `APPLICATION_THEME` to `gradient` or `purple` #### Step 4: -* Update mimoto url as https://api.collab.mosip.net [here](https://github.com/mosip/inji/blob/main/.env#L5) -* Update esignet host as https://esignet.collab.mosip.net [here](https://github.com/mosip/inji/blob/main/.env#L7) -* To deploy mimoto in local refer [here](https://docs.mosip.io/inji/inji-mobile-wallet/build-and-deployment/local-setup#how-to-run-this-setup) +* Update mimoto url as `https://api.collab.mosip.net` for `MIMOTO_HOST` [here](https://github.com/inji/inji-wallet/blob/main/.env) +* Update esignet host as `https://esignet.collab.mosip.net` for `ESIGNET_HOST` [here](https://github.com/inji/inji-wallet/blob/main/.env) +* To deploy mimoto in local refer [here](https://docs.inji.io/inji-wallet/inji-mobile/build-and-deployment/local-setup#how-to-run-this-setup) #### Step 5: @@ -247,11 +246,13 @@ sdk.dir = #### Step 6: -**Build and run the application on the device:** +**Build and run the application on a connected device or emulator:** -* Run `npm run android:mosip` to build and install the application on the device. +* Run `npm run android:mosip` to build and install the application on a connected device or a running emulator. * Run `npm run android:mosip --reset-cache` to build and install the application if any change is made in the .env file. +> Note: Inji Wallet uses the Android hardware-backed keystore for secure key storage where available. Emulators (and some devices) don't support hardware-backed keystore — the app still runs and falls back to a software-backed keystore, but shows a one-time in-app warning about it. Use a physical device if you need to validate the hardware-backed keystore path. + ### 3. Troubleshooting If you encounter the below issue on Windows, @@ -267,7 +268,7 @@ If you encounter the below issue on Windows, > Could not read script 'C:\"PATH"\inji\node_modules\expo\scripts\android\autolinking_implementation.gradle' as it does not exist. ``` -* Run `npm i expo-modules-autolinking@~1.1.0` and rebuild the app +* Run `npm i expo-modules-autolinking@~1.11.0` and rebuild the app * Path for debug apk in Inji directory `android/app/build/outputs/apk/mosip/debug` ### 4. Setting Up Google API Services and Client ID for Data backup & Restore @@ -338,7 +339,7 @@ The Internal testing version of the build can be uploaded to `PlayConsole` for t A Google play console developer account is a must to publish builds in PlayConsole. -1. Set the backend URL and choose a theme (orange | purple) inside the `.env` file. +1. Set the backend URL and choose a theme (gradient | purple) inside the `.env` file. 2. Build the Apk or App bundle. 3. Login to PlayConsole and create a new release inside Internal testers. 4. Upload the Apk or App bundle to PlayConsole. @@ -367,9 +368,9 @@ A Google play console developer account is a must to publish builds in PlayConso ![img.png](../../../.gitbook/assets/internal_testers_select_android.png) -2. To deploy the Android build to PlayConsole, select `Android Custom Build` workflow from github actions. +2. To deploy the Android build to PlayConsole, select the `Internal Build [Android & IOS]` workflow from github actions, and select `Android` in the **Build for** option. -![img.png](../../../.gitbook/assets/inji_android_github_actions.png) +![img.png](../../../.gitbook/assets/inji_github_actions_android_ios.jpg) 3. Choose the branch, backend url, theme and describe about build details. 4. Click the `Run` workflow button. @@ -388,15 +389,15 @@ The below section describes the steps build the iOS application. #### Step 1: -Follow the [Steps](./#installation-and-keystore-generation-on-mac) to configure Node & npm, Expo and generate debug keystore +Follow the [Steps](./#1a-installation-and-keystore-generation-on-mac) to configure Node & npm, Expo and generate debug keystore #### Step 2: -Configure XCode, refer [here](https://developer.apple.com/xcode/). +Configure XCode, refer [here](https://developer.apple.com/xcode/) #### Step 3: -Enable iCloud and create Containers, refer https://developer.apple.com/help/account/manage-identifiers/create-an-icloud-container/ +Enable iCloud and create Containers, refer [here](https://developer.apple.com/help/account/manage-identifiers/create-an-icloud-container/) ### 2. Build process @@ -425,6 +426,8 @@ Command to run real device npm run ios -- --device ``` +**Note:** When the application is built via an IDE (e.g. XCode), Metro needs to be started manually — the Metro hook is removed when building via XCode. Building via npm commands (`npm run android:mosip` or `npm run ios`) starts Metro automatically. + ### 3. Build for TestFlight The beta version of the build can be uploaded to `TestFlight` for testing. TestFlight allows the creation of internal and external testing teams who will be notified once a new build is published. @@ -435,7 +438,7 @@ The beta version of the build can be uploaded to `TestFlight` for testing. TestF An Apple developer account is a must to publish builds in TestFlight. -1. Set the backend URL and choose a theme (orange | purple) inside the `.env` file. +1. Set the backend URL and choose a theme (gradient | purple) inside the `.env` file. 2. Archive the build using `xcode`. 3. Upload the archive to Testflight. @@ -463,9 +466,9 @@ An Apple developer account must be configured to Inji app to publish builds via ![img.png](../../../.gitbook/assets/testflight_testers_group.png) -1. To deploy the iOS build to testflight, select `Inji iOS build` workflow from github actions. +1. To deploy the iOS build to testflight, select the `Internal Build [Android & IOS]` workflow from github actions, and select `IOS` in the **Build for** option. -![img.png](../../../.gitbook/assets/inji_ios_github_actions.png) +![img.png](../../../.gitbook/assets/inji_github_actions_android_ios.jpg) 2. Choose the branch, backend URL, theme, testers group from TestFlight to get the build and describe about build details. 3. Click the `Run` workflow button. diff --git a/inji-wallet/inji-mobile/build-and-deployment/local-setup.md b/inji-wallet/inji-mobile/build-and-deployment/local-setup.md index 257dc50..a0cc737 100644 --- a/inji-wallet/inji-mobile/build-and-deployment/local-setup.md +++ b/inji-wallet/inji-mobile/build-and-deployment/local-setup.md @@ -4,43 +4,86 @@ icon: list-tree # Local Setup -Mimoto can be deployed in local using Docker Compose setup. This service streamlines deployment and management, offering a seamless and efficient way to handle backend operations. - -Below sections details the docker-compose setup to run mimoto which act as BFF for Inji Wallet and backend for Inji web. This docker compose setup is intended only for local use and not for production deployment. +This is the docker-compose setup to run mimoto which act as BFF for Inji Wallet and backend for Inji web. This docker compose setup is intended only for local use and not for production deployment. ## What is in the docker-compose folder? -* The certs folder holds the p12 file which is created as part of OIDC client onboarding. -* "config" folder holds the mimoto system properties file, issuer configuration and credential template. -* "loader\_path" this has mimoto mount volume from where all the runtime dependencies are loaded to classpath. -* "docker-compose.yml" file contains the mimoto setup. +* **`certs`** folder holds the p12 file which is created as part of OIDC client onboarding. +* **`config`** folder holds the mimoto system properties file, issuer configuration and credential template. +* **`docker-compose.yml`** file with the mimoto setup. ## How to run this setup? -1. Create loader\_path folder under the docker-compose directory and download the kernel auth adapter(kernel-auth-adapter-1.2.0.1.jar) from [here](https://repo1.maven.org/maven2/io/mosip/kernel/kernel-auth-adapter/1.2.0.1/). -2. Copy the downloaded jar under loader\_path directory and rename it to kernel-auth-adapter.jar -3. Add ID providers as issuers in mimoto-issuers-config.json -4. Start esignet services and update esignet host references in mimoto-default.properties and mimoto-issuers-config.json -5. Create certs folder in the same directory and create OIDC client. Add key in oidckeystore.p12 and copy this file under certs folder. Refer [here](https://docs.mosip.io/inji/inji-mobile-wallet/customization-overview/credential_providers) to create client -6. Update client\_id and client\_alias in mimoto-issuers-config.json file. -7. Update p12 file password mosip.oidc.p12.password in mimoto-default.properties file. -8. To start the docker-compose file, run the command docker-compose up +1. **Prepare the environment:** + * The `docker-compose` folder's `config` directory holds the configuration files Mimoto needs to act as BFF for Inji Wallet. + * **Create a `certs` folder** in the `docker-compose` directory and add the OIDC client certificate (see below). + * **Update the configuration files:** + * `mimoto-issuers-config.json` — add identity providers as issuers. See [Credential Providers](../technical-overview/customization-overview/credential_providers.md) for how to structure each entry. + * `mimoto-trusted-verifiers.json` — add the verifiers' clientId, redirect and response URIs, for Verifiable Credential Online Sharing. + * Update the **Esignet host** reference in `mimoto-default.properties` (or `application-local.properties` if running Mimoto via IDE). + * Set the `oidc_p12_password` environment variable in `docker-compose.yml` to match the password used for `oidckeystore.p12`. + * **Create an OIDC client** and generate `oidckeystore.p12`, placed inside the `certs` folder. Follow [Credential Providers](../technical-overview/customization-overview/credential_providers.md) for this process. + * **Update `mimoto-issuers-config.json`** with the `client_id` and `client_alias` from your OIDC onboarding. + +2. **If you're only running Inji Wallet (mobile), do this before starting the services:** remove the `datashare` and `minio` services from `docker-compose.yml` (and the `datashare` dependency from `mimoto-service`'s `depends_on`), and set `qr_code_type` to `"EmbeddedVC"` for all issuers in `mimoto-issuers-config.json`. This also means you don't need to pull the datashare/minio images at all. + +3. **\[Optional] Configure Google OAuth Client Credentials** + * Only needed for Mimoto's own "Login with Google" feature — not required to run Inji Wallet locally. `docker-compose.yml` ships with working placeholder values, so this can be skipped for a wallet-only setup. + * If you do need it, refer to [How to create Google Client Credentials](#how-to-create-google-client-credentials) below, then add the generated credentials to `docker-compose.yml`: + ```yaml + environment: + - GOOGLE_OAUTH_CLIENT_ID= + - GOOGLE_OAUTH_CLIENT_SECRET= + ``` + +4. **Start the services:** + ```bash + docker-compose up + ``` + Use the `-d` flag to run in detached (background) mode. + +5. **Stop the services:** + ```bash + docker-compose down + ``` + To stop and remove a single service: `docker-compose stop ` then `docker-compose rm `. + +6. **Removing the Docker Volume:** if you update `oidckeystore.p12`, Mimoto may fail to start — the new file won't contain the keys already stored in the database's key alias table, and their absence breaks encryption/decryption. Fix it by clearing the stale data: + ```bash + docker volume rm docker-compose_postgres-data + ``` + +7. **Access APIs as:** + * `http://localhost:8099/v1/mimoto/allProperties` + * `http://localhost:8099/v1/mimoto/issuers` + * `http://localhost:8099/v1/mimoto/issuers/{issuer-id}` + * `http://localhost:8099/v1/mimoto/issuers/{issuer-id}/well-known-proxy` -## APIs +## How to create Google Client Credentials -The mimoto APIs can be accessed as below: +To enable Google OAuth2.0 authentication, follow these steps: -http://localhost:8099/residentmobileapp/allProperties +1. **Go to the Google Cloud Console**: Visit [Google Cloud Console](https://console.cloud.google.com/). +2. **Create a New Project**: If you don't already have a project, create one from the project dropdown. +3. **Enable the OAuth Consent Screen**: "APIs & Services" > "OAuth consent screen". Select "External" and configure the required fields. Save. +4. **Create OAuth 2.0 Credentials**: "APIs & Services" > "Credentials" > "Create Credentials" > "OAuth 2.0 Client IDs" > "Web application". +5. **Authorized JavaScript Origins**: `http://localhost:8099` +6. **Authorized Redirect URIs**: `http://localhost:8099/v1/mimoto/oauth2/callback/google` +7. **Save and Retrieve Client Credentials**: you'll receive a `Client ID` and `Client Secret` — add them to `docker-compose.yml` as shown in step 3 above. -http://localhost:8099/residentmobileapp/issuers +## Inji Mobile Wallet Configuration -http://localhost:8099/residentmobileapp/issuers/Sunbird +Set the eSignet host Mimoto should use — update `mosip.esignet.host` in `mimoto-default.properties` (or `application-local.properties` if running Mimoto via IDE) to point to the eSignet instance for your target environment: -http://localhost:8099/residentmobileapp/issuers/Sunbird/credentialTypes +```properties +mosip.esignet.host= (E.g. https://esignet.env.mosip.net) +``` -## Note: +Then point your local Inji Wallet build at this Mimoto instance — set `MIMOTO_HOST` to your ngrok URL (not `localhost`) in the wallet app's `.env` file (see [Setup → Command to build the application](./README.md#2-command-to-build-the-application)). -* For local env use ngrok. -* Replace http://localhost:8099 by [ngrok](https://ngrok.com/docs/getting-started/) public domain at following places - * token\_endpoint in mimoto-issuers-config.json - * mosipbox.public.url, mosip.api.public.url in mimoto-default.properties +Note: +- For local env use [ngrok](https://ngrok.com/docs/getting-started/). +- Replace `http://localhost:8099` by the ngrok public domain at the following places: + - `token_endpoint` in `mimoto-issuers-config.json` + - `mosipbox.public.url`, `mosip.api.public.url` in `mimoto-default.properties` +- After editing `mimoto-issuers-config.json`, restart `nginx` then `mimoto-service` for the change to take effect