mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-08 21:18:14 -05:00
Inji 360 Support different host for mimoto and esignet (#829)
* feat(INJI-360): Add esignet host as env variable and use in QR login flow. * feat(INJI-360): Fix compile error. * chore(INJI-360): support esignet and mimoto base url in workflows for Android and iOS * chore(INJI-360): add ESIGNET_HOST in Fastfile for android. * chore(INJI-360): remove unnecessary env variables from ios build workflow.
This commit is contained in:
6
.env
6
.env
@@ -1,9 +1,13 @@
|
||||
# after making changes to the env file, ensure to start the bundler (or the project) with a --reset-cache
|
||||
# eg . npm build android:newlogic --reset-cache
|
||||
|
||||
MIMOTO_HOST=https://api.qa-inji.mosip.net
|
||||
#MIMOTO_HOST=http://mock.mimoto.newlogic.dev
|
||||
MIMOTO_HOST=https://api.qa-inji.mosip.net
|
||||
|
||||
ESIGNET_HOST=https://api.qa-inji.mosip.net
|
||||
|
||||
GOOGLE_NEARBY_MESSAGES_API_KEY=
|
||||
|
||||
#Application Theme can be ( orange | purple )
|
||||
APPLICATION_THEME=orange
|
||||
|
||||
|
||||
15
.github/workflows/android-beta-build.yml
vendored
15
.github/workflows/android-beta-build.yml
vendored
@@ -1,7 +1,8 @@
|
||||
name: Android Beta Build
|
||||
|
||||
env:
|
||||
backendServiceDefaultUrl: https://api.sandbox.mosip.net
|
||||
mimotoBackendServiceDefaultUrl: https://api.sandbox.mosip.net
|
||||
esignetBackendServiceDefaultUrl: https://api.sandbox.mosip.net
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -21,8 +22,13 @@ on:
|
||||
required: true
|
||||
default: False
|
||||
type: string
|
||||
backendServiceUrl:
|
||||
description: 'Backend service URL'
|
||||
mimotoBackendServiceUrl:
|
||||
description: 'Mimoto backend service URL'
|
||||
required: true
|
||||
default: 'https://api.sandbox.mosip.net'
|
||||
type: string
|
||||
esignetBackendServiceUrl:
|
||||
description: 'Esignet backend service URL'
|
||||
required: true
|
||||
default: 'https://api.sandbox.mosip.net'
|
||||
type: string
|
||||
@@ -133,7 +139,8 @@ jobs:
|
||||
cd android/scripts
|
||||
./beta-build.sh
|
||||
env:
|
||||
MIMOTO_HOST: ${{ github.event.inputs.backendServiceUrl }}
|
||||
MIMOTO_HOST: ${{ github.event.inputs.mimotoBackendServiceUrl }}
|
||||
ESIGNET_HOST: ${{ github.event.inputs.esignetBackendServiceUrl }}
|
||||
APPLICATION_THEME: ${{ github.event.inputs.theme }}
|
||||
RELEASE_KEYSTORE_ALIAS: androidreleasekey
|
||||
RELEASE_KEYSTORE_PASSWORD: '${{secrets.INJI_ANDROID_RELEASE_STOREPASS}}'
|
||||
|
||||
15
.github/workflows/android-internal-build.yml
vendored
15
.github/workflows/android-internal-build.yml
vendored
@@ -1,13 +1,19 @@
|
||||
name: Android Internal Build
|
||||
|
||||
env:
|
||||
backendServiceDefaultUrl: https://api.sandbox.mosip.net
|
||||
mimotoBackendServiceDefaultUrl: https://api.sandbox.mosip.net
|
||||
esignetBackendServiceDefaultUrl: https://api.sandbox.mosip.net
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
backendServiceUrl:
|
||||
description: 'Backend service URL'
|
||||
mimotoBackendServiceUrl:
|
||||
description: 'Mimoto backend service URL'
|
||||
required: true
|
||||
default: 'https://api.sandbox.mosip.net'
|
||||
type: string
|
||||
esignetBackendServiceUrl:
|
||||
description: 'Esignet backend service URL'
|
||||
required: true
|
||||
default: 'https://api.sandbox.mosip.net'
|
||||
type: string
|
||||
@@ -115,7 +121,8 @@ jobs:
|
||||
cd android/scripts
|
||||
./internal-build.sh
|
||||
env:
|
||||
MIMOTO_HOST: ${{ github.event.inputs.backendServiceUrl }}
|
||||
MIMOTO_HOST: ${{ github.event.inputs.mimotoBackendServiceUrl }}
|
||||
ESIGNET_HOST: ${{ github.event.inputs.esignetBackendServiceUrl }}
|
||||
APPLICATION_THEME: ${{ github.event.inputs.theme }}
|
||||
RELEASE_KEYSTORE_ALIAS: androidreleasekey
|
||||
RELEASE_KEYSTORE_PASSWORD: '${{secrets.INJI_ANDROID_RELEASE_STOREPASS}}'
|
||||
|
||||
11
.github/workflows/ios-build.yml
vendored
11
.github/workflows/ios-build.yml
vendored
@@ -3,8 +3,13 @@ name: Inji iOS build
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
backendServiceUrl:
|
||||
description: 'Backend service URL'
|
||||
mimotoBackendServiceUrl:
|
||||
description: 'Mimoto backend service URL'
|
||||
required: true
|
||||
default: 'https://api.sandbox.mosip.net'
|
||||
type: string
|
||||
esignetBackendServiceUrl:
|
||||
description: 'Esignet backend service URL'
|
||||
required: true
|
||||
default: 'https://api.sandbox.mosip.net'
|
||||
type: string
|
||||
@@ -82,7 +87,5 @@ jobs:
|
||||
SLACK_URL: '${{ secrets.SLACK_WEBHOOK_DEVOPS }}'
|
||||
MATCH_PASSWORD: '${{ secrets.INJI_IOS_MATCH_PASSWORD }}'
|
||||
APPLICATION_THEME: ${{ github.event.inputs.theme }}
|
||||
CREDENTIAL_REGISTRY_EDIT: ${{ github.event.inputs.registry_edit }}
|
||||
MIMOTO_HOST: ${{ github.event.inputs.backendServiceUrl }}
|
||||
TESTFLIGHT_INTERNAL_TESTERS_GROUP: ${{ github.event.inputs.internal-testers }}
|
||||
TESTFLIGHT_BETA_APP_DESCRIPTION: ${{ github.event.inputs.buildDescription }}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
default_platform(:android)
|
||||
|
||||
MIMOTO_HOST = ENV["MIMOTO_HOST"]
|
||||
ESIGNET_HOST = ENV["ESIGNET_HOST"]
|
||||
APPLICATION_THEME = ENV["APPLICATION_THEME"]
|
||||
RELEASE_KEYSTORE_ALIAS = ENV["RELEASE_KEYSTORE_ALIAS"]
|
||||
RELEASE_KEYSTORE_PASSWORD = ENV["RELEASE_KEYSTORE_PASSWORD"]
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
} from 'xstate';
|
||||
import { createModel } from 'xstate/lib/model';
|
||||
import { AppServices } from '../shared/GlobalContext';
|
||||
import { MY_VCS_STORE_KEY } from '../shared/constants';
|
||||
import { MY_VCS_STORE_KEY, ESIGNET_BASE_URL } from '../shared/constants';
|
||||
import { StoreEvents } from './store';
|
||||
import { linkTransactionResponse, VC } from '../types/vc';
|
||||
import { request } from '../shared/request';
|
||||
@@ -349,7 +349,8 @@ export const qrLoginMachine =
|
||||
request: {
|
||||
linkCode: context.linkCode,
|
||||
},
|
||||
}
|
||||
},
|
||||
ESIGNET_BASE_URL
|
||||
);
|
||||
return response.response;
|
||||
},
|
||||
@@ -386,7 +387,8 @@ export const qrLoginMachine =
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
},
|
||||
ESIGNET_BASE_URL
|
||||
);
|
||||
return response.response.linkedTransactionId;
|
||||
},
|
||||
@@ -421,7 +423,8 @@ export const qrLoginMachine =
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
},
|
||||
ESIGNET_BASE_URL
|
||||
);
|
||||
var linkedTrnId = response.response.linkedTransactionId;
|
||||
|
||||
@@ -437,7 +440,8 @@ export const qrLoginMachine =
|
||||
),
|
||||
permittedAuthorizeScopes: context.authorizeScopes,
|
||||
},
|
||||
}
|
||||
},
|
||||
ESIGNET_BASE_URL
|
||||
);
|
||||
console.log(resp.response.linkedTransactionId);
|
||||
},
|
||||
|
||||
@@ -24,8 +24,8 @@ import { request } from '../shared/request';
|
||||
import {
|
||||
changeCrendetialRegistry,
|
||||
SETTINGS_STORE_KEY,
|
||||
MIMOTO_BASE_URL
|
||||
} from '../shared/constants';
|
||||
import { MIMOTO_HOST } from 'react-native-dotenv';
|
||||
|
||||
const model = createModel(
|
||||
{
|
||||
@@ -328,7 +328,7 @@ export const appMachine = model.createMachine(
|
||||
loadCredentialRegistryInConstants: (_context, event) => {
|
||||
changeCrendetialRegistry(
|
||||
!event.response?.credentialRegistry
|
||||
? MIMOTO_HOST
|
||||
? MIMOTO_BASE_URL
|
||||
: event.response?.credentialRegistry
|
||||
);
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ import { AppServices } from '../shared/GlobalContext';
|
||||
import {
|
||||
APP_ID_DICTIONARY,
|
||||
APP_ID_LENGTH,
|
||||
HOST,
|
||||
MIMOTO_BASE_URL,
|
||||
isIOS,
|
||||
SETTINGS_STORE_KEY,
|
||||
} from '../shared/constants';
|
||||
@@ -27,7 +27,7 @@ const model = createModel(
|
||||
plural: 'Cards',
|
||||
} as VCLabel,
|
||||
isBiometricUnlockEnabled: false,
|
||||
credentialRegistry: HOST,
|
||||
credentialRegistry: MIMOTO_BASE_URL,
|
||||
appId: null,
|
||||
hasUserShownWithHardwareKeystoreNotExists: false,
|
||||
credentialRegistryResponse: '' as string,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { assign, ErrorPlatformEvent, EventFrom, send, StateFrom } from 'xstate';
|
||||
import { createModel } from 'xstate/lib/model';
|
||||
import {
|
||||
HOST,
|
||||
MIMOTO_BASE_URL,
|
||||
MY_VCS_STORE_KEY,
|
||||
VC_ITEM_STORE_KEY,
|
||||
VC_ITEM_STORE_KEY_AFTER_DOWNLOAD,
|
||||
@@ -913,7 +913,7 @@ export const vcItemMachine =
|
||||
storeContext: send(
|
||||
(context) => {
|
||||
const { serviceRefs, ...data } = context;
|
||||
data.credentialRegistry = HOST;
|
||||
data.credentialRegistry = MIMOTO_BASE_URL;
|
||||
return StoreEvents.SET(VC_ITEM_STORE_KEY(context), data);
|
||||
},
|
||||
{
|
||||
|
||||
@@ -2,13 +2,15 @@ import { Platform } from 'react-native';
|
||||
import { VC } from '../types/vc';
|
||||
import {
|
||||
MIMOTO_HOST,
|
||||
ESIGNET_HOST,
|
||||
GOOGLE_NEARBY_MESSAGES_API_KEY,
|
||||
} from 'react-native-dotenv';
|
||||
import { Argon2iConfig } from './commonUtil';
|
||||
|
||||
export let HOST = MIMOTO_HOST;
|
||||
export let MIMOTO_BASE_URL = MIMOTO_HOST;
|
||||
export const ESIGNET_BASE_URL = ESIGNET_HOST;
|
||||
|
||||
export const changeCrendetialRegistry = (host) => (HOST = host);
|
||||
export const changeCrendetialRegistry = (host) => (MIMOTO_BASE_URL = host);
|
||||
|
||||
export const MY_VCS_STORE_KEY = 'myVCs';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DecodedCredential, VerifiableCredential } from '../types/vc';
|
||||
import { HOST } from './constants';
|
||||
import { MIMOTO_BASE_URL } from './constants';
|
||||
|
||||
export class BackendResponseError extends Error {
|
||||
constructor(name: string, message: string) {
|
||||
@@ -23,14 +23,15 @@ export class AppId {
|
||||
export async function request(
|
||||
method: 'GET' | 'POST' | 'PATCH',
|
||||
path: `/${string}`,
|
||||
body?: Record<string, unknown>
|
||||
body?: Record<string, unknown>,
|
||||
host= MIMOTO_BASE_URL
|
||||
) {
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
};
|
||||
if (path.includes('residentmobileapp')) headers['X-AppId'] = AppId.getValue();
|
||||
|
||||
const response = await fetch(HOST + path, {
|
||||
const response = await fetch(host + path, {
|
||||
method,
|
||||
headers,
|
||||
body: JSON.stringify(body),
|
||||
@@ -39,7 +40,7 @@ export async function request(
|
||||
const jsonResponse = await response.json();
|
||||
|
||||
if (response.status >= 400) {
|
||||
let backendUrl = HOST + path;
|
||||
let backendUrl = host + path;
|
||||
let errorMessage = jsonResponse.message || jsonResponse.error;
|
||||
console.error(
|
||||
'The backend API ' +
|
||||
@@ -51,7 +52,7 @@ export async function request(
|
||||
}
|
||||
|
||||
if (jsonResponse.errors && jsonResponse.errors.length) {
|
||||
let backendUrl = HOST + path;
|
||||
let backendUrl = host + path;
|
||||
const { errorCode, errorMessage } = jsonResponse.errors.shift();
|
||||
console.error(
|
||||
'The backend API ' +
|
||||
|
||||
5
types/react-native-dotenv/index.d.ts
vendored
5
types/react-native-dotenv/index.d.ts
vendored
@@ -4,6 +4,11 @@ declare module 'react-native-dotenv' {
|
||||
*/
|
||||
export const MIMOTO_HOST: string;
|
||||
|
||||
/**
|
||||
* URL for the Esignet backend server
|
||||
*/
|
||||
export const ESIGNET_HOST: string;
|
||||
|
||||
/**
|
||||
* API key to use Google Nearby Messages API
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user