From 86840edcc16cc4c4f03857818141e5b2506598f7 Mon Sep 17 00:00:00 2001 From: Harsh Vardhan Date: Fri, 20 Oct 2023 12:14:21 +0530 Subject: [PATCH 1/3] feat(INJI-458): show loading screen after closing of web view in OpenID4VCI flow (#932) * perf(INJI-458): cache fixed result of custom keystore presence Each call over the RN bridge can take significant user-visible time, and since the result is used multiple times and cannot change for a device in runtime, it can be computed once stored for later use. Signed-off-by: Harsh Vardhan * feat(INJI-458): show loading for android h/w keystore check & generation Signed-off-by: Harsh Vardhan * feat(INJI-472): show loader on issuer select Co-authored-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> Signed-off-by: Harsh Vardhan * refactor(INJI-458): rename const name to isHardwareKeystoreExists Signed-off-by: Harsh Vardhan --------- Signed-off-by: Harsh Vardhan Co-authored-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com> --- .talismanrc | 18 +- App.tsx | 4 +- machines/QrLoginMachine.ts | 9 +- machines/QrLoginMachine.typegen.ts | 83 ---- .../EsignetMosipVCItemMachine.ts | 8 +- .../EsignetMosipVCItemMachine.typegen.ts | 250 ++++++++++- .../ExistingMosipVCItemMachine.ts | 8 +- .../ExistingMosipVCItemMachine.typegen.ts | 392 ------------------ machines/issuersMachine.ts | 16 +- machines/issuersMachine.typegen.ts | 250 +++++++---- machines/settings.ts | 4 +- machines/store.ts | 8 +- machines/store.typegen.ts | 75 ---- shared/cryptoutil/cryptoUtil.ts | 21 +- shared/storage.ts | 4 +- shared/telemetry/TelemetryUtils.js | 4 +- 16 files changed, 474 insertions(+), 680 deletions(-) diff --git a/.talismanrc b/.talismanrc index 6d24056494..f63ec90608 100644 --- a/.talismanrc +++ b/.talismanrc @@ -25,11 +25,21 @@ fileignoreconfig: checksum: 18af825821bc95e1056050623b804a5a8e7435b9e3383916a5d63024eeba9553 - filename: screens/WelcomeScreenController.ts checksum: d8fe74404c80bf435459f4d20427a661fb622f0ee9f754345616abd346b98d14 -- filename: shared/telemetry/TelemetryUtils.js - checksum: 9a61cd59a3718adf1f14faf3024fec66a3295ef373878a878a28e5cb1287afaa +- filename: machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.ts + checksum: 237a2640b7db70770d65da67c79f2929581e32f1162517e50b8d37e409f3387d - filename: machines/store.ts - checksum: bbee269bd9703644c2a345819291caa42479b5ad0d5288713da780495b2ffb49 + checksum: b9884f86b498dfbff75816d1f0d521c79971c8c28afa7824122d025b2699cdc4 +- filename: shared/cryptoutil/cryptoUtil.ts + checksum: b785ff3f01ab9530119072c4d38195048bfeee6155c54ea7dd031559acb722f3 +- filename: shared/telemetry/TelemetryUtils.js + checksum: ffe9aac2dcc590b98b0d588885c088eff189504ade653a77f74b67312bfd27ad - filename: shared/fileStorage.ts checksum: 07cb337dc1d5b0f0eef56270ac4f4f589260ee5e490183c024cf98a2aeafb139 - filename: shared/storage.ts - checksum: c8d874aa373bdf526bf59192139822f56915e702ef673bac4e0d7549b0fea3d0 \ No newline at end of file + checksum: c8d874aa373bdf526bf59192139822f56915e702ef673bac4e0d7549b0fea3d0 + checksum: f9711b617b986af9bb733a31373e49494667ef07b74988fbf09688cb50ca73bd +- filename: machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.ts + checksum: eec77ca61540327ff7cab3489ebdfd47aa373fd20b3ff87a6c322cd48d35fe8f +- filename: machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.typegen.ts + checksum: f1f504bd8c14496ee71f8eb7f40d54411cc05be03347d644dcc2cca187a20678 +version: "" diff --git a/App.tsx b/App.tsx index 19c358e4db..d4aeaba87b 100644 --- a/App.tsx +++ b/App.tsx @@ -18,7 +18,7 @@ import {Alert} from 'react-native'; import {configureTelemetry} from './shared/telemetry/TelemetryUtils'; import {MessageOverlay} from './components/MessageOverlay'; import SecureKeystore from 'react-native-secure-keystore'; -import {isCustomSecureKeystore} from './shared/cryptoutil/cryptoUtil'; +import {isHardwareKeystoreExists} from './shared/cryptoutil/cryptoUtil'; import i18n from './i18n'; import './shared/flipperConfig'; @@ -91,7 +91,7 @@ const AppInitialization: React.FC = () => { const {t} = useTranslation('common'); useEffect(() => { - if (isCustomSecureKeystore()) { + if (isHardwareKeystoreExists) { SecureKeystore.updatePopup( t('biometricPopup.title'), t('biometricPopup.description'), diff --git a/machines/QrLoginMachine.ts b/machines/QrLoginMachine.ts index 34cc66be6a..5202ac9195 100644 --- a/machines/QrLoginMachine.ts +++ b/machines/QrLoginMachine.ts @@ -12,7 +12,10 @@ import {MY_VCS_STORE_KEY, ESIGNET_BASE_URL} from '../shared/constants'; import {StoreEvents} from './store'; import {linkTransactionResponse, VC} from '../types/VC/ExistingMosipVC/vc'; import {request} from '../shared/request'; -import {getJwt, isCustomSecureKeystore} from '../shared/cryptoutil/cryptoUtil'; +import { + getJwt, + isHardwareKeystoreExists, +} from '../shared/cryptoutil/cryptoUtil'; import { getBindingCertificateConstant, getPrivateKey, @@ -363,7 +366,7 @@ export const qrLoginMachine = sendAuthenticate: async context => { let privateKey; const individualId = context.selectedVc.vcMetadata.id; - if (!isCustomSecureKeystore()) { + if (!isHardwareKeystoreExists) { privateKey = await getPrivateKey( context.selectedVc.walletBindingResponse?.walletBindingId, ); @@ -397,7 +400,7 @@ export const qrLoginMachine = sendConsent: async context => { let privateKey; const individualId = context.selectedVc.vcMetadata.id; - if (!isCustomSecureKeystore()) { + if (!isHardwareKeystoreExists) { privateKey = await getPrivateKey( context.selectedVc.walletBindingResponse?.walletBindingId, ); diff --git a/machines/QrLoginMachine.typegen.ts b/machines/QrLoginMachine.typegen.ts index 5e151b41e8..e69de29bb2 100644 --- a/machines/QrLoginMachine.typegen.ts +++ b/machines/QrLoginMachine.typegen.ts @@ -1,83 +0,0 @@ -// This file was automatically generated. Edits will be overwritten - -export interface Typegen0 { - '@@xstate/typegen': true; - internalEvents: { - 'done.invoke.QrLogin.linkTransaction:invocation[0]': { - type: 'done.invoke.QrLogin.linkTransaction:invocation[0]'; - data: unknown; - __tip: 'See the XState TS docs to learn how to strongly type this.'; - }; - 'done.invoke.QrLogin.sendingAuthenticate:invocation[0]': { - type: 'done.invoke.QrLogin.sendingAuthenticate:invocation[0]'; - data: unknown; - __tip: 'See the XState TS docs to learn how to strongly type this.'; - }; - 'error.platform.QrLogin.linkTransaction:invocation[0]': { - type: 'error.platform.QrLogin.linkTransaction:invocation[0]'; - data: unknown; - }; - 'error.platform.QrLogin.sendingAuthenticate:invocation[0]': { - type: 'error.platform.QrLogin.sendingAuthenticate:invocation[0]'; - data: unknown; - }; - 'error.platform.QrLogin.sendingConsent:invocation[0]': { - type: 'error.platform.QrLogin.sendingConsent:invocation[0]'; - data: unknown; - }; - 'xstate.init': {type: 'xstate.init'}; - }; - invokeSrcNameMap: { - linkTransaction: 'done.invoke.QrLogin.linkTransaction:invocation[0]'; - sendAuthenticate: 'done.invoke.QrLogin.sendingAuthenticate:invocation[0]'; - sendConsent: 'done.invoke.QrLogin.sendingConsent:invocation[0]'; - }; - missingImplementations: { - actions: never; - delays: never; - guards: never; - services: never; - }; - eventsCausingActions: { - SetErrorMessage: - | 'error.platform.QrLogin.linkTransaction:invocation[0]' - | 'error.platform.QrLogin.sendingAuthenticate:invocation[0]' - | 'error.platform.QrLogin.sendingConsent:invocation[0]'; - expandLinkTransResp: 'done.invoke.QrLogin.linkTransaction:invocation[0]'; - forwardToParent: 'DISMISS'; - loadMyVcs: 'done.invoke.QrLogin.linkTransaction:invocation[0]'; - loadThumbprint: 'CONFIRM'; - resetLinkTransactionId: 'GET'; - resetSelectedVoluntaryClaims: 'GET'; - setClaims: 'done.invoke.QrLogin.linkTransaction:invocation[0]'; - setConsentClaims: 'TOGGLE_CONSENT_CLAIM'; - setLinkedTransactionId: 'done.invoke.QrLogin.sendingAuthenticate:invocation[0]'; - setMyVcs: 'STORE_RESPONSE'; - setScanData: 'GET'; - setSelectedVc: 'SELECT_VC'; - setThumbprint: 'STORE_RESPONSE'; - setlinkTransactionResponse: 'done.invoke.QrLogin.linkTransaction:invocation[0]'; - }; - eventsCausingDelays: {}; - eventsCausingGuards: {}; - eventsCausingServices: { - linkTransaction: 'GET'; - sendAuthenticate: never; - sendConsent: 'STORE_RESPONSE'; - }; - matchesStates: - | 'ShowError' - | 'done' - | 'faceAuth' - | 'invalidIdentity' - | 'linkTransaction' - | 'loadMyVcs' - | 'loadingThumbprint' - | 'requestConsent' - | 'sendingAuthenticate' - | 'sendingConsent' - | 'showvcList' - | 'success' - | 'waitingForData'; - tags: never; -} diff --git a/machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.ts b/machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.ts index 9f481416e4..f90495052a 100644 --- a/machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.ts +++ b/machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.ts @@ -5,7 +5,7 @@ import {VCMetadata} from '../../../shared/VCMetadata'; import {VC} from '../../../types/VC/ExistingMosipVC/vc'; import { generateKeys, - isCustomSecureKeystore, + isHardwareKeystoreExists, WalletBindingResponse, } from '../../../shared/cryptoutil/cryptoUtil'; import {log} from 'xstate/lib/actions'; @@ -632,7 +632,7 @@ export const EsignetMosipVCItemMachine = model.createMachine( ), setPublicKey: assign({ publicKey: (context, event) => { - if (!isCustomSecureKeystore()) { + if (!isHardwareKeystoreExists) { return (event.data as KeyPair).public; } return event.data as string; @@ -788,7 +788,7 @@ export const EsignetMosipVCItemMachine = model.createMachine( return walletResponse; }, generateKeyPair: async context => { - if (!isCustomSecureKeystore()) { + if (!isHardwareKeystoreExists) { return await generateKeys(); } const isBiometricsEnabled = SecureKeystore.hasBiometricsEnabled(); @@ -825,7 +825,7 @@ export const EsignetMosipVCItemMachine = model.createMachine( return vc != null; }, - isCustomSecureKeystore: () => isCustomSecureKeystore(), + isCustomSecureKeystore: () => isHardwareKeystoreExists, }, }, ); diff --git a/machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.typegen.ts b/machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.typegen.ts index 75db6f0fab..e0bbf66caa 100644 --- a/machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.typegen.ts +++ b/machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.typegen.ts @@ -128,7 +128,255 @@ export interface Typegen0 { sendWalletBindingSuccess: | 'done.invoke.vc-item-openid4vci.kebabPopUp.addingWalletBindingId:invocation[0]' | 'done.invoke.vc-item-openid4vci.kebabPopUp.updatingPrivateKey:invocation[0]'; - setContext: 'STORE_RESPONSE'; + 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; +} + +// 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'; diff --git a/machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.ts b/machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.ts index ac757f3f06..e02f821dbc 100644 --- a/machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.ts +++ b/machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.ts @@ -15,7 +15,7 @@ import {verifyCredential} from '../../../shared/vcjs/verifyCredential'; import {log} from 'xstate/lib/actions'; import { generateKeys, - isCustomSecureKeystore, + isHardwareKeystoreExists, WalletBindingResponse, } from '../../../shared/cryptoutil/cryptoUtil'; import {KeyPair} from 'react-native-rsa-native'; @@ -854,7 +854,7 @@ export const ExistingMosipVCItemMachine = ), setPublicKey: assign({ publicKey: (context, event) => { - if (!isCustomSecureKeystore()) { + if (!isHardwareKeystoreExists) { return (event.data as KeyPair).public; } return event.data as string; @@ -1250,7 +1250,7 @@ export const ExistingMosipVCItemMachine = }, generateKeyPair: async context => { - if (!isCustomSecureKeystore()) { + if (!isHardwareKeystoreExists) { return await generateKeys(); } const isBiometricsEnabled = SecureKeystore.hasBiometricsEnabled(); @@ -1425,7 +1425,7 @@ export const ExistingMosipVCItemMachine = return context.isVerified; }, - isCustomSecureKeystore: () => isCustomSecureKeystore(), + isCustomSecureKeystore: () => isHardwareKeystoreExists, }, }, ); diff --git a/machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.typegen.ts b/machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.typegen.ts index ba48f5e9ec..e69de29bb2 100644 --- a/machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.typegen.ts +++ b/machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.typegen.ts @@ -1,392 +0,0 @@ -// 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]'; - sendTamperedVc: 'TAMPERED_VC'; - 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/issuersMachine.ts b/machines/issuersMachine.ts index 1a5eca229b..71844cd18c 100644 --- a/machines/issuersMachine.ts +++ b/machines/issuersMachine.ts @@ -7,7 +7,7 @@ import {AppServices} from '../shared/GlobalContext'; import NetInfo from '@react-native-community/netinfo'; import { generateKeys, - isCustomSecureKeystore, + isHardwareKeystoreExists, } from '../shared/cryptoutil/cryptoUtil'; import SecureKeystore from 'react-native-secure-keystore'; import {KeyPair} from 'react-native-rsa-native'; @@ -122,7 +122,7 @@ export const IssuersMachine = model.createMachine( }, { description: 'not fetched issuers config yet', - actions: ['setLoadingReasonAsDisplayIssuers', 'resetError'], + actions: ['setLoadingReasonAsSettingUp', 'resetError'], target: 'downloadIssuerConfig', }, ], @@ -139,7 +139,7 @@ export const IssuersMachine = model.createMachine( actions: sendParent('DOWNLOAD_ID'), }, SELECTED_ISSUER: { - actions: 'setSelectedIssuerId', + actions: ['setSelectedIssuerId', 'setLoadingReasonAsSettingUp'], target: 'downloadIssuerConfig', }, }, @@ -222,7 +222,7 @@ export const IssuersMachine = model.createMachine( }, checkKeyPair: { description: 'checks whether key pair is generated', - entry: [send('CHECK_KEY_PAIR')], + entry: ['setLoadingReasonAsSettingUp', send('CHECK_KEY_PAIR')], on: { CHECK_KEY_PAIR: [ { @@ -457,7 +457,7 @@ export const IssuersMachine = model.createMachine( }), setPublicKey: assign({ publicKey: (_, event) => { - if (!isCustomSecureKeystore()) { + if (!isHardwareKeystoreExists) { return (event.data as KeyPair).public; } return event.data as string; @@ -533,8 +533,8 @@ export const IssuersMachine = model.createMachine( constructAuthorizationConfiguration(context.selectedIssuer), ); }, - generateKeyPair: async context => { - if (!isCustomSecureKeystore()) { + generateKeyPair: async () => { + if (!isHardwareKeystoreExists) { return await generateKeys(); } const isBiometricsEnabled = SecureKeystore.hasBiometricsEnabled(); @@ -579,7 +579,7 @@ export const IssuersMachine = model.createMachine( ); }, shouldFetchIssuersAgain: context => context.issuers.length === 0, - isCustomSecureKeystore: () => isCustomSecureKeystore(), + isCustomSecureKeystore: () => isHardwareKeystoreExists, }, }, ); diff --git a/machines/issuersMachine.typegen.ts b/machines/issuersMachine.typegen.ts index 5bbd7a58c8..f7f7776388 100644 --- a/machines/issuersMachine.typegen.ts +++ b/machines/issuersMachine.typegen.ts @@ -1,90 +1,162 @@ +// This file was automatically generated. Edits will be overwritten - // This file was automatically generated. Edits will be overwritten - - export interface Typegen0 { - '@@xstate/typegen': true; - internalEvents: { - "done.invoke.checkInternet": { type: "done.invoke.checkInternet"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." }; -"done.invoke.issuersMachine.displayIssuers:invocation[0]": { type: "done.invoke.issuersMachine.displayIssuers:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." }; -"done.invoke.issuersMachine.downloadCredentials:invocation[0]": { type: "done.invoke.issuersMachine.downloadCredentials:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." }; -"done.invoke.issuersMachine.downloadIssuerConfig:invocation[0]": { type: "done.invoke.issuersMachine.downloadIssuerConfig:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." }; -"done.invoke.issuersMachine.generateKeyPair:invocation[0]": { type: "done.invoke.issuersMachine.generateKeyPair:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." }; -"done.invoke.issuersMachine.performAuthorization:invocation[0]": { type: "done.invoke.issuersMachine.performAuthorization:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." }; -"done.invoke.issuersMachine.verifyingCredential:invocation[0]": { type: "done.invoke.issuersMachine.verifyingCredential:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." }; -"error.platform.checkInternet": { type: "error.platform.checkInternet"; data: unknown }; -"error.platform.issuersMachine.displayIssuers:invocation[0]": { type: "error.platform.issuersMachine.displayIssuers:invocation[0]"; data: unknown }; -"error.platform.issuersMachine.downloadCredentials:invocation[0]": { type: "error.platform.issuersMachine.downloadCredentials:invocation[0]"; data: unknown }; -"error.platform.issuersMachine.downloadIssuerConfig:invocation[0]": { type: "error.platform.issuersMachine.downloadIssuerConfig:invocation[0]"; data: unknown }; -"error.platform.issuersMachine.performAuthorization:invocation[0]": { type: "error.platform.issuersMachine.performAuthorization:invocation[0]"; data: unknown }; -"error.platform.issuersMachine.verifyingCredential:invocation[0]": { type: "error.platform.issuersMachine.verifyingCredential:invocation[0]"; data: unknown }; -"xstate.init": { type: "xstate.init" }; - }; - invokeSrcNameMap: { - "checkInternet": "done.invoke.checkInternet"; -"downloadCredential": "done.invoke.issuersMachine.downloadCredentials:invocation[0]"; -"downloadIssuerConfig": "done.invoke.issuersMachine.downloadIssuerConfig:invocation[0]"; -"downloadIssuersList": "done.invoke.issuersMachine.displayIssuers:invocation[0]"; -"generateKeyPair": "done.invoke.issuersMachine.generateKeyPair:invocation[0]"; -"invokeAuthorization": "done.invoke.issuersMachine.performAuthorization:invocation[0]"; -"verifyCredential": "done.invoke.issuersMachine.verifyingCredential:invocation[0]"; - }; - missingImplementations: { - actions: never; - delays: never; - guards: never; - services: never; - }; - eventsCausingActions: { - "getKeyPairFromStore": "done.invoke.issuersMachine.performAuthorization:invocation[0]"; -"loadKeyPair": "done.invoke.issuersMachine.performAuthorization:invocation[0]"; -"logDownloaded": "done.invoke.issuersMachine.verifyingCredential:invocation[0]"; -"resetError": "RESET_ERROR" | "TRY_AGAIN" | "error.platform.issuersMachine.performAuthorization:invocation[0]"; -"resetLoadingReason": "done.invoke.checkInternet" | "done.invoke.issuersMachine.displayIssuers:invocation[0]" | "error.platform.issuersMachine.downloadCredentials:invocation[0]" | "error.platform.issuersMachine.downloadIssuerConfig:invocation[0]" | "error.platform.issuersMachine.performAuthorization:invocation[0]"; -"sendErrorEndEvent": "error.platform.issuersMachine.verifyingCredential:invocation[0]"; -"sendImpressionEvent": "done.invoke.issuersMachine.displayIssuers:invocation[0]"; -"sendSuccessEndEvent": "done.invoke.issuersMachine.verifyingCredential:invocation[0]"; -"setCredentialWrapper": "done.invoke.issuersMachine.downloadCredentials:invocation[0]"; -"setError": "error.platform.issuersMachine.displayIssuers:invocation[0]" | "error.platform.issuersMachine.downloadCredentials:invocation[0]" | "error.platform.issuersMachine.downloadIssuerConfig:invocation[0]" | "error.platform.issuersMachine.performAuthorization:invocation[0]"; -"setIssuers": "done.invoke.issuersMachine.displayIssuers:invocation[0]"; -"setLoadingReasonAsDisplayIssuers": "TRY_AGAIN"; -"setLoadingReasonAsDownloadingCredentials": "done.invoke.issuersMachine.generateKeyPair:invocation[0]"; -"setLoadingReasonAsSettingUp": "done.invoke.issuersMachine.performAuthorization:invocation[0]"; -"setNoInternet": "done.invoke.checkInternet"; -"setOIDCConfigError": "error.platform.issuersMachine.performAuthorization:invocation[0]"; -"setPrivateKey": "done.invoke.issuersMachine.generateKeyPair:invocation[0]"; -"setPublicKey": "done.invoke.issuersMachine.generateKeyPair:invocation[0]"; -"setSelectedIssuerId": "SELECTED_ISSUER"; -"setSelectedIssuers": "done.invoke.issuersMachine.downloadIssuerConfig:invocation[0]"; -"setTokenResponse": "done.invoke.issuersMachine.performAuthorization:invocation[0]"; -"setVerifiableCredential": "done.invoke.issuersMachine.downloadCredentials:invocation[0]"; -"storeKeyPair": "done.invoke.issuersMachine.generateKeyPair:invocation[0]"; -"storeVcMetaContext": "done.invoke.issuersMachine.verifyingCredential:invocation[0]"; -"storeVcsContext": "done.invoke.issuersMachine.verifyingCredential:invocation[0]"; -"storeVerifiableCredentialData": "done.invoke.issuersMachine.verifyingCredential:invocation[0]"; -"storeVerifiableCredentialMeta": "done.invoke.issuersMachine.verifyingCredential:invocation[0]"; - }; - eventsCausingDelays: { - - }; - eventsCausingGuards: { - "canSelectIssuerAgain": "TRY_AGAIN"; -"hasKeyPair": "CHECK_KEY_PAIR"; -"isCustomSecureKeystore": "done.invoke.issuersMachine.generateKeyPair:invocation[0]"; -"isInternetConnected": "done.invoke.checkInternet"; -"isOIDCConfigError": "error.platform.issuersMachine.performAuthorization:invocation[0]"; -"isOIDCflowCancelled": "error.platform.issuersMachine.performAuthorization:invocation[0]"; -"shouldFetchIssuersAgain": "TRY_AGAIN"; - }; - eventsCausingServices: { - "checkInternet": "done.invoke.issuersMachine.downloadIssuerConfig:invocation[0]"; -"downloadCredential": "CHECK_KEY_PAIR" | "done.invoke.issuersMachine.generateKeyPair:invocation[0]"; -"downloadIssuerConfig": "SELECTED_ISSUER" | "TRY_AGAIN"; -"downloadIssuersList": "TRY_AGAIN" | "xstate.init"; -"generateKeyPair": "CHECK_KEY_PAIR"; -"invokeAuthorization": "done.invoke.checkInternet"; -"verifyCredential": "done.invoke.issuersMachine.downloadCredentials:invocation[0]"; - }; - matchesStates: "checkInternet" | "checkKeyPair" | "displayIssuers" | "done" | "downloadCredentials" | "downloadIssuerConfig" | "error" | "generateKeyPair" | "idle" | "performAuthorization" | "selectingIssuer" | "storing" | "verifyingCredential"; - tags: never; - } - \ No newline at end of file +export interface Typegen0 { + '@@xstate/typegen': true; + internalEvents: { + 'done.invoke.checkInternet': { + type: 'done.invoke.checkInternet'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'done.invoke.issuersMachine.displayIssuers:invocation[0]': { + type: 'done.invoke.issuersMachine.displayIssuers:invocation[0]'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'done.invoke.issuersMachine.downloadCredentials:invocation[0]': { + type: 'done.invoke.issuersMachine.downloadCredentials:invocation[0]'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'done.invoke.issuersMachine.downloadIssuerConfig:invocation[0]': { + type: 'done.invoke.issuersMachine.downloadIssuerConfig:invocation[0]'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'done.invoke.issuersMachine.generateKeyPair:invocation[0]': { + type: 'done.invoke.issuersMachine.generateKeyPair:invocation[0]'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'done.invoke.issuersMachine.performAuthorization:invocation[0]': { + type: 'done.invoke.issuersMachine.performAuthorization:invocation[0]'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'done.invoke.issuersMachine.verifyingCredential:invocation[0]': { + type: 'done.invoke.issuersMachine.verifyingCredential:invocation[0]'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'error.platform.checkInternet': { + type: 'error.platform.checkInternet'; + data: unknown; + }; + 'error.platform.issuersMachine.displayIssuers:invocation[0]': { + type: 'error.platform.issuersMachine.displayIssuers:invocation[0]'; + data: unknown; + }; + 'error.platform.issuersMachine.downloadCredentials:invocation[0]': { + type: 'error.platform.issuersMachine.downloadCredentials:invocation[0]'; + data: unknown; + }; + 'error.platform.issuersMachine.downloadIssuerConfig:invocation[0]': { + type: 'error.platform.issuersMachine.downloadIssuerConfig:invocation[0]'; + data: unknown; + }; + 'error.platform.issuersMachine.performAuthorization:invocation[0]': { + type: 'error.platform.issuersMachine.performAuthorization:invocation[0]'; + data: unknown; + }; + 'error.platform.issuersMachine.verifyingCredential:invocation[0]': { + type: 'error.platform.issuersMachine.verifyingCredential:invocation[0]'; + data: unknown; + }; + 'xstate.init': {type: 'xstate.init'}; + }; + invokeSrcNameMap: { + checkInternet: 'done.invoke.checkInternet'; + downloadCredential: 'done.invoke.issuersMachine.downloadCredentials:invocation[0]'; + downloadIssuerConfig: 'done.invoke.issuersMachine.downloadIssuerConfig:invocation[0]'; + downloadIssuersList: 'done.invoke.issuersMachine.displayIssuers:invocation[0]'; + generateKeyPair: 'done.invoke.issuersMachine.generateKeyPair:invocation[0]'; + invokeAuthorization: 'done.invoke.issuersMachine.performAuthorization:invocation[0]'; + verifyCredential: 'done.invoke.issuersMachine.verifyingCredential:invocation[0]'; + }; + missingImplementations: { + actions: never; + delays: never; + guards: never; + services: never; + }; + eventsCausingActions: { + getKeyPairFromStore: 'done.invoke.issuersMachine.performAuthorization:invocation[0]'; + loadKeyPair: 'done.invoke.issuersMachine.performAuthorization:invocation[0]'; + logDownloaded: 'done.invoke.issuersMachine.verifyingCredential:invocation[0]'; + resetError: + | 'RESET_ERROR' + | 'TRY_AGAIN' + | 'error.platform.issuersMachine.performAuthorization:invocation[0]'; + resetLoadingReason: + | 'done.invoke.checkInternet' + | 'done.invoke.issuersMachine.displayIssuers:invocation[0]' + | 'error.platform.issuersMachine.downloadCredentials:invocation[0]' + | 'error.platform.issuersMachine.downloadIssuerConfig:invocation[0]' + | 'error.platform.issuersMachine.performAuthorization:invocation[0]'; + sendErrorEndEvent: 'error.platform.issuersMachine.verifyingCredential:invocation[0]'; + sendImpressionEvent: 'done.invoke.issuersMachine.displayIssuers:invocation[0]'; + sendSuccessEndEvent: 'done.invoke.issuersMachine.verifyingCredential:invocation[0]'; + setCredentialWrapper: 'done.invoke.issuersMachine.downloadCredentials:invocation[0]'; + setError: + | 'error.platform.issuersMachine.displayIssuers:invocation[0]' + | 'error.platform.issuersMachine.downloadCredentials:invocation[0]' + | 'error.platform.issuersMachine.downloadIssuerConfig:invocation[0]' + | 'error.platform.issuersMachine.performAuthorization:invocation[0]'; + setIssuers: 'done.invoke.issuersMachine.displayIssuers:invocation[0]'; + setLoadingReasonAsDisplayIssuers: 'TRY_AGAIN'; + setLoadingReasonAsDownloadingCredentials: 'done.invoke.issuersMachine.generateKeyPair:invocation[0]'; + setLoadingReasonAsSettingUp: + | 'SELECTED_ISSUER' + | 'TRY_AGAIN' + | 'done.invoke.issuersMachine.performAuthorization:invocation[0]'; + setNoInternet: 'done.invoke.checkInternet'; + setOIDCConfigError: 'error.platform.issuersMachine.performAuthorization:invocation[0]'; + setPrivateKey: 'done.invoke.issuersMachine.generateKeyPair:invocation[0]'; + setPublicKey: 'done.invoke.issuersMachine.generateKeyPair:invocation[0]'; + setSelectedIssuerId: 'SELECTED_ISSUER'; + setSelectedIssuers: 'done.invoke.issuersMachine.downloadIssuerConfig:invocation[0]'; + setTokenResponse: 'done.invoke.issuersMachine.performAuthorization:invocation[0]'; + setVerifiableCredential: 'done.invoke.issuersMachine.downloadCredentials:invocation[0]'; + storeKeyPair: 'done.invoke.issuersMachine.generateKeyPair:invocation[0]'; + storeVcMetaContext: 'done.invoke.issuersMachine.verifyingCredential:invocation[0]'; + storeVcsContext: 'done.invoke.issuersMachine.verifyingCredential:invocation[0]'; + storeVerifiableCredentialData: 'done.invoke.issuersMachine.verifyingCredential:invocation[0]'; + storeVerifiableCredentialMeta: 'done.invoke.issuersMachine.verifyingCredential:invocation[0]'; + }; + eventsCausingDelays: {}; + eventsCausingGuards: { + canSelectIssuerAgain: 'TRY_AGAIN'; + hasKeyPair: 'CHECK_KEY_PAIR'; + isCustomSecureKeystore: 'done.invoke.issuersMachine.generateKeyPair:invocation[0]'; + isInternetConnected: 'done.invoke.checkInternet'; + isOIDCConfigError: 'error.platform.issuersMachine.performAuthorization:invocation[0]'; + isOIDCflowCancelled: 'error.platform.issuersMachine.performAuthorization:invocation[0]'; + shouldFetchIssuersAgain: 'TRY_AGAIN'; + }; + eventsCausingServices: { + checkInternet: 'done.invoke.issuersMachine.downloadIssuerConfig:invocation[0]'; + downloadCredential: + | 'CHECK_KEY_PAIR' + | 'done.invoke.issuersMachine.generateKeyPair:invocation[0]'; + downloadIssuerConfig: 'SELECTED_ISSUER' | 'TRY_AGAIN'; + downloadIssuersList: 'TRY_AGAIN' | 'xstate.init'; + generateKeyPair: 'CHECK_KEY_PAIR'; + invokeAuthorization: 'done.invoke.checkInternet'; + verifyCredential: 'done.invoke.issuersMachine.downloadCredentials:invocation[0]'; + }; + matchesStates: + | 'checkInternet' + | 'checkKeyPair' + | 'displayIssuers' + | 'done' + | 'downloadCredentials' + | 'downloadIssuerConfig' + | 'error' + | 'generateKeyPair' + | 'idle' + | 'performAuthorization' + | 'selectingIssuer' + | 'storing' + | 'verifyingCredential'; + tags: never; +} diff --git a/machines/settings.ts b/machines/settings.ts index 76cc855f9e..98989cad50 100644 --- a/machines/settings.ts +++ b/machines/settings.ts @@ -17,7 +17,7 @@ import getAllConfigurations, { import Storage from '../shared/storage'; import ShortUniqueId from 'short-unique-id'; import {__AppId} from '../shared/GlobalVariables'; -import {isCustomSecureKeystore} from '../shared/cryptoutil/cryptoUtil'; +import {isHardwareKeystoreExists} from '../shared/cryptoutil/cryptoUtil'; const model = createModel( { @@ -274,7 +274,7 @@ function generateAppId() { } function deviceSupportsHardwareKeystore() { - return isIOS() ? true : isCustomSecureKeystore(); + return isIOS() ? true : isHardwareKeystoreExists; } type State = StateFrom; diff --git a/machines/store.ts b/machines/store.ts index 7ca566bac9..8342b14379 100644 --- a/machines/store.ts +++ b/machines/store.ts @@ -22,7 +22,7 @@ import { ENCRYPTION_ID, encryptJson, HMAC_ALIAS, - isCustomSecureKeystore, + isHardwareKeystoreExists, } from '../shared/cryptoutil/cryptoUtil'; import {VCMetadata} from '../shared/VCMetadata'; import FileStorage, {getFilePath} from '../shared/fileStorage'; @@ -82,7 +82,7 @@ export const storeMachine = events: {} as EventFrom, }, id: 'store', - initial: !isCustomSecureKeystore() + initial: !isHardwareKeystoreExists ? 'gettingEncryptionKey' : 'checkEncryptionKey', states: { @@ -441,7 +441,7 @@ export const storeMachine = generateEncryptionKey: () => async callback => { const randomBytes = await generateSecureRandom(32); const randomBytesString = binaryToBase64(randomBytes); - if (!isCustomSecureKeystore()) { + if (!isHardwareKeystoreExists) { const hasSetCredentials = await Keychain.setGenericPassword( ENCRYPTION_ID, randomBytesString, @@ -475,7 +475,7 @@ export const storeMachine = }, guards: { - isCustomSecureKeystore: () => isCustomSecureKeystore(), + isCustomSecureKeystore: () => isHardwareKeystoreExists, }, }, ); diff --git a/machines/store.typegen.ts b/machines/store.typegen.ts index fce816aaba..e69de29bb2 100644 --- a/machines/store.typegen.ts +++ b/machines/store.typegen.ts @@ -1,75 +0,0 @@ -// 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: 'logKey'; - delays: never; - guards: never; - services: never; - }; - eventsCausingActions: { - forwardStoreRequest: - | 'APPEND' - | 'CLEAR' - | 'GET' - | 'PREPEND' - | 'REMOVE' - | 'REMOVE_ITEMS' - | 'REMOVE_VC_METADATA' - | 'SET' - | 'UPDATE'; - logKey: 'KEY_RECEIVED'; - 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/shared/cryptoutil/cryptoUtil.ts b/shared/cryptoutil/cryptoUtil.ts index a5019c1e32..d016fe72e4 100644 --- a/shared/cryptoutil/cryptoUtil.ts +++ b/shared/cryptoutil/cryptoUtil.ts @@ -18,6 +18,11 @@ export function generateKeys(): Promise { return Promise.resolve(RSA.generateKeys(4096)); } +/** + * isCustomKeystore is a cached check of existence of a hardware keystore. + */ +export const isHardwareKeystoreExists = isCustomSecureKeystore(); + export async function getJwt( privateKey: string, individualId: string, @@ -70,7 +75,7 @@ export async function createSignature( ) { let signature64; - if (!isCustomSecureKeystore()) { + if (!isHardwareKeystoreExists) { const key = forge.pki.privateKeyFromPem(privateKey); const md = forge.md.sha256.create(); md.update(preHash, 'utf8'); @@ -98,7 +103,13 @@ export function encodeB64(str: string) { return replaceCharactersInB64(encodedB64); } -export function isCustomSecureKeystore() { +/** + * DO NOT USE DIRECTLY and/or REPEATEDLY in application lifeycle. + * + * This can make a call to the Android native layer hence taking up more time, + * use the isCustomKeystore constant in the app lifeycle instead. + */ +function isCustomSecureKeystore() { return !isIOS() ? SecureKeystore.deviceSupportsHardware() : false; } @@ -112,7 +123,7 @@ export interface WalletBindingResponse { export async function clear() { try { console.log('clearing entire storage'); - if (isCustomSecureKeystore()) { + if (isHardwareKeystoreExists) { SecureKeystore.clearKeys(); } await Storage.clear(); @@ -131,7 +142,7 @@ export async function encryptJson( return JSON.stringify(data); } - if (!isCustomSecureKeystore()) { + if (!isHardwareKeystoreExists) { return CryptoJS.AES.encrypt(data, encryptionKey).toString(); } return await SecureKeystore.encryptData(ENCRYPTION_ID, data); @@ -147,7 +158,7 @@ export async function decryptJson( return JSON.parse(encryptedData); } - if (!isCustomSecureKeystore()) { + if (!isHardwareKeystoreExists) { return CryptoJS.AES.decrypt(encryptedData, encryptionKey).toString( CryptoJS.enc.Utf8, ); diff --git a/shared/storage.ts b/shared/storage.ts index 07ddfe161c..726fe38f84 100644 --- a/shared/storage.ts +++ b/shared/storage.ts @@ -11,7 +11,7 @@ import { decryptJson, encryptJson, HMAC_ALIAS, - isCustomSecureKeystore, + isHardwareKeystoreExists, } from './cryptoutil/cryptoUtil'; import {VCMetadata} from './VCMetadata'; import {ENOENT, getItem} from '../machines/store'; @@ -30,7 +30,7 @@ async function generateHmac( encryptionKey: string, data: string, ): Promise { - if (!isCustomSecureKeystore()) { + if (!isHardwareKeystoreExists) { return CryptoJS.HmacSHA256(encryptionKey, data).toString(); } return await SecureKeystore.generateHmacSha(HMAC_ALIAS, data); diff --git a/shared/telemetry/TelemetryUtils.js b/shared/telemetry/TelemetryUtils.js index 333bb79b1a..f3d8256ebb 100644 --- a/shared/telemetry/TelemetryUtils.js +++ b/shared/telemetry/TelemetryUtils.js @@ -11,7 +11,7 @@ import { } from '../GlobalVariables'; import {OBSRV_HOST} from 'react-native-dotenv'; import DeviceInfo from 'react-native-device-info'; -import {isCustomSecureKeystore} from '../cryptoutil/cryptoUtil'; +import {isHardwareKeystoreExists} from '../cryptoutil/cryptoUtil'; import * as RNLocalize from 'react-native-localize'; export function sendStartEvent(data) { @@ -124,7 +124,7 @@ export function getAppInfoEventData() { osName: DeviceInfo.getSystemName(), osVersion: DeviceInfo.getSystemVersion(), osApiLevel: Platform.Version.toString(), - isHardwareKeystoreSupported: isCustomSecureKeystore(), + isHardwareKeystoreSupported: isHardwareKeystoreExists, dateTime: new Date().getTime(), zone: RNLocalize.getTimeZone(), offset: new Date().getTimezoneOffset() * 60 * 1000, From 142228b0db957f220152c3290695ef802501ef64 Mon Sep 17 00:00:00 2001 From: Swati Goel Date: Fri, 20 Oct 2023 12:50:39 +0530 Subject: [PATCH 2/3] INJI-473) Code clean up and fixing metro errors/warnings (#947) * feat(INJI-473) - Removed unused injiTourGuide action. Signed-off-by: Swati Goel * feat(INJI-473) - Removed unused logKey action. Signed-off-by: Swati Goel * feat(INJI-473) - Removed unused backendInfo api and state. Signed-off-by: Swati Goel * feat(INJI-473) - simplify isPasscodeSet logic. Signed-off-by: Swati Goel * feat(INJI-473) - Move logState to commonUtil to remove cyclic dependency. Signed-off-by: Swati Goel * feat(INJI-473) - Delete unused code. Signed-off-by: Swati Goel * feat(INJI-473) - Refactor code to use util function for iOS or isAndroid. Signed-off-by: Swati Goel * feat(INJI-473) - Move Issuers_Key_Ref into utils. Signed-off-by: Swati Goel * feat(INJI-473) - Remove profile related resource from setting screen Signed-off-by: Swati Goel * feat(INJI-473) - Remove unused code for locales. Signed-off-by: Swati Goel --------- Signed-off-by: Swati Goel --- .talismanrc | 28 ++- components/ActivityLogText.strings.json | 18 -- components/DeviceInfoList.strings.json | 6 - components/EditableListItem.tsx | 7 +- components/FaceScanner.strings.json | 1 - components/FaceScanner.tsx | 3 +- components/GlobalContextProvider.tsx | 3 +- components/OIDcAuth.strings.json | 5 - components/PasscodeVerify.strings.json | 3 - components/QrScanner.strings.json | 4 - .../VC/MosipVCItem/MosipVCItemContent.tsx | 2 +- .../VC/MosipVCItem/MosipVCItemDetails.tsx | 2 +- components/VcDetails.strings.json | 22 -- components/ui/Loader.tsx | 2 +- components/ui/Modal.tsx | 2 +- components/ui/themes/DefaultTheme.ts | 27 ++- components/ui/themes/PurpleTheme.ts | 27 ++- locales/ara.json | 5 - locales/en.json | 5 - locales/fil.json | 5 - locales/hin.json | 5 - locales/kan.json | 5 - locales/spa.json | 10 - locales/tam.json | 5 - machines/app.ts | 100 ++------- machines/biometrics.ts | 3 +- machines/bleShare/request/requestMachine.ts | 4 +- machines/bleShare/scan/scanMachine.ts | 12 +- machines/issuersMachine.ts | 9 +- machines/settings.ts | 11 +- machines/store.ts | 2 +- package.json | 4 +- screens/AuthScreen.strings.json | 11 - screens/BiometricScreen.strings.json | 3 - screens/BiometricScreenController.ts | 3 +- screens/History/HistoryScreen.strings.json | 7 - screens/Home/HomeScreen.strings.json | 5 - screens/Home/IntroSlidersScreen.tsx | 16 +- screens/Home/MyVcs/AddVcModal.strings.json | 16 -- .../MyVcs/DownloadingVcModal.strings.json | 5 - .../Home/MyVcs/GetIdInputModal.strings.json | 7 - screens/Home/MyVcs/GetIdInputModal.tsx | 33 +-- screens/Home/MyVcs/IdInputModal.strings.json | 7 - screens/Home/MyVcs/IdInputModal.tsx | 4 +- .../MyVcs/OtpVerificationModal.strings.json | 6 - screens/Home/MyVcs/WalletBinding.tsx | 10 - screens/Home/MyVcs/WalletBindingController.ts | 87 -------- screens/Home/MyVcsTab.strings.json | 15 -- screens/Home/OnboardingOverlay.strings.json | 9 - screens/Home/ReceivedVcsTab.strings.json | 4 - screens/Home/ViewVcModal.strings.json | 16 -- screens/MainLayout.strings.json | 6 - screens/PasscodeScreen.strings.json | 5 - screens/Profile/ProfileScreen.tsx | 190 ------------------ screens/Profile/ProfileScreenController.ts | 137 ------------- screens/QrLogin/QrConsent.tsx | 4 +- screens/Request/ReceiveVcScreen.strings.json | 14 -- screens/Request/RequestScreen.strings.json | 52 ----- screens/Request/RequestScreen.tsx | 5 +- screens/Scan/ScanScreen.strings.json | 48 ----- screens/Scan/ScanScreen.tsx | 5 +- screens/Scan/SelectVcOverlay.strings.json | 6 - screens/Scan/SendVcScreen.strings.json | 7 - screens/Settings/AboutInji.tsx | 2 +- screens/Settings/AppMetaData.strings.json | 5 - screens/Settings/AppMetaData.tsx | 99 --------- screens/Settings/Credits.strings.json | 4 - screens/Settings/Credits.tsx | 101 ---------- screens/Settings/SettingScreen.json | 15 -- screens/Settings/SettingScreen.tsx | 33 +-- screens/Settings/SettingScreenController.ts | 5 +- screens/VerifyIdentityOverlay.strings.json | 12 -- screens/WelcomeScreen.strings.json | 5 - screens/WelcomeScreenController.ts | 8 +- scripts/compile-strings.js | 13 -- shared/common.strings.json | 13 -- shared/commonUtil.ts | 27 ++- shared/constants.ts | 4 + shared/openId4VCI/Utils.ts | 8 +- shared/storage.ts | 4 +- 80 files changed, 171 insertions(+), 1277 deletions(-) delete mode 100644 components/ActivityLogText.strings.json delete mode 100644 components/DeviceInfoList.strings.json delete mode 100644 components/FaceScanner.strings.json delete mode 100644 components/OIDcAuth.strings.json delete mode 100644 components/PasscodeVerify.strings.json delete mode 100644 components/QrScanner.strings.json delete mode 100644 components/VcDetails.strings.json delete mode 100644 screens/AuthScreen.strings.json delete mode 100644 screens/BiometricScreen.strings.json delete mode 100644 screens/History/HistoryScreen.strings.json delete mode 100644 screens/Home/HomeScreen.strings.json delete mode 100644 screens/Home/MyVcs/AddVcModal.strings.json delete mode 100644 screens/Home/MyVcs/DownloadingVcModal.strings.json delete mode 100644 screens/Home/MyVcs/GetIdInputModal.strings.json delete mode 100644 screens/Home/MyVcs/IdInputModal.strings.json delete mode 100644 screens/Home/MyVcs/OtpVerificationModal.strings.json delete mode 100644 screens/Home/MyVcs/WalletBindingController.ts delete mode 100644 screens/Home/MyVcsTab.strings.json delete mode 100644 screens/Home/OnboardingOverlay.strings.json delete mode 100644 screens/Home/ReceivedVcsTab.strings.json delete mode 100644 screens/Home/ViewVcModal.strings.json delete mode 100644 screens/MainLayout.strings.json delete mode 100644 screens/PasscodeScreen.strings.json delete mode 100644 screens/Profile/ProfileScreen.tsx delete mode 100644 screens/Profile/ProfileScreenController.ts delete mode 100644 screens/Request/ReceiveVcScreen.strings.json delete mode 100644 screens/Request/RequestScreen.strings.json delete mode 100644 screens/Scan/ScanScreen.strings.json delete mode 100644 screens/Scan/SelectVcOverlay.strings.json delete mode 100644 screens/Scan/SendVcScreen.strings.json delete mode 100644 screens/Settings/AppMetaData.strings.json delete mode 100644 screens/Settings/AppMetaData.tsx delete mode 100644 screens/Settings/Credits.strings.json delete mode 100644 screens/Settings/Credits.tsx delete mode 100644 screens/Settings/SettingScreen.json delete mode 100644 screens/VerifyIdentityOverlay.strings.json delete mode 100644 screens/WelcomeScreen.strings.json delete mode 100644 scripts/compile-strings.js delete mode 100644 shared/common.strings.json diff --git a/.talismanrc b/.talismanrc index f63ec90608..963221e53a 100644 --- a/.talismanrc +++ b/.talismanrc @@ -24,22 +24,32 @@ fileignoreconfig: - filename: screens/AuthScreenController.ts checksum: 18af825821bc95e1056050623b804a5a8e7435b9e3383916a5d63024eeba9553 - filename: screens/WelcomeScreenController.ts - checksum: d8fe74404c80bf435459f4d20427a661fb622f0ee9f754345616abd346b98d14 -- filename: machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.ts - checksum: 237a2640b7db70770d65da67c79f2929581e32f1162517e50b8d37e409f3387d -- filename: machines/store.ts - checksum: b9884f86b498dfbff75816d1f0d521c79971c8c28afa7824122d025b2699cdc4 -- filename: shared/cryptoutil/cryptoUtil.ts - checksum: b785ff3f01ab9530119072c4d38195048bfeee6155c54ea7dd031559acb722f3 + checksum: 71917c8c543a4a5b7ab61df259b785d233a80718123b0c8edf6ec81e1b3a81e0 - filename: shared/telemetry/TelemetryUtils.js checksum: ffe9aac2dcc590b98b0d588885c088eff189504ade653a77f74b67312bfd27ad - filename: shared/fileStorage.ts checksum: 07cb337dc1d5b0f0eef56270ac4f4f589260ee5e490183c024cf98a2aeafb139 - filename: shared/storage.ts checksum: c8d874aa373bdf526bf59192139822f56915e702ef673bac4e0d7549b0fea3d0 - checksum: f9711b617b986af9bb733a31373e49494667ef07b74988fbf09688cb50ca73bd +- filename: screens/Home/IntroSlidersScreen.tsx + checksum: 72ef913857448ef05763e52e32356faa2d1f3de8130a1c638d1897f44823031f +- filename: shared/commonUtil.ts + checksum: 01c3fdcd2f1c1757eae0c6a27fe04eb70c2aaf8660c604f3301997484592b66c +- filename: screens/Home/MyVcs/GetIdInputModal.tsx + checksum: 5c736ed79a372d0ffa7c02eb33d0dc06edbbb08d120978ff287f5f06cd6c7746 +- filename: shared/openId4VCI/Utils.ts + checksum: 2bd39d84099d700e5bddeebe87dfb3b0e3075edc0a4d06ce48b428b0a85e238f +- filename: machines/issuersMachine.ts + checksum: b925df13236145867fc7a1a2a703faca854e8c937dac9451008399e3937592fb +- filename: machines/issuersMachine.typegen.ts + checksum: f5e2c89f9029b1e590173e37b2cf6586d5229ecb7d4dfd4c5f050f9416d3c1cd - filename: machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.ts checksum: eec77ca61540327ff7cab3489ebdfd47aa373fd20b3ff87a6c322cd48d35fe8f - filename: machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.typegen.ts checksum: f1f504bd8c14496ee71f8eb7f40d54411cc05be03347d644dcc2cca187a20678 -version: "" +- filename: machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.ts + checksum: 237a2640b7db70770d65da67c79f2929581e32f1162517e50b8d37e409f3387d +- filename: machines/store.ts + checksum: 0695d833df9ec1e1f6ae2bd81631630bb1039dec387718acb153bcb843c952cd +- filename: shared/cryptoutil/cryptoUtil.ts + checksum: b785ff3f01ab9530119072c4d38195048bfeee6155c54ea7dd031559acb722f3 \ No newline at end of file diff --git a/components/ActivityLogText.strings.json b/components/ActivityLogText.strings.json deleted file mode 100644 index aea85f320c..0000000000 --- a/components/ActivityLogText.strings.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "VC_SHARED": "shared", - "VC_RECEIVED": "received", - "VC_RECEIVED_NOT_SAVED": "received was not saved", - "VC_DELETED": "deleted", - "VC_DOWNLOADED": "downloaded", - "VC_REVOKED": "revoked", - "VC_SHARED_WITH_VERIFICATION_CONSENT": "shared. Consent is given for presence verification", - "VC_RECEIVED_WITH_PRESENCE_VERIFIED": "received. Presence verified", - "VC_RECEIVED_BUT_PRESENCE_VERIFICATION_FAILED": "received. Presence verification failed", - "PRESENCE_VERIFIED_AND_VC_SHARED": "verified and shared", - "PRESENCE_VERIFICATION_FAILED": "verification failed", - "QRLOGIN_SUCCESFULL": "QRLogin successful", - "WALLET_BINDING_SUCCESSFULL": "Activation successful", - "WALLET_BINDING_FAILURE": "Activation failed", - "VC_REMOVED": "Removed from wallet", - "TAMPERED_VC_REMOVED": "Some cards removed due to malicious activity" -} \ No newline at end of file diff --git a/components/DeviceInfoList.strings.json b/components/DeviceInfoList.strings.json deleted file mode 100644 index c532dd34c7..0000000000 --- a/components/DeviceInfoList.strings.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "requestedBy": "Requested by", - "sentBy": "Sent by", - "deviceRefNumber": "Device reference number", - "name": "Name" -} \ No newline at end of file diff --git a/components/EditableListItem.tsx b/components/EditableListItem.tsx index 847b8a30e8..4a6443ee8a 100644 --- a/components/EditableListItem.tsx +++ b/components/EditableListItem.tsx @@ -38,16 +38,16 @@ export const EditableListItem: React.FC = props => { /> - + {props.title} - {props.content} + {props.content} void; progress?: boolean; errorMessage?: string; + titleColor: string; } interface ListItemProps { diff --git a/components/FaceScanner.strings.json b/components/FaceScanner.strings.json deleted file mode 100644 index 9e26dfeeb6..0000000000 --- a/components/FaceScanner.strings.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/components/FaceScanner.tsx b/components/FaceScanner.tsx index b32c1cc0ec..077b1b8d06 100644 --- a/components/FaceScanner.tsx +++ b/components/FaceScanner.tsx @@ -26,6 +26,7 @@ import {GlobalContext} from '../shared/GlobalContext'; import {selectIsActive} from '../machines/app'; import {RotatingIcon} from './RotatingIcon'; import {Theme} from './ui/styleUtils'; +import {isIOS} from '../shared/constants'; export const FaceScanner: React.FC = props => { const {t} = useTranslation('FaceScanner'); @@ -130,7 +131,7 @@ export const FaceScanner: React.FC = props => { )} {/* TODO: remove warning when iOS SDK is ready */} - {Platform.OS === 'ios' && ( + {isIOS() && ( (face-matching in iOS is mocked) diff --git a/components/GlobalContextProvider.tsx b/components/GlobalContextProvider.tsx index d6b1af9c5b..94d8a2aef2 100644 --- a/components/GlobalContextProvider.tsx +++ b/components/GlobalContextProvider.tsx @@ -1,8 +1,9 @@ import React from 'react'; import {useInterpret} from '@xstate/react'; -import {appMachine, logState} from '../machines/app'; +import {appMachine} from '../machines/app'; import {GlobalContext} from '../shared/GlobalContext'; +import {logState} from '../shared/commonUtil'; export const GlobalContextProvider: React.FC = props => { const appService = useInterpret(appMachine, {devTools: __DEV__}); diff --git a/components/OIDcAuth.strings.json b/components/OIDcAuth.strings.json deleted file mode 100644 index 6f2ae56729..0000000000 --- a/components/OIDcAuth.strings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "title": "OIDC Authentication", - "text": "To be replaced with the OIDC provider UI", - "verify": "Verify" -} \ No newline at end of file diff --git a/components/PasscodeVerify.strings.json b/components/PasscodeVerify.strings.json deleted file mode 100644 index 4d6fc21fb1..0000000000 --- a/components/PasscodeVerify.strings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "passcodeMismatchError": "Passcode did not match." -} \ No newline at end of file diff --git a/components/QrScanner.strings.json b/components/QrScanner.strings.json deleted file mode 100644 index 805911b63a..0000000000 --- a/components/QrScanner.strings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "missingPermissionText": "This app uses the camera to scan the QR code of another device.", - "allowCameraButton": "Allow access to camera" -} \ No newline at end of file diff --git a/components/VC/MosipVCItem/MosipVCItemContent.tsx b/components/VC/MosipVCItem/MosipVCItemContent.tsx index bef5510a5e..090aeb61c8 100644 --- a/components/VC/MosipVCItem/MosipVCItemContent.tsx +++ b/components/VC/MosipVCItem/MosipVCItemContent.tsx @@ -323,7 +323,7 @@ export const MosipVCItemContent: React.FC< function faceImageSource() { return !verifiableCredential - ? Theme.ProfileIcon + ? Theme.cardFaceIcon : { uri: props.vcMetadata.isFromOpenId4VCI() ? verifiableCredential?.credentialSubject.face diff --git a/components/VC/MosipVCItem/MosipVCItemDetails.tsx b/components/VC/MosipVCItem/MosipVCItemDetails.tsx index 7c6cf99779..014013ade8 100644 --- a/components/VC/MosipVCItem/MosipVCItemDetails.tsx +++ b/components/VC/MosipVCItem/MosipVCItemDetails.tsx @@ -49,7 +49,7 @@ const getProfileImage = ( return {uri: props.vc?.credential.biometrics.face}; } } - return Theme.ProfileIcon; + return Theme.cardFaceIcon; }; export const MosipVCItemDetails: React.FC< diff --git a/components/VcDetails.strings.json b/components/VcDetails.strings.json deleted file mode 100644 index d6e3189a49..0000000000 --- a/components/VcDetails.strings.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "generatedOn": "Generated On", - "status": "Status", - "valid": "Valid", - "photo": "Photo", - "fullName": "Full Name", - "gender": "Gender", - "dateOfBirth": "Date of Birth", - "phoneNumber": "Phone Number", - "email": "Email", - "address": "Address", - "reasonForSharing": "Reason for sharing", - "idType": "ID Type", - "id": "Id", - "nationalCard": "National Card", - "uin": "UIN", - "vid": "VID", - "enableVerification": "Enable Verification", - "profileAuthenticated": "Profile is authenticated!", - "offlineAuthDisabledHeader": "Offline Authentication disabled!", - "offlineAuthDisabledMessage": "Click 'Enable Authentication' to enable this credentials to be used for offline authentication." -} diff --git a/components/ui/Loader.tsx b/components/ui/Loader.tsx index 26856fa1bc..ccb115643d 100644 --- a/components/ui/Loader.tsx +++ b/components/ui/Loader.tsx @@ -26,7 +26,7 @@ export const Loader: React.FC = props => { {props.subTitle && ( {props.subTitle} diff --git a/components/ui/Modal.tsx b/components/ui/Modal.tsx index 56d96d7e8f..713a777ff3 100644 --- a/components/ui/Modal.tsx +++ b/components/ui/Modal.tsx @@ -57,7 +57,7 @@ export const Modal: React.FC = props => { color={ props.headerLabelColor ? props.headerLabelColor - : Theme.Colors.profileLanguageValue + : Theme.Colors.textLabel }> {props.headerLabel} diff --git a/components/ui/themes/DefaultTheme.ts b/components/ui/themes/DefaultTheme.ts index 3ad8d6a86f..2822276a74 100644 --- a/components/ui/themes/DefaultTheme.ts +++ b/components/ui/themes/DefaultTheme.ts @@ -1,6 +1,7 @@ /* eslint-disable sonarjs/no-duplicate-string */ import {Dimensions, Platform, StyleSheet, ViewStyle} from 'react-native'; import {Spacing} from '../styleUtils'; +import {isIOS} from '../../../shared/constants'; const Colors = { Black: '#000000', @@ -61,11 +62,7 @@ export const DefaultTheme = { borderBottomColor: Colors.Grey6, whiteBackgroundColor: Colors.White, lightGreyBackgroundColor: Colors.LightGrey, - profileLanguageValue: Colors.Grey, aboutVersion: Colors.Gray40, - profileAuthFactorUnlock: Colors.Grey, - profileLabel: Colors.Black, - profileValue: Colors.Grey, switchHead: Colors.Orange, switchTrackTrue: Colors.LightOrange, switchTrackFalse: Colors.Grey, @@ -89,7 +86,6 @@ export const DefaultTheme = { OnboardingCloseIcon: Colors.White, WarningIcon: Colors.Warning, DefaultToggle: Colors.LightOrange, - ProfileIconBg: Colors.LightOrange, GrayText: Colors.GrayText, errorGrayText: Colors.mediumDarkGrey, gradientBtn: ['#F59B4B', '#E86E04'], @@ -108,6 +104,8 @@ export const DefaultTheme = { statusMessage: Colors.Gray40, blackIcon: Colors.Black, uncheckedIcon: Colors.uncheckedIcon, + settingsLabel: Colors.Black, + chevronRightColor: Colors.Grey, }, Styles: StyleSheet.create({ title: { @@ -499,9 +497,9 @@ export const DefaultTheme = { width: Dimensions.get('window').width * 0.32, borderBottomWidth: 1, marginBottom: 2, - borderColor: Platform.OS === 'ios' ? 'transparent' : Colors.Grey, - bottom: Platform.OS === 'ios' ? 50 : 24, - height: Platform.OS === 'ios' ? 100 : 'auto', + borderColor: isIOS() ? 'transparent' : Colors.Grey, + bottom: isIOS() ? 50 : 24, + height: isIOS() ? 100 : 'auto', }, idInputBottom: { borderBottomColor: Colors.Orange, @@ -1236,7 +1234,7 @@ export const DefaultTheme = { CardBackground: require('../../../assets/card_bg.png'), OpenCard: require('../../../assets/card_bg.png'), activationPending: require('../../../assets/pending_activation.png'), - ProfileIcon: require('../../../assets/placeholder-photo.png'), + cardFaceIcon: require('../../../assets/placeholder-photo.png'), MosipSplashLogo: require('../../../assets/icon.png'), MosipLogo: require('../../../assets/mosip-logo.png'), CameraFlipIcon: require('../../../assets/camera-flip-icon.png'), @@ -1306,17 +1304,16 @@ export const DefaultTheme = { }; function generateBoxShadowStyle() { - if (Platform.OS === 'ios') { + if (isIOS()) { return { shadowColor: '#000', shadowOffset: {width: 1, height: 1.2}, shadowOpacity: 0.3, shadowRadius: 2.5, }; - } else if (Platform.OS === 'android') { - return { - elevation: 4, - shadowColor: '#000', - }; } + return { + elevation: 4, + shadowColor: '#000', + }; } diff --git a/components/ui/themes/PurpleTheme.ts b/components/ui/themes/PurpleTheme.ts index e25ab9f439..348cdc44ff 100644 --- a/components/ui/themes/PurpleTheme.ts +++ b/components/ui/themes/PurpleTheme.ts @@ -1,6 +1,7 @@ /* eslint-disable sonarjs/no-duplicate-string */ import {Dimensions, Platform, StyleSheet, ViewStyle} from 'react-native'; import {Spacing} from '../styleUtils'; +import {isIOS} from '../../../shared/constants'; const Colors = { Black: '#231F20', @@ -64,11 +65,7 @@ export const PurpleTheme = { whiteBackgroundColor: Colors.White, lightGreyBackgroundColor: Colors.LightGrey, errorGrayText: Colors.mediumDarkGrey, - profileLanguageValue: Colors.Grey, aboutVersion: Colors.Gray40, - profileAuthFactorUnlock: Colors.Grey, - profileLabel: Colors.Black, - profileValue: Colors.Grey, switchHead: Colors.Purple, switchTrackTrue: Colors.LightPurple, switchTrackFalse: Colors.Grey, @@ -92,7 +89,6 @@ export const PurpleTheme = { OnboardingCloseIcon: Colors.White, WarningIcon: Colors.Warning, DefaultToggle: Colors.LightPurple, - ProfileIconBg: Colors.LightPurple, GrayText: Colors.GrayText, gradientBtn: Colors.GradientColors, dotColor: Colors.dorColor, @@ -110,6 +106,8 @@ export const PurpleTheme = { statusMessage: Colors.Gray40, blackIcon: Colors.Black, uncheckedIcon: Colors.uncheckedIcon, + settingsLabel: Colors.Black, + chevronRightColor: Colors.Grey, }, Styles: StyleSheet.create({ title: { @@ -501,9 +499,9 @@ export const PurpleTheme = { width: Dimensions.get('window').width * 0.32, borderBottomWidth: 1, marginBottom: 2, - borderColor: Platform.OS === 'ios' ? 'transparent' : Colors.Grey, - bottom: Platform.OS === 'ios' ? 50 : 24, - height: Platform.OS === 'ios' ? 100 : 'auto', + borderColor: isIOS() ? 'transparent' : Colors.Grey, + bottom: isIOS() ? 50 : 24, + height: isIOS() ? 100 : 'auto', }, idInputBottom: { borderBottomColor: Colors.Orange, @@ -1234,7 +1232,7 @@ export const PurpleTheme = { CardBackground: require('../../../assets/card_bg.png'), OpenCard: require('../../../assets/card_bg.png'), activationPending: require('../../../assets/pending_activation.png'), - ProfileIcon: require('../../../purpleAssets/profile_icon.png'), + cardFaceIcon: require('../../../purpleAssets/profile_icon.png'), MosipSplashLogo: require('../../../assets/icon.png'), MosipLogo: require('../../../assets/mosip-logo.png'), CameraFlipIcon: require('../../../assets/camera-flip-icon.png'), @@ -1304,17 +1302,16 @@ export const PurpleTheme = { }; function generateBoxShadowStyle() { - if (Platform.OS === 'ios') { + if (isIOS()) { return { shadowColor: '#000', shadowOffset: {width: 1, height: 1.2}, shadowOpacity: 0.3, shadowRadius: 2.5, }; - } else if (Platform.OS === 'android') { - return { - elevation: 4, - shadowColor: '#000', - }; } + return { + elevation: 4, + shadowColor: '#000', + }; } diff --git a/locales/ara.json b/locales/ara.json index 237416ce7a..5b263d0b2b 100644 --- a/locales/ara.json +++ b/locales/ara.json @@ -357,11 +357,6 @@ "confirmPasscode": "قم بتأكيد رمز المرور", "enterPasscode": "أدخل رمز المرور الخاص" }, - "AppMetaData": { - "header": "حول إنجي", - "version": "الإصدار", - "useBle": "مدعوم من BLE" - }, "QrLogin": { "title": "QR تسجيل الدخول", "alignQr": "قم بمحاذاة رمز الاستجابة السريعة داخل الإطار للمسح الضوئي", diff --git a/locales/en.json b/locales/en.json index a180132747..9d988ac6af 100644 --- a/locales/en.json +++ b/locales/en.json @@ -364,11 +364,6 @@ "confirmPasscode": "Confirm passcode", "enterPasscode": "Enter your passcode" }, - "AppMetaData": { - "header": "About Inji", - "version": "Version", - "useBle": "Powered by BLE" - }, "QrLogin": { "title": "QR Login", "alignQr": "Align the QR code within the frame to scan", diff --git a/locales/fil.json b/locales/fil.json index dae27bd6d6..7afa6f1827 100644 --- a/locales/fil.json +++ b/locales/fil.json @@ -356,11 +356,6 @@ "confirmPasscode": "Kumpirmahin ang passcode", "enterPasscode": "Ilagay ang iyong passcode" }, - "AppMetaData": { - "header": "Tungkol kay Inji", - "version": "Bersyon", - "useBle": "Pinapatakbo ng BLE" - }, "QrLogin": { "title": "QR Login", "alignQr": "I-align ang QR code sa loob ng frame para i-scan", diff --git a/locales/hin.json b/locales/hin.json index 9b4cb72bc9..7a84f002a4 100644 --- a/locales/hin.json +++ b/locales/hin.json @@ -356,11 +356,6 @@ "confirmPasscode": "पासकोड की पुष्टि करें", "enterPasscode": "अपना पासकोड प्रविष्ट करें" }, - "AppMetaData": { - "header": "इंजी के बारे में", - "version": "संस्करण", - "useBle": "BLE द्वारा संचालित" - }, "QrLogin": { "title": "क्यूआर लॉगिन", "alignQr": "स्कैन करने के लिए फ्रेम के भीतर क्यूआर कोड को संरेखित करें", diff --git a/locales/kan.json b/locales/kan.json index e7ba9b2020..208f50ca95 100644 --- a/locales/kan.json +++ b/locales/kan.json @@ -353,11 +353,6 @@ "confirmPasscode": "ನಿಮ್ಮ ಪಾಸ್ಕೋಡ್ ಅನ್ನು ದೃಢೀಕರಿಸಿ", "enterPasscode": "ನಿಮ್ಮ ಪಾಸ್ಕೋಡ್ ನಮೂದಿಸಿ" }, - "AppMetaData": { - "header": "ಇಂಜಿ ಬಗ್ಗೆ", - "version": "ಆವೃತ್ತಿ", - "useBle": "BLE ನಿಂದ ನಡೆಸಲ್ಪಡುತ್ತಿದೆ" - }, "QrLogin": { "title": "QR ಲಾಗಿನ್", "alignQr": "ಸ್ಕ್ಯಾನ್ ಮಾಡಲು ಚೌಕಟ್ಟಿನೊಳಗೆ QR ಕೋಡ್ ಅನ್ನು ಹೊಂದಿಸಿ", diff --git a/locales/spa.json b/locales/spa.json index 820639c392..b37dee0759 100644 --- a/locales/spa.json +++ b/locales/spa.json @@ -254,11 +254,6 @@ "confirmPasscode": "Confirma tu código de acceso", "enterPasscode": "Ingresa tu código de acceso" }, - "AppMetaData": { - "header": "Acerca de Inji", - "version": "Versión", - "useBle": "Impulsado por BLE" - }, "SettingScreen": { "header": "Ajustes", "injiAsVerifierApp": "Inji como aplicación verificadora", @@ -734,11 +729,6 @@ "confirmPasscode": "Confirma tu código de acceso", "enterPasscode": "Ingresa tu código de acceso" }, - "AppMetaData": { - "header": "Acerca de Inji", - "version": "Versión", - "useBle": "Impulsado por BLE" - }, "SettingScreen": { "header": "Ajustes", "injiAsVerifierApp": "Inji como aplicación verificadora", diff --git a/locales/tam.json b/locales/tam.json index 6efc6e4524..b41845753e 100644 --- a/locales/tam.json +++ b/locales/tam.json @@ -353,11 +353,6 @@ "confirmPasscode": "கடவுக்குறியீட்டை உறுதிப்படுத்தவும்", "enterPasscode": "உங்கள் கடவுக்குறியீட்டை உள்ளிடவும்" }, - "AppMetaData": { - "header": "இன்ஜி பற்றி", - "version": "பதிப்பு", - "useBle": "BLE ஆல் இயக்கப்படுகிறது" - }, "QrLogin": { "title": "QR உள்நுழைவு", "alignQr": "ஸ்கேன் செய்ய ஃப்ரேமுக்குள் QR குறியீட்டை சீரமைக்கவும்", diff --git a/machines/app.ts b/machines/app.ts index fc86c93a69..69833e287c 100644 --- a/machines/app.ts +++ b/machines/app.ts @@ -1,17 +1,13 @@ import NetInfo, {NetInfoStateType} from '@react-native-community/netinfo'; import {AppState, AppStateStatus, Platform} from 'react-native'; -import { - getDeviceId, - getDeviceName, - getDeviceNameSync, -} from 'react-native-device-info'; -import {EventFrom, spawn, StateFrom, send, assign, AnyState} from 'xstate'; +import {getDeviceId, getDeviceName} from 'react-native-device-info'; +import {assign, EventFrom, send, spawn, StateFrom} from 'xstate'; import {createModel} from 'xstate/lib/model'; import {authMachine, createAuthMachine} from './auth'; import {createSettingsMachine, settingsMachine} from './settings'; import {StoreEvents, storeMachine} from './store'; import {createVcMachine, vcMachine} from './vc'; -import {createActivityLogMachine, activityLogMachine} from './activityLog'; +import {activityLogMachine, createActivityLogMachine} from './activityLog'; import { createRequestMachine, requestMachine, @@ -20,19 +16,19 @@ import {createScanMachine, scanMachine} from './bleShare/scan/scanMachine'; import {createRevokeMachine, revokeVidsMachine} from './revoke'; import {pure, respond} from 'xstate/lib/actions'; import {AppServices} from '../shared/GlobalContext'; -import {request} from '../shared/request'; import { changeCrendetialRegistry, - SETTINGS_STORE_KEY, - MIMOTO_BASE_URL, - ESIGNET_BASE_URL, changeEsignetUrl, + ESIGNET_BASE_URL, + isAndroid, + MIMOTO_BASE_URL, + SETTINGS_STORE_KEY, } from '../shared/constants'; +import {logState} from '../shared/commonUtil'; const model = createModel( { info: {} as AppInfo, - backendInfo: {} as BackendInfo, serviceRefs: {} as AppServices, isReadError: false, isDecryptError: false, @@ -51,7 +47,6 @@ const model = createModel( REQUEST_DEVICE_INFO: () => ({}), READY: (data?: unknown) => ({data}), APP_INFO_RECEIVED: (info: AppInfo) => ({info}), - BACKEND_INFO_RECEIVED: (info: BackendInfo) => ({info}), STORE_RESPONSE: (response: unknown) => ({response}), RESET_KEY_INVALIDATE_ERROR_DISMISS: () => ({}), }, @@ -135,19 +130,8 @@ export const appMachine = model.createMachine( }, on: { APP_INFO_RECEIVED: { - target: 'devinfo', - actions: ['setAppInfo'], - }, - }, - }, - devinfo: { - invoke: { - src: 'getBackendInfo', - }, - on: { - BACKEND_INFO_RECEIVED: { target: '#ready', - actions: ['setBackendInfo'], + actions: ['setAppInfo'], }, }, }, @@ -286,7 +270,7 @@ export const appMachine = model.createMachine( scanMachine.id, ); - if (Platform.OS === 'android') { + if (isAndroid()) { serviceRefs.request = spawn( createRequestMachine(serviceRefs), requestMachine.id, @@ -310,7 +294,7 @@ export const appMachine = model.createMachine( context.serviceRefs.activityLog.subscribe(logState); context.serviceRefs.scan.subscribe(logState); - if (Platform.OS === 'android') { + if (isAndroid()) { context.serviceRefs.request.subscribe(logState); } @@ -322,10 +306,6 @@ export const appMachine = model.createMachine( info: (_, event) => event.info, }), - setBackendInfo: model.assign({ - backendInfo: (_, event) => event.info, - }), - loadCredentialRegistryHostFromStorage: send( StoreEvents.GET(SETTINGS_STORE_KEY), { @@ -363,23 +343,6 @@ export const appMachine = model.createMachine( callback(model.events.APP_INFO_RECEIVED(appInfo)); }, - getBackendInfo: () => async callback => { - let backendInfo = { - application: { - name: '', - version: '', - }, - build: {}, - config: {}, - }; - try { - backendInfo = await request('GET', '/residentmobileapp/info'); - callback(model.events.BACKEND_INFO_RECEIVED(backendInfo)); - } catch { - callback(model.events.BACKEND_INFO_RECEIVED(backendInfo)); - } - }, - checkFocusState: () => callback => { const changeHandler = (newState: AppStateStatus) => { switch (newState) { @@ -398,8 +361,7 @@ export const appMachine = model.createMachine( AppState.addEventListener('change', changeHandler); - // android only - if (Platform.OS === 'android') { + if (isAndroid()) { AppState.addEventListener('blur', blurHandler); AppState.addEventListener('focus', focusHandler); } @@ -407,7 +369,7 @@ export const appMachine = model.createMachine( return () => { AppState.removeEventListener('change', changeHandler); - if (Platform.OS === 'android') { + if (isAndroid()) { AppState.removeEventListener('blur', blurHandler); AppState.removeEventListener('focus', focusHandler); } @@ -432,25 +394,11 @@ interface AppInfo { deviceName: string; } -interface BackendInfo { - application: { - name: string; - version: string; - }; - build: object; - config: object; -} - type State = StateFrom; export function selectAppInfo(state: State) { return state.context.info; } - -export function selectBackendInfo(state: State) { - return state.context.backendInfo; -} - export function selectIsReady(state: State) { return state.matches('ready'); } @@ -467,28 +415,6 @@ export function selectIsFocused(state: State) { return state.matches('ready.focus'); } -export function logState(state: AnyState) { - const data = JSON.stringify( - state.event, - (key, value) => { - if (key === 'type') return undefined; - if (typeof value === 'string' && value.length >= 100) { - return value.slice(0, 100) + '...'; - } - return value; - }, - 2, - ); - console.log( - `[${getDeviceNameSync()}] ${state.machine.id}: ${ - state.event.type - } -> ${state.toStrings().pop()}\n${ - data.length > 300 ? data.slice(0, 300) + '...' : data - } - `, - ); -} - export function selectIsReadError(state: State) { return state.context.isReadError; } diff --git a/machines/biometrics.ts b/machines/biometrics.ts index 47eea18751..648b8646e5 100644 --- a/machines/biometrics.ts +++ b/machines/biometrics.ts @@ -2,6 +2,7 @@ import {createModel} from 'xstate/lib/model'; import * as LocalAuthentication from 'expo-local-authentication'; import {EventFrom, MetaObject, StateFrom} from 'xstate'; import {Platform} from 'react-native'; +import {isAndroid} from '../shared/constants'; // ----- CREATE MODEL --------------------------------------------------------- const model = createModel( @@ -99,7 +100,7 @@ export const biometricsMachine = model.createMachine( authenticating: { invoke: { src: () => async () => { - if (Platform.OS === 'android') { + if (isAndroid()) { await LocalAuthentication.cancelAuthenticate(); } const res = await LocalAuthentication.authenticateAsync({ diff --git a/machines/bleShare/request/requestMachine.ts b/machines/bleShare/request/requestMachine.ts index 8ccb26f34c..5282ad7093 100644 --- a/machines/bleShare/request/requestMachine.ts +++ b/machines/bleShare/request/requestMachine.ts @@ -14,7 +14,7 @@ import {getDeviceNameSync} from 'react-native-device-info'; import {StoreEvents} from '../../store'; import {VC} from '../../../types/VC/ExistingMosipVC/vc'; import {AppServices} from '../../../shared/GlobalContext'; -import {RECEIVED_VCS_STORE_KEY} from '../../../shared/constants'; +import {isAndroid, RECEIVED_VCS_STORE_KEY} from '../../../shared/constants'; import {ActivityLogEvents, ActivityLogType} from '../../activityLog'; import {VcEvents} from '../../vc'; import {subscribe} from '../../../shared/openIdBLE/verifierEventHandler'; @@ -736,7 +736,7 @@ export const requestMachine = }, checkNearByDevicesPermission: () => callback => { - if (Platform.OS === 'android' && Platform.Version >= 31) { + if (isAndroid() && Platform.Version >= 31) { const result = checkMultiple([ PERMISSIONS.ANDROID.BLUETOOTH_ADVERTISE, PERMISSIONS.ANDROID.BLUETOOTH_CONNECT, diff --git a/machines/bleShare/scan/scanMachine.ts b/machines/bleShare/scan/scanMachine.ts index 98c314e2fd..ffe291e2f3 100644 --- a/machines/bleShare/scan/scanMachine.ts +++ b/machines/bleShare/scan/scanMachine.ts @@ -17,7 +17,7 @@ import {getDeviceNameSync} from 'react-native-device-info'; import {VC, VerifiablePresentation} from '../../../types/VC/ExistingMosipVC/vc'; import {AppServices} from '../../../shared/GlobalContext'; import {ActivityLogEvents, ActivityLogType} from '../../activityLog'; -import {MY_LOGIN_STORE_KEY} from '../../../shared/constants'; +import {isAndroid, isIOS, MY_LOGIN_STORE_KEY} from '../../../shared/constants'; import {subscribe} from '../../../shared/openIdBLE/walletEventHandler'; import { check, @@ -38,7 +38,6 @@ import {StoreEvents} from '../../store'; import {WalletDataEvent} from 'react-native-tuvali/lib/typescript/types/events'; import {BLEError} from '../types'; import Storage from '../../../shared/storage'; -import {logState} from '../../app'; import {VCMetadata} from '../../../shared/VCMetadata'; import { getStartEventData, @@ -46,6 +45,7 @@ import { sendStartEvent, sendEndEvent, } from '../../../shared/telemetry/TelemetryUtils'; +import {logState} from '../../../shared/commonUtil'; const {wallet, EventTypes, VerificationStatus} = tuvali; @@ -721,7 +721,7 @@ export const scanMachine = value: context.linkCode, }), openBluetoothSettings: () => { - Platform.OS === 'android' + isAndroid() ? BluetoothStateManager.openSettings().catch() : Linking.openURL('App-Prefs:Bluetooth'); }, @@ -905,7 +905,7 @@ export const scanMachine = // Passing Granted for android since permission status is always granted even if its denied. let response: PermissionStatus = RESULTS.GRANTED; - if (Platform.OS === 'ios') { + if (isIOS()) { response = await check(PERMISSIONS.IOS.BLUETOOTH_PERIPHERAL); } @@ -1107,9 +1107,9 @@ export const scanMachine = } }, - uptoAndroid11: () => Platform.OS === 'android' && Platform.Version < 31, + uptoAndroid11: () => isAndroid() && Platform.Version < 31, - isIOS: () => Platform.OS === 'ios', + isIOS: () => isIOS(), isMinimumStorageRequiredForAuditEntryReached: (_context, event) => Boolean(event.data), diff --git a/machines/issuersMachine.ts b/machines/issuersMachine.ts index 71844cd18c..7d5607efed 100644 --- a/machines/issuersMachine.ts +++ b/machines/issuersMachine.ts @@ -1,7 +1,11 @@ import {authorize, AuthorizeResult} from 'react-native-app-auth'; import {assign, EventFrom, send, sendParent, StateFrom} from 'xstate'; import {createModel} from 'xstate/lib/model'; -import {MY_VCS_STORE_KEY} from '../shared/constants'; +import { + MY_VCS_STORE_KEY, + NETWORK_REQUEST_FAILED, + REQUEST_TIMEOUT, +} from '../shared/constants'; import {StoreEvents} from './store'; import {AppServices} from '../shared/GlobalContext'; import NetInfo from '@react-native-community/netinfo'; @@ -23,8 +27,8 @@ import { updateCredentialInformation, constructAuthorizationConfiguration, getVCMetadata, + Issuers_Key_Ref, } from '../shared/openId4VCI/Utils'; -import {NETWORK_REQUEST_FAILED, REQUEST_TIMEOUT} from '../shared/constants'; import {VCMetadata} from '../shared/VCMetadata'; import { getEndEventData, @@ -71,7 +75,6 @@ const model = createModel( export const IssuerScreenTabEvents = model.events; export const Issuer_Tab_Ref_Id = 'issuersMachine'; -export const Issuers_Key_Ref = 'OpenId4VCI_KeyPair'; export const IssuersMachine = model.createMachine( { /** @xstate-layout N4IgpgJg5mDOIC5QEtawK5gE6wLIEMBjAC2QDswA6CVABwBt8BPASTUxwGIIB7Cy8gDceAayqoM2PEVL8asBszaScCIT0L4ALsj4BtAAwBdQ0cShaPWMh19zIAB6IALAEYAnJWfuAzM4BsAKwAHN7BwQDsfgA0IEyIAEw+Ea6UBgkRwT7uEekGrhHOAL5FsRIc0iTkVPKKrOxSnNhYPFiUiloAZq0AtgINOARVcnSM9SqwamTCmrZkpqb2ltZz9k4Izgme3n5Boe7hUc6x8QgJ3gZpgT6BgRH+yYWBJWUDlbJUza2cACoASgBNAD6AEEAOIglgAOUWSBAyxsujIaxcWy8vgCITCkRicUSIQSlGyCQMETu7n84QKLxA5SkQw+lC+WF+gNBEOhelcZjhCNWcPWrgSJ0QQppdMGMmqTKwLRZ-2B4MhMISPIsVkRdgFooMvjS-jc9wezl1ARFZwiCUClFcN3czmcKWuPnFbwZ0uZnD+AFEAMren5A71-P4AeT+sPVKyRKIQrgMwX8lASCWCgVcgW8lt15oyEU8CSCloz6WcN38rom7v4sDA9DAhB0ZCgyg4nAAIqGAOpQgAyoZB7aBLHbkfhGv5oHWPgMBmclEigQM-lTVpyc9z+R8yfzriyPhTS4zlYq1aotfrjfILYGnH9ve9AGEft6hyxfb6AKrBsd8mPahBAmFPEEB8VwhS8XVkgKA5dXcE96SlOQeAAdzIegeHwCBW2wR8+E6ZAoG4PhxGmURxDdJCalQ9DMOwgY8LIAioCmGZtCRBZjCWCd-ynUVgNOMVSlpSjhmotCMKwnCsEY5imllVp2kYLpen6KsqOoGjJPolRZMI1iNHY-RjF-HitT4jYUwXZwgMpFMfHCGcIlze15zuFdghyA5UweBDJTEygSAbEQWDILRsAoLRiP4dQxEC4hgtC8KsEi0zo3MxxRVuQlLUCdxdUzbIhX8c14w8Iky1ucI1zTYI-PeaUgsIEKwoisAot4GKyLipqWuS1LuW49LkQA4I0SFdxwOXO1-HSUrbUuLZSX8XwMn8Vwy3qs94sS1qUva+S5SU7RuiwPpeqStqtDSzURos4IIMpB5i1moCHPNSbgi8QIDXcPLcltDIto0i69simU5QSVlFQ5GEuN5My7syuNkiTfJJvyDwiyCUrZ2tPwbimoDMhuYGAtobBTp6EF0C0YhWmQAAvIyyGi0jhDiiUGv4CmsCpmm6YZ5m5gM2YOJM+Go1u2NbJtFbJoyN7U3cc0V2tbxXH8FdHSPe0ycZXn+dp+msCZlnDsUjoqbU08NMN3oBZNs2RfUMXjJMSXx2GmXNbl9wFbJJJlfNB6bUiLYbiW-KIgifXpXts7HaF83mWOlSzptxDycph3jeTl2yLd+YTMGhHvYA64k01-2hUDg9PNK5J52CAwZ3TQpwNj4Sue23qAGkwCYAAFfBkBZR8AAknz7oE++9YEh8hCNPb-DLBTnKuPD+h15cKc0qptDaMcibxnm70TGX7weR7HzhJ+n2f56BReWAjUupcnZH4x8Tf-czAJ-Z7xAskS4YFiQeXOJ5F0591IBRgBQLA2gwAD2HqPFknV2bkUzv5Rk8DsBIJQTfLAosWacTVF7aWAECjZEoPlTy6Z1o5HOOaPwqRqoOQyGNTMKY478DwYg8KhC0FswEN1CisDcFgAQQQ6+aCSFzAWO-Chn9BRRE8HQv6msPCWmOCBFMhI0xBH8DHMkOQyS8PErRLCj4sCQCkTofA9BYAiNiuI22AVeASTojYuxYVkCOMmK7UhEtyGryRusGyER9SWgpIVCkYFAi5j3EmG4CZW4OSbsUGB7jGSeKsRAHxEB7H+KcRbNoVtVI9w0nk7ShTikBPkeLD2oTEaxkidErYQQyzxIzLmThlBKSrQzJsKkFjNJeOsbYopfiAl3xBFCR83pew3RUS4R0HTYndIeL0kCe4ogVSyB4ByMcNpjMENgZAnQmDXjqTM+gLixHYO5lQc5psrk3KmfU+gjT3YrN4l-eMnguF3HOAkDMDlEl6ITFXYxDosjnCONA14EjpSvMudc5styHH3NThUjOVSApoveZiz5dyfnF2aUNShFkppAqtCCzY4K0x9IMNafMDCDgPBJAeMZyAID1jvqGXAQ8HwvlHCvVpVC1ZeG5VsVMUQ9l9JNAM5wY0W6pnjJEXl-KwBzIWUsv5a9RTSs2K3OVOJFV6NtKkG4eVUytx+jymkZAeBFPgHCAlHwqWrIQAAWh-uaX1ZIw6WnuJVKIK0EhjNqGMaS7qP7-PWJaXMP0okmhTPmGOFJ4wVmyVnRkzJvWJsQC3IFOQNqJkKPmG4uZMiXF1JSTYhZ0i7DGReBsTYbwqCLUauMu4iRUh+pmIUG0km2gGQURMqNNibTzTg6UNS6LST0lAHt4TEDGJcoWWhI6xreACGSXNyKcmNQSs1S6+0tBrtjGGgZU6XqsqSMEc0ZJtwFRNAUHeGYz7Hvzae3a-V2oQ1aAka9VCwVROhS3PKfhlwFA+mNZMjxcgORskkI9IkUU8xzonPOpthb-LCW0gSoofB+C8GNFaLd4zLhjmMq+qCx5gYsoehcMcbi7g2imVW5H0yqrGjcPwlo6pzueZQfhMjGNYGY1-PwhISQFGeoJlILCwJeHWhmBVFahK-vnchCZBTSXYvjco4tCAch9LU7Va48ZHSUjORc4lUAsUlJk+sQZyYqrrgNFrZ9VrKR3uMR5TWZGf5tq0AzZsbnSO+0NNkNwbhHKQsEv7bcar8pgW8FsUI2r6zRZRhmNIMdVy5Dyuqyz84AhPXsqqlI0aSL5ZgjawdXSR26NOCmX2WxHS6k-Xxs+JQgA */ diff --git a/machines/settings.ts b/machines/settings.ts index 98989cad50..5c1559e08d 100644 --- a/machines/settings.ts +++ b/machines/settings.ts @@ -93,7 +93,6 @@ export const settingsMachine = model.createMachine( }, }, idle: { - entry: ['injiTourGuide'], on: { TOGGLE_BIOMETRIC_UNLOCK: { actions: ['toggleBiometricUnlock', 'storeContext'], @@ -114,6 +113,9 @@ export const settingsMachine = model.createMachine( CANCEL: { actions: ['resetCredentialRegistry'], }, + INJI_TOUR_GUIDE: { + target: 'showInjiTourGuide', + }, ACCEPT_HARDWARE_SUPPORT_NOT_EXISTS: { actions: [ 'updateUserShownWithHardwareKeystoreNotExists', @@ -146,13 +148,6 @@ export const settingsMachine = model.createMachine( }, }, }, - injiTourGuide: { - on: { - INJI_TOUR_GUIDE: { - target: 'showInjiTourGuide', - }, - }, - }, showInjiTourGuide: { on: { BACK: { diff --git a/machines/store.ts b/machines/store.ts index 8342b14379..f36247418b 100644 --- a/machines/store.ts +++ b/machines/store.ts @@ -105,7 +105,7 @@ export const storeMachine = }, on: { KEY_RECEIVED: { - actions: ['setEncryptionKey', 'logKey'], + actions: ['setEncryptionKey'], target: 'ready', }, ERROR: { diff --git a/package.json b/package.json index 6106300c2a..54e435ae0c 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,6 @@ "android:mosip": "react-native run-android --variant=mosipDebug", "ios": "react-native run-ios", "build:android:mosip": "cd android && ./gradlew :app:assembleMosipRelease && cd ..", - "i18n:compile-strings": "node scripts/compile-strings.js", "lint": "eslint . --ext .js,.jsx,.ts,.tsx --fix", "test": "jest", "postinstall": "patch-package && npm run jetify && sh tools/talisman/talisman-precommit.sh" @@ -128,8 +127,7 @@ "name": "mosip-resident-app", "version": "1.0.0", "lint-staged": { - "*.{ts,tsx,js,css,md}": "prettier --write", - "*.strings.json": "node scripts/compile-strings.js" + "*.{ts,tsx,js,css,md}": "prettier --write" }, "overrides": { "react": "18.2.0", diff --git a/screens/AuthScreen.strings.json b/screens/AuthScreen.strings.json deleted file mode 100644 index 0ad0c45659..0000000000 --- a/screens/AuthScreen.strings.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "header": "Would you like to use biometrics to unlock the application?", - "useBiometrics": "Use biometrics", - "usePasscode": "I'd rather use a passcode", - "errors": { - "unavailable": "Device does not support Biometrics", - "unenrolled": "To use Biometrics, please enroll your biometrics in your device settings", - "failed": "Failed to authenticate with Biometrics", - "generic": "There seems to be an error in Biometrics authentication" - } -} \ No newline at end of file diff --git a/screens/BiometricScreen.strings.json b/screens/BiometricScreen.strings.json deleted file mode 100644 index e8fee22343..0000000000 --- a/screens/BiometricScreen.strings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "unlock": "Unlock with biometrics" -} \ No newline at end of file diff --git a/screens/BiometricScreenController.ts b/screens/BiometricScreenController.ts index fab1da8781..8433174c9d 100644 --- a/screens/BiometricScreenController.ts +++ b/screens/BiometricScreenController.ts @@ -29,6 +29,7 @@ import { sendInteractEvent, sendStartEvent, } from '../shared/telemetry/TelemetryUtils'; +import {isAndroid} from '../shared/constants'; export function useBiometricScreen(props: RootRouteProps) { const {appService} = useContext(GlobalContext); @@ -114,7 +115,7 @@ export function useBiometricScreen(props: RootRouteProps) { ]); const checkBiometricsChange = () => { - if (Platform.OS === 'android') { + if (isAndroid()) { RNFingerprintChange.hasFingerPrintChanged().then( async (biometricsHasChanged: boolean) => { //if new biometrics are added, re-enable Biometrics Authentication diff --git a/screens/History/HistoryScreen.strings.json b/screens/History/HistoryScreen.strings.json deleted file mode 100644 index 9ff385d6ff..0000000000 --- a/screens/History/HistoryScreen.strings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "noHistory": "No history available yet", - "downloaded": "downloaded", - "shared": "shared", - "received": "received", - "deleted": "deleted" -} \ No newline at end of file diff --git a/screens/Home/HomeScreen.strings.json b/screens/Home/HomeScreen.strings.json deleted file mode 100644 index 4d7d6693ce..0000000000 --- a/screens/Home/HomeScreen.strings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "myVcsTab": "My\nCards", - "receivedVcsTab": "Received\nCards", - "historyTab": "History" -} \ No newline at end of file diff --git a/screens/Home/IntroSlidersScreen.tsx b/screens/Home/IntroSlidersScreen.tsx index f09636abbb..297fa41bc6 100644 --- a/screens/Home/IntroSlidersScreen.tsx +++ b/screens/Home/IntroSlidersScreen.tsx @@ -65,17 +65,17 @@ export const IntroSlidersScreen: React.FC = props => { }}> {controller.isPasscodeSet() ? (