diff --git a/.github/workflows/ios-build.yml b/.github/workflows/ios-build.yml index a5a2f2e89d..2e71c7d28f 100644 --- a/.github/workflows/ios-build.yml +++ b/.github/workflows/ios-build.yml @@ -88,6 +88,9 @@ 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.mimotoBackendServiceUrl }} + ESIGNET_HOST: ${{ github.event.inputs.esignetBackendServiceUrl }} TESTFLIGHT_INTERNAL_TESTERS_GROUP: ${{ github.event.inputs.internal-testers }} TESTFLIGHT_BETA_APP_DESCRIPTION: ${{ github.event.inputs.buildDescription }} diff --git a/.talismanrc b/.talismanrc index 963221e53a..2be7c3924b 100644 --- a/.talismanrc +++ b/.talismanrc @@ -1,6 +1,4 @@ fileignoreconfig: -- filename: package.json - checksum: 30e3a548809705ba38385a1c286b312629ac5dd7dea0d6e26ffb9daf8def312d - filename: package-lock.json checksum: a4c1fe2521067e1a279610f079446c600e8b7d5cf1553934dc419c3c476b4844 - filename: components/PasscodeVerify.tsx @@ -52,4 +50,11 @@ fileignoreconfig: - filename: machines/store.ts checksum: 0695d833df9ec1e1f6ae2bd81631630bb1039dec387718acb153bcb843c952cd - filename: shared/cryptoutil/cryptoUtil.ts - checksum: b785ff3f01ab9530119072c4d38195048bfeee6155c54ea7dd031559acb722f3 \ No newline at end of file + checksum: b785ff3f01ab9530119072c4d38195048bfeee6155c54ea7dd031559acb722f3 +- filename: package.json + checksum: 1a9d02d94424c1266503d58038cae2318ab71261ab50cf930c5f98e07c0f3ccd +- filename: machines/store.typegen.ts + checksum: 6d22bc5c77398316b943c512c208ce0846a9fff674c1ccac79e07f21962acd5f +- filename: machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.typegen.ts + checksum: 10889302ca05646a283386be1bbe7a5fb510c02bb62a308ee45f3c2a872ae64e + version: "" diff --git a/components/VC/MosipVCItem/MosipVCItem.tsx b/components/VC/MosipVCItem/MosipVCItem.tsx index e913abb64a..d6dcf72d07 100644 --- a/components/VC/MosipVCItem/MosipVCItem.tsx +++ b/components/VC/MosipVCItem/MosipVCItem.tsx @@ -73,7 +73,6 @@ export const MosipVCItem: React.FC< vcMetadata={props.vcMetadata} verifiableCredential={verifiableCredential} emptyWalletBindingId={emptyWalletBindingId} - onPress={() => props.onPress(service)} showOnlyBindedVc={props.showOnlyBindedVc} /> diff --git a/components/VC/MosipVCItem/MosipVCItemActivationStatus.tsx b/components/VC/MosipVCItem/MosipVCItemActivationStatus.tsx index 9162743f5f..42c633a666 100644 --- a/components/VC/MosipVCItem/MosipVCItemActivationStatus.tsx +++ b/components/VC/MosipVCItem/MosipVCItemActivationStatus.tsx @@ -2,8 +2,6 @@ import React from 'react'; import {useTranslation} from 'react-i18next'; import {Dimensions} from 'react-native'; import {Icon} from 'react-native-elements'; -import {ActorRefFrom} from 'xstate'; -import {ExistingMosipVCItemMachine} from '../../../machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine'; import {VerifiableCredential} from '../../../types/VC/ExistingMosipVC/vc'; import {Row, Text} from '../../ui'; import {Theme} from '../../ui/styleUtils'; @@ -108,13 +106,11 @@ export const MosipVCItemActivationStatus: React.FC< {props.emptyWalletBindingId ? ( ) : ( )} @@ -123,18 +119,15 @@ export const MosipVCItemActivationStatus: React.FC< interface ExistingMosipVCItemActivationStatusProps { showOnlyBindedVc: boolean; - onPress: (vcRef?: ActorRefFrom) => void; verifiableCredential: VerifiableCredential; emptyWalletBindingId: boolean; } interface WalletVerifiedDetailsProps { showOnlyBindedVc: boolean; - onPress: (vcRef?: ActorRefFrom) => void; verifiableCredential: VerifiableCredential; } interface WalletUnVerifiedDetailsProps { - onPress: (vcRef?: ActorRefFrom) => void; verifiableCredential: VerifiableCredential; } diff --git a/components/VC/MosipVCItem/MosipVCItemContent.tsx b/components/VC/MosipVCItem/MosipVCItemContent.tsx index 090aeb61c8..3039839761 100644 --- a/components/VC/MosipVCItem/MosipVCItemContent.tsx +++ b/components/VC/MosipVCItem/MosipVCItemContent.tsx @@ -7,7 +7,7 @@ import VerifiedIcon from '../../VerifiedIcon'; import {Column, Row, Text} from '../../ui'; import {Theme} from '../../ui/styleUtils'; import {CheckBox, Icon} from 'react-native-elements'; -import testIDProps from '../../../shared/commonUtil'; +import testIDProps, {getMaskedText} from '../../../shared/commonUtil'; import {logoType} from '../../../machines/issuersMachine'; const getDetails = (arg1, arg2, verifiableCredential) => { @@ -84,10 +84,6 @@ const getDetails = (arg1, arg2, verifiableCredential) => { } }; -function getIdNumber(id: string) { - return '*'.repeat(id.length - 4) + id.slice(-4); -} - const getIssuerLogo = (isOpenId4VCI: boolean, issuerLogo: logoType) => { if (isOpenId4VCI) { return ( @@ -243,7 +239,7 @@ export const MosipVCItemContent: React.FC< weight="semibold" size="extraSmall" color={Theme.Colors.statusLabel}> - {getIdNumber(uin)} + {getMaskedText(uin)} ) : null} @@ -262,7 +258,7 @@ export const MosipVCItemContent: React.FC< weight="semibold" size="extraSmall" color={Theme.Colors.Details}> - {getIdNumber(vid)} + {getMaskedText(vid)} ) : null} diff --git a/components/ui/themes/DefaultTheme.ts b/components/ui/themes/DefaultTheme.ts index 1cfffe2420..ae38ddafeb 100644 --- a/components/ui/themes/DefaultTheme.ts +++ b/components/ui/themes/DefaultTheme.ts @@ -1,5 +1,5 @@ /* eslint-disable sonarjs/no-duplicate-string */ -import {Dimensions, Platform, StyleSheet, ViewStyle} from 'react-native'; +import {Dimensions, StyleSheet, ViewStyle} from 'react-native'; import {Spacing} from '../styleUtils'; import {isIOS} from '../../../shared/constants'; @@ -524,12 +524,11 @@ export const DefaultTheme = { borderBottomColor: Colors.platinumGrey, borderBottomWidth: 1.3, }, - downloadFabIcon: { + downloadFabIconContainer: { height: 70, width: 70, borderRadius: 200, padding: 10, - backgroundColor: Colors.Orange, shadowColor: '#000', shadowOpacity: 0.4, elevation: 5, @@ -537,6 +536,21 @@ export const DefaultTheme = { bottom: Dimensions.get('window').width * 0.1, right: Dimensions.get('window').width * 0.1, }, + downloadFabIconNormal: { + borderRadius: 200, + height: 70, + width: 70, + justifyContent: 'center', + position: 'absolute', + }, + downloadFabIconPressed: { + borderRadius: 200, + height: 70, + width: 70, + backgroundColor: Colors.Orange, + justifyContent: 'center', + position: 'absolute', + }, boxShadow: generateBoxShadowStyle(), }), QrCodeStyles: StyleSheet.create({ diff --git a/components/ui/themes/PurpleTheme.ts b/components/ui/themes/PurpleTheme.ts index 5a403706e1..a7bd7ed151 100644 --- a/components/ui/themes/PurpleTheme.ts +++ b/components/ui/themes/PurpleTheme.ts @@ -1,5 +1,5 @@ /* eslint-disable sonarjs/no-duplicate-string */ -import {Dimensions, Platform, StyleSheet, ViewStyle} from 'react-native'; +import {Dimensions, StyleSheet, ViewStyle} from 'react-native'; import {Spacing} from '../styleUtils'; import {isIOS} from '../../../shared/constants'; @@ -526,12 +526,11 @@ export const PurpleTheme = { borderBottomColor: Colors.platinumGrey, borderBottomWidth: 1.3, }, - downloadFabIcon: { + downloadFabIconContainer: { height: 70, width: 70, borderRadius: 200, padding: 10, - backgroundColor: Colors.Purple, shadowColor: '#000', shadowOpacity: 0.4, elevation: 5, @@ -539,6 +538,21 @@ export const PurpleTheme = { bottom: Dimensions.get('window').width * 0.1, right: Dimensions.get('window').width * 0.1, }, + downloadFabIconNormal: { + borderRadius: 200, + height: 70, + width: 70, + justifyContent: 'center', + position: 'absolute', + }, + downloadFabIconPressed: { + borderRadius: 200, + height: 70, + width: 70, + backgroundColor: Colors.Purple, + justifyContent: 'center', + position: 'absolute', + }, boxShadow: generateBoxShadowStyle(), }), QrCodeStyles: StyleSheet.create({ diff --git a/ios/Inji.xcodeproj/project.pbxproj b/ios/Inji.xcodeproj/project.pbxproj index d9bcc4cd82..f67e4d5971 100644 --- a/ios/Inji.xcodeproj/project.pbxproj +++ b/ios/Inji.xcodeproj/project.pbxproj @@ -557,4 +557,4 @@ /* End XCConfigurationList section */ }; rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; -} \ No newline at end of file +} diff --git a/machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.ts b/machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.ts index f90495052a..dc0eb6e048 100644 --- a/machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.ts +++ b/machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.ts @@ -23,6 +23,7 @@ import {ActivityLogEvents} from '../../../machines/activityLog'; import {request} from '../../../shared/request'; import SecureKeystore from 'react-native-secure-keystore'; import {VerifiableCredential} from './vc'; +import {API_URLS} from '../../../shared/api'; const model = createModel( { @@ -751,8 +752,8 @@ export const EsignetMosipVCItemMachine = model.createMachine( }, addWalletBindnigId: async context => { const response = await request( - 'POST', - '/residentmobileapp/wallet-binding', + API_URLS.walletBinding.method, + API_URLS.walletBinding.buildURL(), { requestTime: String(new Date().toISOString()), request: { @@ -800,8 +801,8 @@ export const EsignetMosipVCItemMachine = model.createMachine( }, requestBindingOtp: async context => { const response = await request( - 'POST', - '/residentmobileapp/binding-otp', + API_URLS.bindingOtp.method, + API_URLS.bindingOtp.buildURL(), { requestTime: String(new Date().toISOString()), request: { diff --git a/machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.typegen.ts b/machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.typegen.ts index e0bbf66caa..dd13500fca 100644 --- a/machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.typegen.ts +++ b/machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.typegen.ts @@ -245,251 +245,3 @@ export interface Typegen0 { }; tags: never; } - -// This file was automatically generated. Edits will be overwritten - -export interface Typegen0 { - '@@xstate/typegen': true; - internalEvents: { - 'done.invoke.vc-item-openid4vci.addKeyPair:invocation[0]': { - type: 'done.invoke.vc-item-openid4vci.addKeyPair:invocation[0]'; - data: unknown; - __tip: 'See the XState TS docs to learn how to strongly type this.'; - }; - 'done.invoke.vc-item-openid4vci.addingWalletBindingId:invocation[0]': { - type: 'done.invoke.vc-item-openid4vci.addingWalletBindingId:invocation[0]'; - data: unknown; - __tip: 'See the XState TS docs to learn how to strongly type this.'; - }; - 'done.invoke.vc-item-openid4vci.kebabPopUp.addKeyPair:invocation[0]': { - type: 'done.invoke.vc-item-openid4vci.kebabPopUp.addKeyPair:invocation[0]'; - data: unknown; - __tip: 'See the XState TS docs to learn how to strongly type this.'; - }; - 'done.invoke.vc-item-openid4vci.kebabPopUp.addingWalletBindingId:invocation[0]': { - type: 'done.invoke.vc-item-openid4vci.kebabPopUp.addingWalletBindingId:invocation[0]'; - data: unknown; - __tip: 'See the XState TS docs to learn how to strongly type this.'; - }; - 'done.invoke.vc-item-openid4vci.kebabPopUp.requestingBindingOtp:invocation[0]': { - type: 'done.invoke.vc-item-openid4vci.kebabPopUp.requestingBindingOtp:invocation[0]'; - data: unknown; - __tip: 'See the XState TS docs to learn how to strongly type this.'; - }; - 'done.invoke.vc-item-openid4vci.kebabPopUp.updatingPrivateKey:invocation[0]': { - type: 'done.invoke.vc-item-openid4vci.kebabPopUp.updatingPrivateKey:invocation[0]'; - data: unknown; - __tip: 'See the XState TS docs to learn how to strongly type this.'; - }; - 'done.invoke.vc-item-openid4vci.requestingBindingOtp:invocation[0]': { - type: 'done.invoke.vc-item-openid4vci.requestingBindingOtp:invocation[0]'; - data: unknown; - __tip: 'See the XState TS docs to learn how to strongly type this.'; - }; - 'done.invoke.vc-item-openid4vci.updatingPrivateKey:invocation[0]': { - type: 'done.invoke.vc-item-openid4vci.updatingPrivateKey:invocation[0]'; - data: unknown; - __tip: 'See the XState TS docs to learn how to strongly type this.'; - }; - 'error.platform.vc-item-openid4vci.addKeyPair:invocation[0]': { - type: 'error.platform.vc-item-openid4vci.addKeyPair:invocation[0]'; - data: unknown; - }; - 'error.platform.vc-item-openid4vci.addingWalletBindingId:invocation[0]': { - type: 'error.platform.vc-item-openid4vci.addingWalletBindingId:invocation[0]'; - data: unknown; - }; - 'error.platform.vc-item-openid4vci.kebabPopUp.addKeyPair:invocation[0]': { - type: 'error.platform.vc-item-openid4vci.kebabPopUp.addKeyPair:invocation[0]'; - data: unknown; - }; - 'error.platform.vc-item-openid4vci.kebabPopUp.addingWalletBindingId:invocation[0]': { - type: 'error.platform.vc-item-openid4vci.kebabPopUp.addingWalletBindingId:invocation[0]'; - data: unknown; - }; - 'error.platform.vc-item-openid4vci.kebabPopUp.requestingBindingOtp:invocation[0]': { - type: 'error.platform.vc-item-openid4vci.kebabPopUp.requestingBindingOtp:invocation[0]'; - data: unknown; - }; - 'error.platform.vc-item-openid4vci.kebabPopUp.updatingPrivateKey:invocation[0]': { - type: 'error.platform.vc-item-openid4vci.kebabPopUp.updatingPrivateKey:invocation[0]'; - data: unknown; - }; - 'error.platform.vc-item-openid4vci.requestingBindingOtp:invocation[0]': { - type: 'error.platform.vc-item-openid4vci.requestingBindingOtp:invocation[0]'; - data: unknown; - }; - 'error.platform.vc-item-openid4vci.updatingPrivateKey:invocation[0]': { - type: 'error.platform.vc-item-openid4vci.updatingPrivateKey:invocation[0]'; - data: unknown; - }; - 'xstate.init': {type: 'xstate.init'}; - }; - invokeSrcNameMap: { - addWalletBindnigId: - | 'done.invoke.vc-item-openid4vci.addingWalletBindingId:invocation[0]' - | 'done.invoke.vc-item-openid4vci.kebabPopUp.addingWalletBindingId:invocation[0]'; - generateKeyPair: - | 'done.invoke.vc-item-openid4vci.addKeyPair:invocation[0]' - | 'done.invoke.vc-item-openid4vci.kebabPopUp.addKeyPair:invocation[0]'; - requestBindingOtp: - | 'done.invoke.vc-item-openid4vci.kebabPopUp.requestingBindingOtp:invocation[0]' - | 'done.invoke.vc-item-openid4vci.requestingBindingOtp:invocation[0]'; - requestOtp: - | 'done.invoke.vc-item-openid4vci.acceptingBindingOtp.resendOTP:invocation[0]' - | 'done.invoke.vc-item-openid4vci.kebabPopUp.acceptingBindingOtp.resendOTP:invocation[0]'; - updatePrivateKey: - | 'done.invoke.vc-item-openid4vci.kebabPopUp.updatingPrivateKey:invocation[0]' - | 'done.invoke.vc-item-openid4vci.updatingPrivateKey:invocation[0]'; - }; - missingImplementations: { - actions: 'clearTransactionId'; - delays: never; - guards: never; - services: 'requestOtp'; - }; - eventsCausingActions: { - VcUpdated: 'STORE_RESPONSE'; - clearOtp: - | 'DISMISS' - | 'done.invoke.vc-item-openid4vci.kebabPopUp.requestingBindingOtp:invocation[0]' - | 'done.invoke.vc-item-openid4vci.requestingBindingOtp:invocation[0]'; - clearTransactionId: 'DISMISS'; - logVCremoved: 'STORE_RESPONSE'; - logWalletBindingFailure: - | 'error.platform.vc-item-openid4vci.addKeyPair:invocation[0]' - | 'error.platform.vc-item-openid4vci.addingWalletBindingId:invocation[0]' - | 'error.platform.vc-item-openid4vci.kebabPopUp.addingWalletBindingId:invocation[0]' - | 'error.platform.vc-item-openid4vci.requestingBindingOtp:invocation[0]' - | 'error.platform.vc-item-openid4vci.updatingPrivateKey:invocation[0]'; - logWalletBindingSuccess: - | 'done.invoke.vc-item-openid4vci.addingWalletBindingId:invocation[0]' - | 'done.invoke.vc-item-openid4vci.kebabPopUp.addingWalletBindingId:invocation[0]' - | 'done.invoke.vc-item-openid4vci.kebabPopUp.updatingPrivateKey:invocation[0]' - | 'done.invoke.vc-item-openid4vci.updatingPrivateKey:invocation[0]'; - removeVcItem: 'CONFIRM'; - removedVc: 'STORE_RESPONSE'; - requestStoredContext: 'GET_VC_RESPONSE' | 'REFRESH'; - requestVcContext: 'DISMISS' | 'xstate.init'; - resetWalletBindingSuccess: 'DISMISS'; - sendVcUpdated: 'STORE_RESPONSE'; - sendWalletBindingSuccess: - | 'done.invoke.vc-item-openid4vci.kebabPopUp.addingWalletBindingId:invocation[0]' - | 'done.invoke.vc-item-openid4vci.kebabPopUp.updatingPrivateKey:invocation[0]'; - setContext: 'GET_VC_RESPONSE' | 'STORE_RESPONSE'; - setGeneratedOn: 'GET_VC_RESPONSE'; - setOtp: 'INPUT_OTP'; - setPinCard: 'PIN_CARD'; - setPrivateKey: - | 'done.invoke.vc-item-openid4vci.addKeyPair:invocation[0]' - | 'done.invoke.vc-item-openid4vci.kebabPopUp.addKeyPair:invocation[0]'; - setPublicKey: - | 'done.invoke.vc-item-openid4vci.addKeyPair:invocation[0]' - | 'done.invoke.vc-item-openid4vci.kebabPopUp.addKeyPair:invocation[0]'; - setThumbprintForWalletBindingId: - | 'done.invoke.vc-item-openid4vci.addingWalletBindingId:invocation[0]' - | 'done.invoke.vc-item-openid4vci.kebabPopUp.addingWalletBindingId:invocation[0]'; - setVcKey: 'REMOVE'; - setVcMetadata: 'UPDATE_VC_METADATA'; - setVerifiableCredential: 'GET_VC_RESPONSE' | 'STORE_RESPONSE'; - setWalletBindingError: - | 'error.platform.vc-item-openid4vci.addKeyPair:invocation[0]' - | 'error.platform.vc-item-openid4vci.addingWalletBindingId:invocation[0]' - | 'error.platform.vc-item-openid4vci.kebabPopUp.addKeyPair:invocation[0]' - | 'error.platform.vc-item-openid4vci.kebabPopUp.addingWalletBindingId:invocation[0]' - | 'error.platform.vc-item-openid4vci.kebabPopUp.requestingBindingOtp:invocation[0]' - | 'error.platform.vc-item-openid4vci.kebabPopUp.updatingPrivateKey:invocation[0]' - | 'error.platform.vc-item-openid4vci.requestingBindingOtp:invocation[0]' - | 'error.platform.vc-item-openid4vci.updatingPrivateKey:invocation[0]'; - setWalletBindingErrorEmpty: - | 'CANCEL' - | 'done.invoke.vc-item-openid4vci.addingWalletBindingId:invocation[0]' - | 'done.invoke.vc-item-openid4vci.kebabPopUp.addingWalletBindingId:invocation[0]' - | 'done.invoke.vc-item-openid4vci.kebabPopUp.updatingPrivateKey:invocation[0]' - | 'done.invoke.vc-item-openid4vci.updatingPrivateKey:invocation[0]'; - setWalletBindingId: - | 'done.invoke.vc-item-openid4vci.addingWalletBindingId:invocation[0]' - | 'done.invoke.vc-item-openid4vci.kebabPopUp.addingWalletBindingId:invocation[0]'; - setWalletBindingSuccess: 'done.invoke.vc-item-openid4vci.updatingPrivateKey:invocation[0]'; - storeContext: - | 'PIN_CARD' - | 'done.invoke.vc-item-openid4vci.addingWalletBindingId:invocation[0]' - | 'done.invoke.vc-item-openid4vci.kebabPopUp.addingWalletBindingId:invocation[0]' - | 'done.invoke.vc-item-openid4vci.kebabPopUp.updatingPrivateKey:invocation[0]' - | 'done.invoke.vc-item-openid4vci.updatingPrivateKey:invocation[0]'; - updatePrivateKey: - | 'done.invoke.vc-item-openid4vci.kebabPopUp.updatingPrivateKey:invocation[0]' - | 'done.invoke.vc-item-openid4vci.updatingPrivateKey:invocation[0]'; - updateVc: - | 'STORE_RESPONSE' - | 'done.invoke.vc-item-openid4vci.addingWalletBindingId:invocation[0]' - | 'done.invoke.vc-item-openid4vci.kebabPopUp.addingWalletBindingId:invocation[0]' - | 'done.invoke.vc-item-openid4vci.kebabPopUp.updatingPrivateKey:invocation[0]' - | 'done.invoke.vc-item-openid4vci.updatingPrivateKey:invocation[0]'; - }; - eventsCausingDelays: {}; - eventsCausingGuards: { - hasCredential: 'GET_VC_RESPONSE'; - isCustomSecureKeystore: - | 'done.invoke.vc-item-openid4vci.addKeyPair:invocation[0]' - | 'done.invoke.vc-item-openid4vci.addingWalletBindingId:invocation[0]' - | 'done.invoke.vc-item-openid4vci.kebabPopUp.addKeyPair:invocation[0]' - | 'done.invoke.vc-item-openid4vci.kebabPopUp.addingWalletBindingId:invocation[0]'; - }; - eventsCausingServices: { - addWalletBindnigId: - | 'done.invoke.vc-item-openid4vci.addKeyPair:invocation[0]' - | 'done.invoke.vc-item-openid4vci.kebabPopUp.addKeyPair:invocation[0]'; - generateKeyPair: 'INPUT_OTP'; - requestBindingOtp: 'CONFIRM'; - requestOtp: 'RESEND_OTP'; - updatePrivateKey: - | 'done.invoke.vc-item-openid4vci.addingWalletBindingId:invocation[0]' - | 'done.invoke.vc-item-openid4vci.kebabPopUp.addingWalletBindingId:invocation[0]'; - }; - matchesStates: - | 'acceptingBindingOtp' - | 'acceptingBindingOtp.idle' - | 'acceptingBindingOtp.resendOTP' - | 'addKeyPair' - | 'addingWalletBindingId' - | 'checkingStore' - | 'checkingVc' - | 'idle' - | 'kebabPopUp' - | 'kebabPopUp.acceptingBindingOtp' - | 'kebabPopUp.acceptingBindingOtp.idle' - | 'kebabPopUp.acceptingBindingOtp.resendOTP' - | 'kebabPopUp.addKeyPair' - | 'kebabPopUp.addingWalletBindingId' - | 'kebabPopUp.idle' - | 'kebabPopUp.removeWallet' - | 'kebabPopUp.removingVc' - | 'kebabPopUp.requestingBindingOtp' - | 'kebabPopUp.showActivities' - | 'kebabPopUp.showBindingWarning' - | 'kebabPopUp.showingWalletBindingError' - | 'kebabPopUp.updatingPrivateKey' - | 'pinCard' - | 'requestingBindingOtp' - | 'showBindingWarning' - | 'showingWalletBindingError' - | 'updatingPrivateKey' - | { - acceptingBindingOtp?: 'idle' | 'resendOTP'; - kebabPopUp?: - | 'acceptingBindingOtp' - | 'addKeyPair' - | 'addingWalletBindingId' - | 'idle' - | 'removeWallet' - | 'removingVc' - | 'requestingBindingOtp' - | 'showActivities' - | 'showBindingWarning' - | 'showingWalletBindingError' - | 'updatingPrivateKey' - | {acceptingBindingOtp?: 'idle' | 'resendOTP'}; - }; - tags: never; -} diff --git a/machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.ts b/machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.ts index e02f821dbc..2eb81e0c5b 100644 --- a/machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.ts +++ b/machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.ts @@ -4,10 +4,10 @@ import {MIMOTO_BASE_URL, MY_VCS_STORE_KEY} from '../../../shared/constants'; import {AppServices} from '../../../shared/GlobalContext'; import {CredentialDownloadResponse, request} from '../../../shared/request'; import { + DecodedCredential, VC, - VerifiableCredential, VcIdType, - DecodedCredential, + VerifiableCredential, } from '../../../types/VC/ExistingMosipVC/vc'; import {StoreEvents} from '../../store'; import {ActivityLogEvents} from '../../activityLog'; @@ -31,11 +31,12 @@ import i18n from '../../../i18n'; import SecureKeystore from 'react-native-secure-keystore'; import {VCMetadata} from '../../../shared/VCMetadata'; import { - sendStartEvent, - getStartEventData, getEndEventData, + getStartEventData, sendEndEvent, + sendStartEvent, } from '../../../shared/telemetry/TelemetryUtils'; +import {API_URLS} from '../../../shared/api'; const model = createModel( { @@ -1203,8 +1204,8 @@ export const ExistingMosipVCItemMachine = addWalletBindnigId: async context => { const response = await request( - 'POST', - '/residentmobileapp/wallet-binding', + API_URLS.walletBinding.method, + API_URLS.walletBinding.buildURL(), { requestTime: String(new Date().toISOString()), request: { @@ -1263,8 +1264,8 @@ export const ExistingMosipVCItemMachine = requestBindingOtp: async context => { const response = await request( - 'POST', - '/residentmobileapp/binding-otp', + API_URLS.bindingOtp.method, + API_URLS.bindingOtp.buildURL(), { requestTime: String(new Date().toISOString()), request: { @@ -1287,8 +1288,10 @@ export const ExistingMosipVCItemMachine = onReceive(async event => { if (event.type === 'POLL_STATUS') { const response = await request( - 'GET', - `/residentmobileapp/credentialshare/request/status/${context.vcMetadata.requestId}`, + API_URLS.credentialStatus.method, + API_URLS.credentialStatus.buildURL( + context.vcMetadata.requestId, + ), ); switch (response.response?.statusCode) { case 'NEW': @@ -1313,8 +1316,8 @@ export const ExistingMosipVCItemMachine = onReceive(async event => { if (event.type === 'POLL_DOWNLOAD') { const response: CredentialDownloadResponse = await request( - 'POST', - '/residentmobileapp/credentialshare/download', + API_URLS.credentialDownload.method, + API_URLS.credentialDownload.buildURL(), { individualId: context.vcMetadata.id, requestId: context.vcMetadata.requestId, @@ -1348,12 +1351,16 @@ export const ExistingMosipVCItemMachine = requestOtp: async context => { try { - return request('POST', '/residentmobileapp/req/otp', { - individualId: context.vcMetadata.id, - individualIdType: context.vcMetadata.idType, - otpChannel: ['EMAIL', 'PHONE'], - transactionID: context.transactionId, - }); + return request( + API_URLS.requestOtp.method, + API_URLS.requestOtp.buildURL(), + { + individualId: context.vcMetadata.id, + individualIdType: context.vcMetadata.idType, + otpChannel: ['EMAIL', 'PHONE'], + transactionID: context.transactionId, + }, + ); } catch (error) { console.error(error); } @@ -1363,8 +1370,8 @@ export const ExistingMosipVCItemMachine = let response = null; if (context.locked) { response = await request( - 'POST', - '/residentmobileapp/req/auth/unlock', + API_URLS.authUnLock.method, + API_URLS.authUnLock.buildURL(), { individualId: context.vcMetadata.id, individualIdType: context.vcMetadata.idType, @@ -1376,8 +1383,8 @@ export const ExistingMosipVCItemMachine = ); } else { response = await request( - 'POST', - '/residentmobileapp/req/auth/lock', + API_URLS.authLock.method, + API_URLS.authLock.buildURL(), { individualId: context.vcMetadata.id, individualIdType: context.vcMetadata.idType, @@ -1393,8 +1400,8 @@ export const ExistingMosipVCItemMachine = requestRevoke: async context => { try { return request( - 'PATCH', - `/residentmobileapp/vid/${context.vcMetadata.id}`, + API_URLS.requestRevoke.method, + API_URLS.requestRevoke.buildURL(context.vcMetadata.id), { transactionID: context.transactionId, vidStatus: 'REVOKED', diff --git a/machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.typegen.ts b/machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.typegen.ts index e69de29bb2..f4c21d6383 100644 --- a/machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.typegen.ts +++ b/machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.typegen.ts @@ -0,0 +1,394 @@ +// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + '@@xstate/typegen': true; + internalEvents: { + '': {type: ''}; + 'done.invoke.checkStatus': { + type: 'done.invoke.checkStatus'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'done.invoke.downloadCredential': { + type: 'done.invoke.downloadCredential'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'done.invoke.vc-item.addKeyPair:invocation[0]': { + type: 'done.invoke.vc-item.addKeyPair:invocation[0]'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'done.invoke.vc-item.addingWalletBindingId:invocation[0]': { + type: 'done.invoke.vc-item.addingWalletBindingId:invocation[0]'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'done.invoke.vc-item.checkingServerData.verifyingDownloadLimitExpiry:invocation[0]': { + type: 'done.invoke.vc-item.checkingServerData.verifyingDownloadLimitExpiry:invocation[0]'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'done.invoke.vc-item.kebabPopUp.addKeyPair:invocation[0]': { + type: 'done.invoke.vc-item.kebabPopUp.addKeyPair:invocation[0]'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'done.invoke.vc-item.kebabPopUp.addingWalletBindingId:invocation[0]': { + type: 'done.invoke.vc-item.kebabPopUp.addingWalletBindingId:invocation[0]'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'done.invoke.vc-item.kebabPopUp.requestingBindingOtp:invocation[0]': { + type: 'done.invoke.vc-item.kebabPopUp.requestingBindingOtp:invocation[0]'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'done.invoke.vc-item.kebabPopUp.updatingPrivateKey:invocation[0]': { + type: 'done.invoke.vc-item.kebabPopUp.updatingPrivateKey:invocation[0]'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'done.invoke.vc-item.requestingBindingOtp:invocation[0]': { + type: 'done.invoke.vc-item.requestingBindingOtp:invocation[0]'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'done.invoke.vc-item.requestingLock:invocation[0]': { + type: 'done.invoke.vc-item.requestingLock:invocation[0]'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'done.invoke.vc-item.requestingOtp:invocation[0]': { + type: 'done.invoke.vc-item.requestingOtp:invocation[0]'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'done.invoke.vc-item.requestingRevoke:invocation[0]': { + type: 'done.invoke.vc-item.requestingRevoke:invocation[0]'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'done.invoke.vc-item.updatingPrivateKey:invocation[0]': { + type: 'done.invoke.vc-item.updatingPrivateKey:invocation[0]'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'done.invoke.vc-item.verifyingCredential:invocation[0]': { + type: 'done.invoke.vc-item.verifyingCredential:invocation[0]'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'error.platform.checkStatus': { + type: 'error.platform.checkStatus'; + data: unknown; + }; + 'error.platform.downloadCredential': { + type: 'error.platform.downloadCredential'; + data: unknown; + }; + 'error.platform.vc-item.addKeyPair:invocation[0]': { + type: 'error.platform.vc-item.addKeyPair:invocation[0]'; + data: unknown; + }; + 'error.platform.vc-item.addingWalletBindingId:invocation[0]': { + type: 'error.platform.vc-item.addingWalletBindingId:invocation[0]'; + data: unknown; + }; + 'error.platform.vc-item.checkingServerData.verifyingDownloadLimitExpiry:invocation[0]': { + type: 'error.platform.vc-item.checkingServerData.verifyingDownloadLimitExpiry:invocation[0]'; + data: unknown; + }; + 'error.platform.vc-item.kebabPopUp.addKeyPair:invocation[0]': { + type: 'error.platform.vc-item.kebabPopUp.addKeyPair:invocation[0]'; + data: unknown; + }; + 'error.platform.vc-item.kebabPopUp.addingWalletBindingId:invocation[0]': { + type: 'error.platform.vc-item.kebabPopUp.addingWalletBindingId:invocation[0]'; + data: unknown; + }; + 'error.platform.vc-item.kebabPopUp.requestingBindingOtp:invocation[0]': { + type: 'error.platform.vc-item.kebabPopUp.requestingBindingOtp:invocation[0]'; + data: unknown; + }; + 'error.platform.vc-item.kebabPopUp.updatingPrivateKey:invocation[0]': { + type: 'error.platform.vc-item.kebabPopUp.updatingPrivateKey:invocation[0]'; + data: unknown; + }; + 'error.platform.vc-item.requestingBindingOtp:invocation[0]': { + type: 'error.platform.vc-item.requestingBindingOtp:invocation[0]'; + data: unknown; + }; + 'error.platform.vc-item.requestingLock:invocation[0]': { + type: 'error.platform.vc-item.requestingLock:invocation[0]'; + data: unknown; + }; + 'error.platform.vc-item.requestingRevoke:invocation[0]': { + type: 'error.platform.vc-item.requestingRevoke:invocation[0]'; + data: unknown; + }; + 'error.platform.vc-item.updatingPrivateKey:invocation[0]': { + type: 'error.platform.vc-item.updatingPrivateKey:invocation[0]'; + data: unknown; + }; + 'error.platform.vc-item.verifyingCredential:invocation[0]': { + type: 'error.platform.vc-item.verifyingCredential:invocation[0]'; + data: unknown; + }; + 'xstate.init': {type: 'xstate.init'}; + }; + invokeSrcNameMap: { + addWalletBindnigId: + | 'done.invoke.vc-item.addingWalletBindingId:invocation[0]' + | 'done.invoke.vc-item.kebabPopUp.addingWalletBindingId:invocation[0]'; + checkDownloadExpiryLimit: 'done.invoke.vc-item.checkingServerData.verifyingDownloadLimitExpiry:invocation[0]'; + checkStatus: 'done.invoke.checkStatus'; + downloadCredential: 'done.invoke.downloadCredential'; + generateKeyPair: + | 'done.invoke.vc-item.addKeyPair:invocation[0]' + | 'done.invoke.vc-item.kebabPopUp.addKeyPair:invocation[0]'; + requestBindingOtp: + | 'done.invoke.vc-item.kebabPopUp.requestingBindingOtp:invocation[0]' + | 'done.invoke.vc-item.requestingBindingOtp:invocation[0]'; + requestLock: 'done.invoke.vc-item.requestingLock:invocation[0]'; + requestOtp: + | 'done.invoke.vc-item.acceptingOtpInput.resendOTP:invocation[0]' + | 'done.invoke.vc-item.requestingOtp:invocation[0]'; + requestRevoke: 'done.invoke.vc-item.requestingRevoke:invocation[0]'; + updatePrivateKey: + | 'done.invoke.vc-item.kebabPopUp.updatingPrivateKey:invocation[0]' + | 'done.invoke.vc-item.updatingPrivateKey:invocation[0]'; + verifyCredential: 'done.invoke.vc-item.verifyingCredential:invocation[0]'; + }; + missingImplementations: { + actions: never; + delays: never; + guards: never; + services: never; + }; + eventsCausingActions: { + addVcToInProgressDownloads: 'STORE_RESPONSE'; + clearOtp: + | '' + | 'CANCEL' + | 'DISMISS' + | 'REVOKE_VC' + | 'STORE_RESPONSE' + | 'done.invoke.vc-item.addingWalletBindingId:invocation[0]' + | 'done.invoke.vc-item.kebabPopUp.requestingBindingOtp:invocation[0]' + | 'done.invoke.vc-item.requestingBindingOtp:invocation[0]' + | 'done.invoke.vc-item.requestingOtp:invocation[0]' + | 'done.invoke.vc-item.updatingPrivateKey:invocation[0]' + | 'done.invoke.vc-item.verifyingCredential:invocation[0]' + | 'error.platform.vc-item.requestingLock:invocation[0]' + | 'error.platform.vc-item.requestingRevoke:invocation[0]' + | 'error.platform.vc-item.verifyingCredential:invocation[0]'; + clearTransactionId: + | '' + | 'CANCEL' + | 'DISMISS' + | 'STORE_RESPONSE' + | 'done.invoke.vc-item.addingWalletBindingId:invocation[0]' + | 'done.invoke.vc-item.updatingPrivateKey:invocation[0]' + | 'done.invoke.vc-item.verifyingCredential:invocation[0]' + | 'error.platform.vc-item.verifyingCredential:invocation[0]'; + incrementDownloadCounter: 'POLL'; + logDownloaded: 'STORE_RESPONSE'; + logRevoked: 'STORE_RESPONSE'; + logVCremoved: 'STORE_RESPONSE'; + logWalletBindingFailure: + | 'error.platform.vc-item.addKeyPair:invocation[0]' + | 'error.platform.vc-item.addingWalletBindingId:invocation[0]' + | 'error.platform.vc-item.kebabPopUp.addingWalletBindingId:invocation[0]' + | 'error.platform.vc-item.requestingBindingOtp:invocation[0]' + | 'error.platform.vc-item.updatingPrivateKey:invocation[0]'; + logWalletBindingSuccess: + | 'done.invoke.vc-item.addingWalletBindingId:invocation[0]' + | 'done.invoke.vc-item.kebabPopUp.addingWalletBindingId:invocation[0]' + | 'done.invoke.vc-item.kebabPopUp.updatingPrivateKey:invocation[0]' + | 'done.invoke.vc-item.updatingPrivateKey:invocation[0]'; + markVcValid: 'done.invoke.vc-item.verifyingCredential:invocation[0]'; + refreshMyVcs: 'STORE_RESPONSE'; + removeTamperedVcItem: 'TAMPERED_VC'; + removeVcFromInProgressDownloads: 'STORE_RESPONSE'; + removeVcItem: 'CONFIRM'; + removeVcMetaDataFromStorage: 'STORE_ERROR'; + removeVcMetaDataFromVcMachine: 'DISMISS'; + requestStoredContext: 'GET_VC_RESPONSE' | 'REFRESH'; + requestVcContext: 'DISMISS' | 'xstate.init'; + resetWalletBindingSuccess: 'DISMISS'; + revokeVID: 'done.invoke.vc-item.requestingRevoke:invocation[0]'; + sendDownloadLimitExpire: 'error.platform.vc-item.checkingServerData.verifyingDownloadLimitExpiry:invocation[0]'; + sendTamperedVc: 'TAMPERED_VC'; + sendTelemetryEvents: 'STORE_RESPONSE'; + sendVcUpdated: 'PIN_CARD'; + sendWalletBindingSuccess: + | 'done.invoke.vc-item.kebabPopUp.addingWalletBindingId:invocation[0]' + | 'done.invoke.vc-item.kebabPopUp.updatingPrivateKey:invocation[0]'; + setCredential: 'GET_VC_RESPONSE' | 'STORE_RESPONSE'; + setDownloadInterval: 'done.invoke.vc-item.checkingServerData.verifyingDownloadLimitExpiry:invocation[0]'; + setLock: 'done.invoke.vc-item.requestingLock:invocation[0]'; + setMaxDownloadCount: 'done.invoke.vc-item.checkingServerData.verifyingDownloadLimitExpiry:invocation[0]'; + setOtp: 'INPUT_OTP'; + setOtpError: + | 'error.platform.vc-item.requestingLock:invocation[0]' + | 'error.platform.vc-item.requestingRevoke:invocation[0]'; + setPinCard: 'PIN_CARD'; + setPrivateKey: + | 'done.invoke.vc-item.addKeyPair:invocation[0]' + | 'done.invoke.vc-item.kebabPopUp.addKeyPair:invocation[0]'; + setPublicKey: + | 'done.invoke.vc-item.addKeyPair:invocation[0]' + | 'done.invoke.vc-item.kebabPopUp.addKeyPair:invocation[0]'; + setRevoke: 'done.invoke.vc-item.requestingRevoke:invocation[0]'; + setStoreVerifiableCredential: 'CREDENTIAL_DOWNLOADED'; + setThumbprintForWalletBindingId: + | 'done.invoke.vc-item.addingWalletBindingId:invocation[0]' + | 'done.invoke.vc-item.kebabPopUp.addingWalletBindingId:invocation[0]'; + setTransactionId: + | 'INPUT_OTP' + | 'REVOKE_VC' + | 'done.invoke.vc-item.requestingOtp:invocation[0]' + | 'error.platform.vc-item.requestingLock:invocation[0]' + | 'error.platform.vc-item.requestingRevoke:invocation[0]'; + setVcKey: 'REMOVE'; + setVcMetadata: 'UPDATE_VC_METADATA'; + setVerifiableCredential: 'STORE_RESPONSE'; + setWalletBindingError: + | 'error.platform.vc-item.addKeyPair:invocation[0]' + | 'error.platform.vc-item.addingWalletBindingId:invocation[0]' + | 'error.platform.vc-item.kebabPopUp.addKeyPair:invocation[0]' + | 'error.platform.vc-item.kebabPopUp.addingWalletBindingId:invocation[0]' + | 'error.platform.vc-item.kebabPopUp.requestingBindingOtp:invocation[0]' + | 'error.platform.vc-item.kebabPopUp.updatingPrivateKey:invocation[0]' + | 'error.platform.vc-item.requestingBindingOtp:invocation[0]' + | 'error.platform.vc-item.updatingPrivateKey:invocation[0]'; + setWalletBindingErrorEmpty: + | 'CANCEL' + | 'done.invoke.vc-item.addingWalletBindingId:invocation[0]' + | 'done.invoke.vc-item.kebabPopUp.addingWalletBindingId:invocation[0]' + | 'done.invoke.vc-item.kebabPopUp.updatingPrivateKey:invocation[0]' + | 'done.invoke.vc-item.updatingPrivateKey:invocation[0]'; + setWalletBindingId: + | 'done.invoke.vc-item.addingWalletBindingId:invocation[0]' + | 'done.invoke.vc-item.kebabPopUp.addingWalletBindingId:invocation[0]'; + setWalletBindingSuccess: 'done.invoke.vc-item.updatingPrivateKey:invocation[0]'; + storeContext: + | 'CREDENTIAL_DOWNLOADED' + | 'done.invoke.vc-item.addingWalletBindingId:invocation[0]' + | 'done.invoke.vc-item.kebabPopUp.addingWalletBindingId:invocation[0]' + | 'done.invoke.vc-item.kebabPopUp.updatingPrivateKey:invocation[0]' + | 'done.invoke.vc-item.updatingPrivateKey:invocation[0]' + | 'done.invoke.vc-item.verifyingCredential:invocation[0]'; + storeLock: 'done.invoke.vc-item.requestingLock:invocation[0]'; + updatePrivateKey: + | 'done.invoke.vc-item.kebabPopUp.updatingPrivateKey:invocation[0]' + | 'done.invoke.vc-item.updatingPrivateKey:invocation[0]'; + updateVc: + | 'STORE_RESPONSE' + | 'done.invoke.vc-item.addingWalletBindingId:invocation[0]' + | 'done.invoke.vc-item.kebabPopUp.addingWalletBindingId:invocation[0]' + | 'done.invoke.vc-item.kebabPopUp.updatingPrivateKey:invocation[0]' + | 'done.invoke.vc-item.updatingPrivateKey:invocation[0]' + | 'done.invoke.vc-item.verifyingCredential:invocation[0]'; + }; + eventsCausingDelays: {}; + eventsCausingGuards: { + hasCredential: 'GET_VC_RESPONSE' | 'STORE_RESPONSE'; + isCustomSecureKeystore: + | 'done.invoke.vc-item.addKeyPair:invocation[0]' + | 'done.invoke.vc-item.addingWalletBindingId:invocation[0]' + | 'done.invoke.vc-item.kebabPopUp.addKeyPair:invocation[0]' + | 'done.invoke.vc-item.kebabPopUp.addingWalletBindingId:invocation[0]'; + isDownloadAllowed: 'POLL'; + isVcValid: ''; + }; + eventsCausingServices: { + addWalletBindnigId: + | 'done.invoke.vc-item.addKeyPair:invocation[0]' + | 'done.invoke.vc-item.kebabPopUp.addKeyPair:invocation[0]'; + checkDownloadExpiryLimit: 'STORE_RESPONSE'; + checkStatus: + | 'done.invoke.vc-item.checkingServerData.verifyingDownloadLimitExpiry:invocation[0]' + | 'error.platform.vc-item.checkingServerData.verifyingDownloadLimitExpiry:invocation[0]'; + downloadCredential: 'DOWNLOAD_READY'; + generateKeyPair: 'INPUT_OTP'; + requestBindingOtp: 'CONFIRM'; + requestLock: 'INPUT_OTP'; + requestOtp: 'LOCK_VC' | 'RESEND_OTP'; + requestRevoke: 'INPUT_OTP'; + updatePrivateKey: + | 'done.invoke.vc-item.addingWalletBindingId:invocation[0]' + | 'done.invoke.vc-item.kebabPopUp.addingWalletBindingId:invocation[0]'; + verifyCredential: '' | 'VERIFY'; + }; + matchesStates: + | 'acceptingBindingOtp' + | 'acceptingOtpInput' + | 'acceptingOtpInput.idle' + | 'acceptingOtpInput.resendOTP' + | 'acceptingRevokeInput' + | 'addKeyPair' + | 'addingWalletBindingId' + | 'checkingServerData' + | 'checkingServerData.checkingStatus' + | 'checkingServerData.downloadingCredential' + | 'checkingServerData.savingFailed' + | 'checkingServerData.savingFailed.idle' + | 'checkingServerData.savingFailed.viewingVc' + | 'checkingServerData.verifyingDownloadLimitExpiry' + | 'checkingStore' + | 'checkingVc' + | 'checkingVerificationStatus' + | 'idle' + | 'invalid' + | 'invalid.backend' + | 'invalid.otp' + | 'kebabPopUp' + | 'kebabPopUp.acceptingBindingOtp' + | 'kebabPopUp.addKeyPair' + | 'kebabPopUp.addingWalletBindingId' + | 'kebabPopUp.idle' + | 'kebabPopUp.removeWallet' + | 'kebabPopUp.removingVc' + | 'kebabPopUp.requestingBindingOtp' + | 'kebabPopUp.showActivities' + | 'kebabPopUp.showBindingWarning' + | 'kebabPopUp.showingWalletBindingError' + | 'kebabPopUp.updatingPrivateKey' + | 'lockingVc' + | 'loggingRevoke' + | 'pinCard' + | 'requestingBindingOtp' + | 'requestingLock' + | 'requestingOtp' + | 'requestingRevoke' + | 'revokingVc' + | 'showBindingWarning' + | 'showingWalletBindingError' + | 'updatingPrivateKey' + | 'verifyingCredential' + | { + acceptingOtpInput?: 'idle' | 'resendOTP'; + checkingServerData?: + | 'checkingStatus' + | 'downloadingCredential' + | 'savingFailed' + | 'verifyingDownloadLimitExpiry' + | {savingFailed?: 'idle' | 'viewingVc'}; + invalid?: 'backend' | 'otp'; + kebabPopUp?: + | 'acceptingBindingOtp' + | 'addKeyPair' + | 'addingWalletBindingId' + | 'idle' + | 'removeWallet' + | 'removingVc' + | 'requestingBindingOtp' + | 'showActivities' + | 'showBindingWarning' + | 'showingWalletBindingError' + | 'updatingPrivateKey'; + }; + tags: never; +} diff --git a/machines/revoke.ts b/machines/revoke.ts index 57432739bc..e3e38b0545 100644 --- a/machines/revoke.ts +++ b/machines/revoke.ts @@ -1,5 +1,5 @@ import {TextInput} from 'react-native'; -import {assign, ErrorPlatformEvent, StateFrom, send, EventFrom} from 'xstate'; +import {assign, ErrorPlatformEvent, EventFrom, send, StateFrom} from 'xstate'; import {log} from 'xstate/lib/actions'; import i18n from '../i18n'; @@ -11,6 +11,7 @@ import {request} from '../shared/request'; import {VcIdType} from '../types/VC/ExistingMosipVC/vc'; import {MY_VCS_STORE_KEY} from '../shared/constants'; import {VCMetadata} from '../shared/VCMetadata'; +import {API_URLS} from '../shared/api'; const model = createModel( { @@ -236,12 +237,16 @@ export const revokeVidsMachine = services: { requestOtp: async context => { const transactionId = String(new Date().valueOf()).substring(3, 13); - return request('POST', '/residentmobileapp/req/otp', { - individualId: context.VIDsMetadata[0].id, - individualIdType: 'VID', - otpChannel: ['EMAIL', 'PHONE'], - transactionID: transactionId, - }); + return request( + API_URLS.requestOtp.method, + API_URLS.requestOtp.buildURL(), + { + individualId: context.VIDsMetadata[0].id, + individualIdType: 'VID', + otpChannel: ['EMAIL', 'PHONE'], + transactionID: transactionId, + }, + ); }, requestRevoke: context => async callback => { @@ -253,8 +258,8 @@ export const revokeVidsMachine = 13, ); return request( - 'PATCH', - `/residentmobileapp/vid/${metadata.id}`, + API_URLS.requestRevoke.method, + API_URLS.requestRevoke.buildURL(metadata.id), { transactionID: transactionId, vidStatus: 'REVOKED', diff --git a/machines/revoke.typegen.ts b/machines/revoke.typegen.ts index b68aaac1a1..da3480cde1 100644 --- a/machines/revoke.typegen.ts +++ b/machines/revoke.typegen.ts @@ -2,7 +2,7 @@ export interface Typegen0 { '@@xstate/typegen': true; - 'internalEvents': { + internalEvents: { 'done.invoke.RevokeVids.acceptingVIDs.requestingOtp:invocation[0]': { type: 'done.invoke.RevokeVids.acceptingVIDs.requestingOtp:invocation[0]'; data: unknown; @@ -12,19 +12,19 @@ export interface Typegen0 { type: 'error.platform.RevokeVids.acceptingVIDs.requestingOtp:invocation[0]'; data: unknown; }; - 'xstate.init': { type: 'xstate.init' }; + 'xstate.init': {type: 'xstate.init'}; }; - 'invokeSrcNameMap': { + invokeSrcNameMap: { requestOtp: 'done.invoke.RevokeVids.acceptingVIDs.requestingOtp:invocation[0]'; requestRevoke: 'done.invoke.RevokeVids.requestingRevoke:invocation[0]'; }; - 'missingImplementations': { + missingImplementations: { actions: never; delays: never; guards: never; services: never; }; - 'eventsCausingActions': { + eventsCausingActions: { clearOtp: | 'DISMISS' | 'ERROR' @@ -39,13 +39,13 @@ export interface Typegen0 { setTransactionId: 'DISMISS' | 'REVOKE_VCS' | 'xstate.init'; setVIDs: 'REVOKE_VCS'; }; - 'eventsCausingDelays': {}; - 'eventsCausingGuards': {}; - 'eventsCausingServices': { + eventsCausingDelays: {}; + eventsCausingGuards: {}; + eventsCausingServices: { requestOtp: never; requestRevoke: 'INPUT_OTP'; }; - 'matchesStates': + matchesStates: | 'acceptingOtpInput' | 'acceptingVIDs' | 'acceptingVIDs.idle' @@ -57,6 +57,6 @@ export interface Typegen0 { | 'loggingRevoke' | 'requestingRevoke' | 'revokingVc' - | { acceptingVIDs?: 'idle' | 'requestingOtp'; invalid?: 'backend' | 'otp' }; - 'tags': never; + | {acceptingVIDs?: 'idle' | 'requestingOtp'; invalid?: 'backend' | 'otp'}; + tags: never; } diff --git a/machines/store.ts b/machines/store.ts index f36247418b..4a99821a80 100644 --- a/machines/store.ts +++ b/machines/store.ts @@ -16,7 +16,6 @@ import {MY_VCS_STORE_KEY} from '../shared/constants'; import SecureKeystore from 'react-native-secure-keystore'; import { AUTH_TIMEOUT, - clear, decryptJson, DUMMY_KEY_FOR_BIOMETRIC_ALIAS, ENCRYPTION_ID, @@ -275,7 +274,7 @@ export const storeMachine = }, services: { - clear, + clear: () => clear(), hasAndroidEncryptionKey: () => async callback => { const hasSetCredentials = SecureKeystore.hasAlias(ENCRYPTION_ID); if (hasSetCredentials) { @@ -630,6 +629,18 @@ export async function removeVCMetaData( } } +export async function clear() { + try { + console.log('clearing entire storage'); + if (isHardwareKeystoreExists) { + SecureKeystore.clearKeys(); + } + await Storage.clear(); + } catch (e) { + console.error('error clear:', e); + throw e; + } +} export async function removeItems( key: string, values: string[], diff --git a/machines/store.typegen.ts b/machines/store.typegen.ts index e69de29bb2..a7ee5b5379 100644 --- a/machines/store.typegen.ts +++ b/machines/store.typegen.ts @@ -0,0 +1,78 @@ +// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + '@@xstate/typegen': true; + internalEvents: { + 'done.invoke._store': { + type: 'done.invoke._store'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'done.invoke.store.resettingStorage:invocation[0]': { + type: 'done.invoke.store.resettingStorage:invocation[0]'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'error.platform._store': {type: 'error.platform._store'; data: unknown}; + 'xstate.init': {type: 'xstate.init'}; + }; + invokeSrcNameMap: { + checkStorageInitialisedOrNot: 'done.invoke.store.checkStorageInitialisation:invocation[0]'; + clear: 'done.invoke.store.resettingStorage:invocation[0]'; + generateEncryptionKey: 'done.invoke.store.generatingEncryptionKey:invocation[0]'; + getEncryptionKey: 'done.invoke.store.gettingEncryptionKey:invocation[0]'; + hasAndroidEncryptionKey: 'done.invoke.store.checkEncryptionKey:invocation[0]'; + store: 'done.invoke._store'; + }; + missingImplementations: { + actions: never; + delays: never; + guards: never; + services: never; + }; + eventsCausingActions: { + cacheVCFilesData: + | 'KEY_RECEIVED' + | 'READY' + | 'done.invoke.store.resettingStorage:invocation[0]'; + forwardStoreRequest: + | 'APPEND' + | 'CLEAR' + | 'GET' + | 'PREPEND' + | 'REMOVE' + | 'REMOVE_ITEMS' + | 'REMOVE_VC_METADATA' + | 'SET' + | 'UPDATE'; + notifyParent: + | 'KEY_RECEIVED' + | 'READY' + | 'done.invoke.store.resettingStorage:invocation[0]'; + setEncryptionKey: 'KEY_RECEIVED'; + }; + eventsCausingDelays: {}; + eventsCausingGuards: { + isCustomSecureKeystore: 'KEY_RECEIVED'; + }; + eventsCausingServices: { + checkStorageInitialisedOrNot: 'ERROR'; + clear: 'KEY_RECEIVED'; + generateEncryptionKey: 'ERROR' | 'IGNORE' | 'READY'; + getEncryptionKey: 'TRY_AGAIN'; + hasAndroidEncryptionKey: never; + store: + | 'KEY_RECEIVED' + | 'READY' + | 'done.invoke.store.resettingStorage:invocation[0]'; + }; + matchesStates: + | 'checkEncryptionKey' + | 'checkStorageInitialisation' + | 'failedReadingKey' + | 'generatingEncryptionKey' + | 'gettingEncryptionKey' + | 'ready' + | 'resettingStorage'; + tags: never; +} diff --git a/package.json b/package.json index 54e435ae0c..d09fef0eb8 100644 --- a/package.json +++ b/package.json @@ -86,8 +86,7 @@ "react-native-vector-icons": "^10.0.0", "short-unique-id": "^4.4.4", "simple-pem2jwk": "^0.2.4", - "telemetry-sdk": "git://github.com/mosip/sunbird-telemetry-sdk.git#f762be5732ee552c0c70bdd540aa4e2701554c71", - "telemetry-sdk": "git://github.com/mosip/sunbird-telemetry-sdk.git#develop", + "telemetry-sdk": "git://github.com/mosip/sunbird-telemetry-sdk.git#f762be5732ee552c0c70bdd540aa4e2701554c71", "xstate": "^4.35.0" }, "devDependencies": { diff --git a/screens/Home/HomeScreen.tsx b/screens/Home/HomeScreen.tsx index 75c07d61c3..7345b0250a 100644 --- a/screens/Home/HomeScreen.tsx +++ b/screens/Home/HomeScreen.tsx @@ -1,6 +1,6 @@ import React, {useEffect} from 'react'; import {Icon, Tab} from 'react-native-elements'; -import {Button, Column, Text} from '../../components/ui'; +import {Column, Text} from '../../components/ui'; import {Theme} from '../../components/ui/styleUtils'; import {HomeRouteProps} from '../../routes/main'; import {MyVcsTab} from './MyVcsTab'; @@ -14,6 +14,7 @@ import {ExistingMosipVCItemMachine} from '../../machines/VCItemMachine/ExistingM import LinearGradient from 'react-native-linear-gradient'; import {EsignetMosipVCItemMachine} from '../../machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine'; import {ErrorMessageOverlay} from '../../components/MessageOverlay'; +import {Pressable} from 'react-native'; export const HomeScreen: React.FC = props => { const {t} = useTranslation('HomeScreen'); @@ -43,16 +44,19 @@ export const HomeScreen: React.FC = props => { return ( -