diff --git a/.talismanrc b/.talismanrc index 9c565c5c73..10a5ba18f2 100644 --- a/.talismanrc +++ b/.talismanrc @@ -168,7 +168,7 @@ fileignoreconfig: - filename: machines/backupAndRestore/backupAndRestoreSetup.ts checksum: 5fc57c926cf1b97bf3226ef30149d59ab3c5b437aad3315306b505dc6207d37d - filename: machines/backupAndRestore/backupAndRestoreSetup.typegen.ts - checksum: 9a5c3dab3e681297081ce0da5ec3189b2d47616d0f74937160548d63919961ab + checksum: b55be87b377515af3533c66ca23670c05032c3737adaaad2901f7c6d639b9519 - filename: injitest/src/main/resources/AidData.json checksum: 1bd07afe80d6d9cb1b8bea6e5cb77314964c803ff88c0756e40c47bc7564d20f - filename: injitest/src/main/java/inji/api/KernelAuthentication.java diff --git a/components/AccountInformation.tsx b/components/AccountInformation.tsx index 8ab009d29b..1392a6acd5 100644 --- a/components/AccountInformation.tsx +++ b/components/AccountInformation.tsx @@ -5,20 +5,23 @@ import {Theme} from './ui/styleUtils'; import {ProfileInfo} from '../shared/CloudBackupAndRestoreUtils'; import {useTranslation} from 'react-i18next'; import testIDProps from '../shared/commonUtil'; +import {isAndroid} from '../shared/constants'; export const AccountInformation: React.FC = ({email, picture}) => { const {t} = useTranslation('AccountSelection'); return ( - - - + {isAndroid() && ( + + + + )} aps-environment development + com.apple.developer.applesignin + + Default + com.apple.developer.icloud-container-identifiers iCloud.io.mosip.inji.wallet.mobileid @@ -17,4 +21,4 @@ iCloud.io.mosip.inji.wallet.mobileid - \ No newline at end of file + diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 6ab0cc389d..ba9fbf9fde 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -474,6 +474,8 @@ PODS: - React-jsi (= 0.71.8) - React-logger (= 0.71.8) - React-perflogger (= 0.71.8) + - RNAppleAuthentication (2.3.0): + - React-Core - RNArgon2 (2.0.1): - CatCrypto - React-Core @@ -607,6 +609,7 @@ DEPENDENCIES: - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`) - React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`) - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) + - "RNAppleAuthentication (from `../node_modules/@invertase/react-native-apple-authentication`)" - RNArgon2 (from `../node_modules/react-native-argon2`) - RNBluetoothStateManager (from `../node_modules/react-native-bluetooth-state-manager`) - "RNCClipboard (from `../node_modules/@react-native-clipboard/clipboard`)" @@ -790,6 +793,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/runtimeexecutor" ReactCommon: :path: "../node_modules/react-native/ReactCommon" + RNAppleAuthentication: + :path: "../node_modules/@invertase/react-native-apple-authentication" RNArgon2: :path: "../node_modules/react-native-argon2" RNBluetoothStateManager: @@ -913,6 +918,7 @@ SPEC CHECKSUMS: React-RCTVibration: 43ffd976a25f6057a7cf95ea3648ba4e00287f89 React-runtimeexecutor: 7c51ae9d4b3e9608a2366e39ccaa606aa551b9ed ReactCommon: 85c98ab0a509e70bf5ee5d9715cf68dbf495b84c + RNAppleAuthentication: e99eaf3c4c01ad8ecb6125dd6f0cfd98871685b5 RNArgon2: 1481820722fd4af1575c09f7fc9ad67c00ee8a42 RNBluetoothStateManager: ae6a26260cbdf1827b58bd3bcc563527d61e6488 RNCClipboard: 3f0451a8100393908bea5c5c5b16f96d45f30bfc diff --git a/locales/ara.json b/locales/ara.json index 53f330b18e..844e849935 100644 --- a/locales/ara.json +++ b/locales/ara.json @@ -798,7 +798,7 @@ "lastBackupDetails": "تفاصيل النسخ الاحتياطي الأخير", "backupInProgress": "لا يزال بإمكانك استخدام التطبيق أثناء إجراء النسخ الاحتياطي للبيانات. سيؤدي إغلاق التطبيق إلى إنهاء عملية النسخ الاحتياطي للبيانات.", "noBackup": "قم بعمل نسخة احتياطية لبياناتك على {{driveName}}. يمكنك استعادتها عند إعادة تثبيت INJI.", - "storage": "سيتم تخزين النسخة الاحتياطية في Google Drive المرتبط بحساب Gmail الذي اخترته.", + "storage": "سيتم تخزين النسخة الاحتياطية في {{driveName}} المرتبط بحساب {{accountType}} الذي اخترته.", "backup": "دعم", "size": "مقاس:", "restore": "يعيد", diff --git a/locales/en.json b/locales/en.json index ff7fde1a67..e15e8ea518 100644 --- a/locales/en.json +++ b/locales/en.json @@ -806,7 +806,7 @@ "lastBackupDetails": "Last Backup Details", "backupInProgress": "You can still use the application while data backup is in progress. Closing the app will terminate the data backup process.", "noBackup": "Backup your Data to {{driveName}}. You can restore them when you reinstall INJI.", - "storage": "The backup will be stored in the Google Drive associated to your chosen gmail account.", + "storage": "The backup will be stored in the {{driveName}} associated to your chosen {{accountType}} account.", "backup": "Backup", "size": "Size: ", "restore": "Restore", diff --git a/locales/fil.json b/locales/fil.json index a989a1c0b7..ebe6c5f7ed 100644 --- a/locales/fil.json +++ b/locales/fil.json @@ -797,7 +797,7 @@ "lastBackupDetails": "Mga Detalye ng Huling Backup", "backupInProgress": "Maaari mo pa ring gamitin ang application habang isinasagawa ang pag-backup ng data. Ang pagsasara ng app ay magwawakas sa proseso ng pag-backup ng data.", "noBackup": "I-backup ang iyong Data sa {{driveName}}. Maaari mong ibalik ang mga ito kapag na-install mong muli ang INJI.", - "storage": "Ang backup ay maiimbak sa Google Drive na nauugnay sa iyong napiling gmail account.", + "storage": "Ang backup ay maiimbak sa {{driveName}} na nauugnay sa iyong napiling {{accountType}} account.", "backup": "Backup", "size": "Size: ", "restore": "Ibalik", diff --git a/locales/hin.json b/locales/hin.json index 5bc8909ed7..5c310ae739 100644 --- a/locales/hin.json +++ b/locales/hin.json @@ -800,7 +800,7 @@ "lastBackupDetails": "अंतिम बैकअप विवरण", "backupInProgress": "जब डेटा बैकअप चल रहा हो तब भी आप एप्लिकेशन का उपयोग कर सकते हैं। ऐप बंद करने से डेटा बैकअप प्रक्रिया समाप्त हो जाएगी।", "noBackup": "अपने डेटा का {{driveName}} पर बैकअप लें। INJI को पुनः इंस्टॉल करने पर आप उन्हें पुनर्स्थापित कर सकते हैं।", - "storage": "बैकअप आपके चुने हुए जीमेल खाते से जुड़े Google ड्राइव में संग्रहीत किया जाएगा।", + "storage": "बैकअप आपके चुने हुए {{accountType}} खाते से जुड़े {{driveName}} में संग्रहीत किया जाएगा।", "backup": "बैकअप", "size": "आकार: ", "restore": "पुनर्स्थापित करें", diff --git a/locales/kan.json b/locales/kan.json index a6fe8e2f8a..c54e0860a6 100644 --- a/locales/kan.json +++ b/locales/kan.json @@ -798,7 +798,7 @@ "lastBackupDetails": "ಕೊನೆಯ ಬ್ಯಾಕಪ್ ವಿವರಗಳು", "backupInProgress": "ಡೇಟಾ ಬ್ಯಾಕಪ್ ಪ್ರಗತಿಯಲ್ಲಿರುವಾಗಲೂ ನೀವು ಅಪ್ಲಿಕೇಶನ್ ಅನ್ನು ಬಳಸಬಹುದು. ಅಪ್ಲಿಕೇಶನ್ ಅನ್ನು ಮುಚ್ಚುವುದರಿಂದ ಡೇಟಾ ಬ್ಯಾಕಪ್ ಪ್ರಕ್ರಿಯೆಯನ್ನು ಕೊನೆಗೊಳಿಸುತ್ತದೆ.", "noBackup": "{{driveName}} ನಿಮ್ಮ ಡೇಟಾವನ್ನು ಬ್ಯಾಕಪ್ ಮಾಡಿ. ನೀವು INJI ಅನ್ನು ಮರುಸ್ಥಾಪಿಸಿದಾಗ ನೀವು ಅವುಗಳನ್ನು ಮರುಸ್ಥಾಪಿಸಬಹುದು.", - "storage": "ನಿಮ್ಮ ಆಯ್ಕೆಮಾಡಿದ gmail ಖಾತೆಗೆ ಸಂಯೋಜಿತವಾಗಿರುವ Google ಡ್ರೈವ್‌ನಲ್ಲಿ ಬ್ಯಾಕಪ್ ಅನ್ನು ಸಂಗ್ರಹಿಸಲಾಗುತ್ತದೆ.", + "storage": "ನೀವು ಆಯ್ಕೆ ಮಾಡಿದ {{accountType}} ಖಾತೆಗೆ ಸಂಯೋಜಿತವಾಗಿರುವ {{driveName}} ನಲ್ಲಿ ಬ್ಯಾಕಪ್ ಅನ್ನು ಸಂಗ್ರಹಿಸಲಾಗುತ್ತದೆ.", "backup": "ಬ್ಯಾಕಪ್", "size": "ಗಾತ್ರ: ", "restore": "ಮರುಸ್ಥಾಪಿಸು", diff --git a/locales/tam.json b/locales/tam.json index cd6166581d..883540f557 100644 --- a/locales/tam.json +++ b/locales/tam.json @@ -798,7 +798,7 @@ "lastBackupDetails": "கடைசி காப்பு விவரங்கள்", "backupInProgress": "தரவு காப்புப்பிரதி செயலில் இருக்கும்போது நீங்கள் பயன்பாட்டைப் பயன்படுத்தலாம். பயன்பாட்டை மூடுவது தரவு காப்புப்பிரதி செயல்முறையை நிறுத்தும்.", "noBackup": "உங்கள் தரவை {{driveName}} காப்புப் பிரதி எடுக்கவும். நீங்கள் INJI ஐ மீண்டும் நிறுவும் போது அவற்றை மீட்டெடுக்கலாம்.", - "storage": "நீங்கள் தேர்ந்தெடுத்த ஜிமெயில் கணக்குடன் தொடர்புடைய Google இயக்ககத்தில் காப்புப்பிரதி சேமிக்கப்படும்.", + "storage": "நீங்கள் தேர்ந்தெடுத்த {{accountType}} கணக்குடன் தொடர்புடைய {{driveName}} இல் காப்புப்பிரதி சேமிக்கப்படும்.", "backup": "காப்புப்பிரதி", "size": "அளவு: ", "restore": "மீட்டமை", diff --git a/machines/VerifiableCredential/VCMetaMachine/VCMetaMachine.typegen.ts b/machines/VerifiableCredential/VCMetaMachine/VCMetaMachine.typegen.ts index 2e41d7c4e6..3c6012e7d2 100644 --- a/machines/VerifiableCredential/VCMetaMachine/VCMetaMachine.typegen.ts +++ b/machines/VerifiableCredential/VCMetaMachine/VCMetaMachine.typegen.ts @@ -3,15 +3,15 @@ export interface Typegen0 { '@@xstate/typegen': true; internalEvents: { - 'done.invoke.vc.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]': { - type: 'done.invoke.vc.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]'; + 'done.invoke.vcMeta.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]': { + type: 'done.invoke.vcMeta.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]'; data: unknown; __tip: 'See the XState TS docs to learn how to strongly type this.'; }; 'xstate.init': {type: 'xstate.init'}; }; invokeSrcNameMap: { - isUserSignedAlready: 'done.invoke.vc.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]'; + isUserSignedAlready: 'done.invoke.vcMeta.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]'; }; missingImplementations: { actions: never; @@ -30,7 +30,7 @@ export interface Typegen0 { | 'VERIFY_VC_FAILED' | 'xstate.init'; loadReceivedVcs: 'REFRESH_RECEIVED_VCS' | 'STORE_RESPONSE'; - logTamperedVCsremoved: 'done.invoke.vc.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]'; + logTamperedVCsremoved: 'done.invoke.vcMeta.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]'; prependToMyVcs: 'VC_ADDED'; removeDownloadFailedVcsFromStorage: 'DELETE_VC'; removeDownloadingFailedVcsFromMyVcs: 'STORE_RESPONSE'; @@ -43,7 +43,7 @@ export interface Typegen0 { resetInProgressVcsDownloaded: 'RESET_IN_PROGRESS_VCS_DOWNLOADED'; resetVerificationErrorMessage: 'RESET_VERIFY_ERROR'; resetWalletBindingSuccess: 'RESET_WALLET_BINDING_SUCCESS'; - sendBackupEvent: 'done.invoke.vc.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]'; + sendBackupEvent: 'done.invoke.vcMeta.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]'; setDownloadedVc: 'VC_DOWNLOADED'; setDownloadingFailedVcs: 'DOWNLOAD_LIMIT_EXPIRED'; setMyVcs: 'STORE_RESPONSE'; @@ -56,7 +56,7 @@ export interface Typegen0 { }; eventsCausingDelays: {}; eventsCausingGuards: { - isSignedIn: 'done.invoke.vc.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]'; + isSignedIn: 'done.invoke.vcMeta.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]'; }; eventsCausingServices: { isUserSignedAlready: 'REMOVE_TAMPERED_VCS'; diff --git a/machines/backupAndRestore/backupAndRestoreSetup.ts b/machines/backupAndRestore/backupAndRestoreSetup.ts index 5eeb220074..cfdd37aee1 100644 --- a/machines/backupAndRestore/backupAndRestoreSetup.ts +++ b/machines/backupAndRestore/backupAndRestoreSetup.ts @@ -34,6 +34,7 @@ const model = createModel( errorMessage: '' as string, serviceRefs: {} as AppServices, shouldTriggerAutoBackup: false as boolean, + isCloudSignedIn: false as boolean, }, { events: { @@ -53,6 +54,7 @@ export const BackupAndRestoreSetupEvents = model.events; export const backupAndRestoreSetupMachine = model.createMachine( { + /** @xstate-layout N4IgpgJg5mDOIC5QCMCGBjA1gVwA4EEA7CAJTgBcB7AJzAGUxy8A6AS0NfIGIAJfAOQAiAGQCiAfQBC+AMIBpAKoAFcQMHiSougBUA8poDaABgC6iULkqxOrSoXMgAnogC0ADgDszAKxG-RjwBOIzcQgGYAJjCAGhAAD0QAFjdE5gBGCN9MjzSANly0xI9EgF8S2LQsPCJSChp6RhZ2TmZ0AAswLABJQnIwakJGLgg7MDZCADdKTDHKnAJiMlgqWgYmXHGW9s7MHr6BxgR2KfRUcltCYxMrh0trc7sHZwREiIifWISEMLTvZjdcjlAokwh5Ad4IoEyhUMPMaksVg11ptyK0Ot1ev1BtwRoNxlMZsw5tVFnVVo0Ns1UdsMftsUdJpRTg9LqYDGkzEgQHcbI8uc9Xu9vJ9ED8-gCgSCwR4IVDyiBiQtast6msmhxqejdpiDtx+tQaMxcAAbM4AMxoAFsibCScrEWrKRq0Ts9ljDscmWcLlcblyeSyHF8xf9AWlgaDwZDYs9QalvNCFbalQjVRSUcxCJQ3bquNoSABNVQAcXwXX4fosVl59i5XzebmYHjcwW8aSMgQ8YTCRlyMSciG8Q-S3lyERy3mbiSHpXlivhZKR6paWZz2K4gi6dAAslu6JXudXA3XEA2my2jG2O12e32Y4h8mEm2EQYFChLOx5E-PSSrycizUYdo6DaSgAHcZDsM1WGoS1vTsHoLS4HR9AkTQ6CUXR+DoUQDwDC4g1FRJUnbX5vESIwwjcNJiiKe8EHbNtmESQJWLCQJR0hcMvznZMFz-JcNkA8hgNAiCoJguCWUQyhkL0TQNC0TDsNwjlbiPAiT2+Yj0iMMiKKomjiI8ei0jMp9WNYiFPBo7xQW-PjfwddNYDAY1OnIGRjUobAIHwdB0B83ouGLXQpFkOQ8I0vlQHrXxmDfCiPCCDw3kowI3FMzJG0sjLkrcMJvDfBNeKqFNF0dZhXPc9BPO83z-MC7BgqUEhdBkURREEKL7k02LT3ixKAhStL2MygcGLCQEfGbdswTfQJu1yByyv45zkRpTA6FYKBCB6YZRnxaZZkc+00w2rVtt2noGROeDWWuUx1N6mL4kHUd0mSRIaPyQIIlyIxEnolw3iffw9O8aiCnyIoVrhJzzpYTarr2wgDrxT1CR-M7-yRy6dtR26vRZX01P9aLa36hAh1yT6Uh+3I-oBoGJpBnJmHB34obyXJYdK+GccEl0sBR-bcTGTGTtWhHcY2ZGCZuz1mR9NkIk5KsXsp1mKL+Xw-HHSzckhui3oYsz3khXJQgCPIIiKNw4btVNZeFraFcIZh9RoEKwukeQeprJ5EByIwPlNn5Gy7EECmbf7ARlR3yoEyr5euj2veoLhdCUUR+HEHDtG0cti33J7yc1oOEBDsPgzSSOXymmi3Dj5KSphaXBZT-G08zbMdXXfMi3wUtywD49QGeFsIhFBAz2bVt207btezCRO1sRuXu9R3u1yGTcdz3Me+tNueLyvJfb37Z4OPjfw0mXtwCu+teZaF6w0-RiXGSx07nbf92ibKzsL6MuGtA5aUSPkDmHhKKQgnF2KIwNpxPj1kYA2rEjYpB4u3AWf9Krv1Rp-I6P8O54JcgApW91Sbq0PBXCBUCAiwM7L8BBV9ED32mpOaiARGbhiWi-Tu5CP7i2IVLXBFUhGE0oSTVWND8KvS+Itd4hRexFRBIUXmJltZ2R8P4dBgRMF8xwU7CRyICFi0OpLG0pDTEsHMYQQBVC2RhDkRTQiCAlGfVURGDRJtnguF8GkXR+sggYONtgpMNjk6SJ6J7agBpM6hXCv7UBtDwFUzroEXRs1AbER+D9eiY5gl6Qfk-MyAiyFmPdnEhJXBNAyCwgAMS6MWBQClZANIUPwbQR9XqT17DXdhLZsncOIuon6FTbEbHsTvfuQxB4ljLBWVJ8itb1giJHM+i8bwr3ogCLJnNSkvjSJM6JVSe6rjmdwfeu46Cl1cXQqmp8F7XmXneCai0gmoLjgzAqpz1osGxn-H2yTIorLcRAkE55ghW2KG2ZsQ5TIQiCb8McIJQiZA2SVeUWYIBwAcECqZz10mm0WiM9sYz8lgmBqlFBfh2wAj8I-Ls-yN4omJePU2ddQ7z0vNst5bCEAuCMglQ2ekOzJGShEwlZzlyolYBAdyHLj5fCMPRDZDt+YmNlU6LYWpd7kGVQoxAaqJqCh8Kyl2VJZl0kYEatZJrCmA0tULYSolwKQUINBWC90ZL2vcS4ZI9Fmy0zbpE8ROqqpuQ8l5HyfkApBUNeXElXxA3jWvlbF1Xcdiiy1qs9x3LoV8teZfJBl5inth7L2DFq8tVJwBZvHN1SFVKuTZy1V9FJzLTrevF2qdt4Z39VpU1zxq5hplQ212uabXuiTWA9tjqJpTyzTEvNEKMnfXJbk8Z1LWZ9lpuDAxrwfgRBCCu8528W1gCHVTEdD5UrnrsdUwdbaVWLv6aGx90zqmXNtXOtJC6EB3o8c-Htr9KoTvqDe02abTIZBQWUMoQA */ predictableActionArguments: true, preserveActionOrder: true, tsTypes: {} as import('./backupAndRestoreSetup.typegen').Typegen0, @@ -166,12 +168,8 @@ export const backupAndRestoreSetupMachine = model.createMachine( target: '.noInternet', }, { - cond: 'isIOSAndNotSignedIn', - actions: [ - 'unsetIsLoading', - 'setErrorReasonAsAccountRequired', - 'sendBackupAndRestoreSetupErrorEvent', - ], + cond: 'isAuthorisedAndCloudAccessNotGiven', + actions: ['unsetIsLoading'], target: '.error', }, { @@ -227,6 +225,10 @@ export const backupAndRestoreSetupMachine = model.createMachine( actions: 'sendBackupAndRestoreSetupErrorEvent', target: '.noInternet', }, + { + cond: 'isIOSAndSignInFailed', + target: '#backupAndRestoreSetup.init', + }, { actions: 'sendBackupAndRestoreSetupErrorEvent', target: '.error', @@ -357,10 +359,15 @@ export const backupAndRestoreSetupMachine = model.createMachine( isInternetConnected: (_, event) => !!(event.data as NetInfoState).isConnected, isNetworkError: (_, event) => event.data.error === NETWORK_REQUEST_FAILED, - isSignedIn: (_context, event) => - (event.data as isSignedInResult).isSignedIn, - isIOSAndNotSignedIn: (_context, event) => { - return isIOS() && !(event.data as isSignedInResult).isSignedIn; + isSignedIn: (_context, event) => { + return (event.data as isSignedInResult).isSignedIn; + }, + + isIOSAndSignInFailed: (_context, event) => { + const isSignInFailed = !( + (event.data as SignInResult).status === Cloud.status.SUCCESS + ); + return isIOS() && isSignInFailed; }, isConfirmationAlreadyShown: (_context, event) => { return ( @@ -369,8 +376,12 @@ export const backupAndRestoreSetupMachine = model.createMachine( ] || false ); }, - isSignInSuccessful: (_context, event) => - (event.data as SignInResult).status === Cloud.status.SUCCESS, + isSignInSuccessful: (_context, event) => { + return (event.data as SignInResult).status === Cloud.status.SUCCESS; + }, + isAuthorisedAndCloudAccessNotGiven: (_context, event) => { + return (event.data as isSignedInResult).isAuthorised || false; + }, }, }, ); @@ -417,4 +428,7 @@ export function selectIsSigningFailure(state: State) { return state.matches('signIn.error') || state.matches('checkSignIn.error'); } +export function selectIsCloudSignedInFailed(state: State) { + return state.matches('checkSignIn.error'); +} type State = StateFrom; diff --git a/machines/backupAndRestore/backupAndRestoreSetup.typegen.ts b/machines/backupAndRestore/backupAndRestoreSetup.typegen.ts index 8acfeb54d6..e69de29bb2 100644 --- a/machines/backupAndRestore/backupAndRestoreSetup.typegen.ts +++ b/machines/backupAndRestore/backupAndRestoreSetup.typegen.ts @@ -1,106 +0,0 @@ -// This file was automatically generated. Edits will be overwritten - -export interface Typegen0 { - '@@xstate/typegen': true; - internalEvents: { - 'done.invoke.backupAndRestoreSetup.checkSignIn:invocation[0]': { - type: 'done.invoke.backupAndRestoreSetup.checkSignIn:invocation[0]'; - data: unknown; - __tip: 'See the XState TS docs to learn how to strongly type this.'; - }; - 'done.invoke.backupAndRestoreSetup.init.checkInternet:invocation[0]': { - type: 'done.invoke.backupAndRestoreSetup.init.checkInternet:invocation[0]'; - data: unknown; - __tip: 'See the XState TS docs to learn how to strongly type this.'; - }; - 'done.invoke.signIn:invocation[0]': { - type: 'done.invoke.signIn:invocation[0]'; - data: unknown; - __tip: 'See the XState TS docs to learn how to strongly type this.'; - }; - 'error.platform.backupAndRestoreSetup.init.checkInternet:invocation[0]': { - type: 'error.platform.backupAndRestoreSetup.init.checkInternet:invocation[0]'; - data: unknown; - }; - 'xstate.init': {type: 'xstate.init'}; - }; - invokeSrcNameMap: { - checkInternet: 'done.invoke.backupAndRestoreSetup.init.checkInternet:invocation[0]'; - isUserSignedAlready: 'done.invoke.backupAndRestoreSetup.checkSignIn:invocation[0]'; - signIn: 'done.invoke.signIn:invocation[0]'; - }; - missingImplementations: { - actions: never; - delays: never; - guards: never; - services: never; - }; - eventsCausingActions: { - fetchShowConfirmationInfo: 'done.invoke.backupAndRestoreSetup.init.checkInternet:invocation[0]'; - openSettings: 'OPEN_SETTINGS'; - sendBackupAndRestoreSetupCancelEvent: 'DISMISS' | 'GO_BACK'; - sendBackupAndRestoreSetupErrorEvent: - | 'done.invoke.backupAndRestoreSetup.checkSignIn:invocation[0]' - | 'done.invoke.backupAndRestoreSetup.init.checkInternet:invocation[0]' - | 'done.invoke.signIn:invocation[0]' - | 'error.platform.backupAndRestoreSetup.init.checkInternet:invocation[0]'; - sendBackupAndRestoreSetupSuccessEvent: - | 'done.invoke.backupAndRestoreSetup.checkSignIn:invocation[0]' - | 'done.invoke.signIn:invocation[0]'; - sendDataBackupAndRestoreSetupStartEvent: 'HANDLE_BACKUP_AND_RESTORE'; - setAccountSelectionConfirmationShown: - | 'done.invoke.backupAndRestoreSetup.checkSignIn:invocation[0]' - | 'done.invoke.signIn:invocation[0]'; - setErrorReasonAsAccountRequired: 'done.invoke.backupAndRestoreSetup.checkSignIn:invocation[0]'; - setIsLoading: 'HANDLE_BACKUP_AND_RESTORE' | 'PROCEED' | 'TRY_AGAIN'; - setProfileInfo: - | 'done.invoke.backupAndRestoreSetup.checkSignIn:invocation[0]' - | 'done.invoke.signIn:invocation[0]'; - setShouldTriggerAutoBackup: 'done.invoke.signIn:invocation[0]'; - unsetIsLoading: - | 'DISMISS' - | 'STORE_RESPONSE' - | 'done.invoke.backupAndRestoreSetup.checkSignIn:invocation[0]' - | 'done.invoke.backupAndRestoreSetup.init.checkInternet:invocation[0]' - | 'error.platform.backupAndRestoreSetup.init.checkInternet:invocation[0]'; - unsetShouldTriggerAutoBackup: 'HANDLE_BACKUP_AND_RESTORE'; - }; - eventsCausingDelays: {}; - eventsCausingGuards: { - isConfirmationAlreadyShown: 'STORE_RESPONSE'; - isIOSAndNotSignedIn: 'done.invoke.backupAndRestoreSetup.checkSignIn:invocation[0]'; - isInternetConnected: 'done.invoke.backupAndRestoreSetup.init.checkInternet:invocation[0]'; - isNetworkError: - | 'done.invoke.backupAndRestoreSetup.checkSignIn:invocation[0]' - | 'done.invoke.signIn:invocation[0]'; - isSignInSuccessful: 'done.invoke.signIn:invocation[0]'; - isSignedIn: 'done.invoke.backupAndRestoreSetup.checkSignIn:invocation[0]'; - }; - eventsCausingServices: { - checkInternet: 'HANDLE_BACKUP_AND_RESTORE' | 'TRY_AGAIN'; - isUserSignedAlready: 'PROCEED' | 'STORE_RESPONSE'; - signIn: 'done.invoke.backupAndRestoreSetup.checkSignIn:invocation[0]'; - }; - matchesStates: - | 'backupAndRestore' - | 'checkSignIn' - | 'checkSignIn.error' - | 'checkSignIn.idle' - | 'checkSignIn.noInternet' - | 'fetchShowConfirmationInfo' - | 'init' - | 'init.checkInternet' - | 'init.idle' - | 'init.noInternet' - | 'selectCloudAccount' - | 'signIn' - | 'signIn.error' - | 'signIn.idle' - | 'signIn.noInternet' - | { - checkSignIn?: 'error' | 'idle' | 'noInternet'; - init?: 'checkInternet' | 'idle' | 'noInternet'; - signIn?: 'error' | 'idle' | 'noInternet'; - }; - tags: never; -} diff --git a/machines/backupAndRestore/backupRestore.typegen.ts b/machines/backupAndRestore/backupRestore.typegen.ts index 4567047ad6..737ad57389 100644 --- a/machines/backupAndRestore/backupRestore.typegen.ts +++ b/machines/backupAndRestore/backupRestore.typegen.ts @@ -1,134 +1,63 @@ -// This file was automatically generated. Edits will be overwritten -export interface Typegen0 { - '@@xstate/typegen': true; - internalEvents: { - 'done.invoke.backupRestore.restoreBackup.checkInternet:invocation[0]': { - type: 'done.invoke.backupRestore.restoreBackup.checkInternet:invocation[0]'; - data: unknown; - __tip: 'See the XState TS docs to learn how to strongly type this.'; - }; - 'done.invoke.backupRestore.restoreBackup.checkStorageAvailability:invocation[0]': { - type: 'done.invoke.backupRestore.restoreBackup.checkStorageAvailability:invocation[0]'; - data: unknown; - __tip: 'See the XState TS docs to learn how to strongly type this.'; - }; - 'done.invoke.backupRestore.restoreBackup.downloadBackupFileFromCloud:invocation[0]': { - type: 'done.invoke.backupRestore.restoreBackup.downloadBackupFileFromCloud:invocation[0]'; - data: unknown; - __tip: 'See the XState TS docs to learn how to strongly type this.'; - }; - 'done.invoke.backupRestore.restoreBackup.unzipBackupFile:invocation[0]': { - type: 'done.invoke.backupRestore.restoreBackup.unzipBackupFile:invocation[0]'; - data: unknown; - __tip: 'See the XState TS docs to learn how to strongly type this.'; - }; - 'error.platform.backupRestore.restoreBackup.checkInternet:invocation[0]': { - type: 'error.platform.backupRestore.restoreBackup.checkInternet:invocation[0]'; - data: unknown; - }; - 'error.platform.backupRestore.restoreBackup.downloadBackupFileFromCloud:invocation[0]': { - type: 'error.platform.backupRestore.restoreBackup.downloadBackupFileFromCloud:invocation[0]'; - data: unknown; - }; - 'error.platform.backupRestore.restoreBackup.unzipBackupFile:invocation[0]': { - type: 'error.platform.backupRestore.restoreBackup.unzipBackupFile:invocation[0]'; - data: unknown; - }; - 'xstate.init': {type: 'xstate.init'}; - }; - invokeSrcNameMap: { - checkInternet: 'done.invoke.backupRestore.restoreBackup.checkInternet:invocation[0]'; - checkStorageAvailability: 'done.invoke.backupRestore.restoreBackup.checkStorageAvailability:invocation[0]'; - downloadLatestBackup: 'done.invoke.backupRestore.restoreBackup.downloadBackupFileFromCloud:invocation[0]'; - readBackupFile: 'done.invoke.backupRestore.restoreBackup.readBackupFile:invocation[0]'; - unzipBackupFile: 'done.invoke.backupRestore.restoreBackup.unzipBackupFile:invocation[0]'; - }; - missingImplementations: { - actions: never; - delays: never; - guards: never; - services: never; - }; - eventsCausingActions: { - cleanupFiles: - | 'STORE_ERROR' - | 'STORE_RESPONSE' - | 'done.invoke.backupRestore.restoreBackup.checkInternet:invocation[0]' - | 'done.invoke.backupRestore.restoreBackup.checkStorageAvailability:invocation[0]' - | 'error.platform.backupRestore.restoreBackup.checkInternet:invocation[0]' - | 'error.platform.backupRestore.restoreBackup.downloadBackupFileFromCloud:invocation[0]' - | 'error.platform.backupRestore.restoreBackup.unzipBackupFile:invocation[0]'; - downloadUnsyncedBackupFiles: 'DOWNLOAD_UNSYNCED_BACKUP_FILES'; - loadDataToMemory: 'DATA_FROM_FILE'; - refreshVCs: 'STORE_RESPONSE'; - sendDataRestoreErrorEvent: - | 'done.invoke.backupRestore.restoreBackup.checkInternet:invocation[0]' - | 'error.platform.backupRestore.restoreBackup.checkInternet:invocation[0]'; - sendDataRestoreFailureEvent: - | 'STORE_ERROR' - | 'done.invoke.backupRestore.restoreBackup.checkInternet:invocation[0]' - | 'done.invoke.backupRestore.restoreBackup.checkStorageAvailability:invocation[0]' - | 'error.platform.backupRestore.restoreBackup.checkInternet:invocation[0]' - | 'error.platform.backupRestore.restoreBackup.downloadBackupFileFromCloud:invocation[0]' - | 'error.platform.backupRestore.restoreBackup.unzipBackupFile:invocation[0]'; - sendDataRestoreStartEvent: 'BACKUP_RESTORE'; - sendDataRestoreSuccessEvent: 'STORE_RESPONSE'; - setBackupFileName: 'done.invoke.backupRestore.restoreBackup.downloadBackupFileFromCloud:invocation[0]'; - setDataFromBackupFile: 'DATA_FROM_FILE'; - setRestoreErrorReason: - | 'error.platform.backupRestore.restoreBackup.downloadBackupFileFromCloud:invocation[0]' - | 'error.platform.backupRestore.restoreBackup.unzipBackupFile:invocation[0]'; - setRestoreErrorReasonAsNetworkError: - | 'done.invoke.backupRestore.restoreBackup.checkInternet:invocation[0]' - | 'error.platform.backupRestore.restoreBackup.checkInternet:invocation[0]'; - setRestoreTechnicalError: - | 'STORE_ERROR' - | 'done.invoke.backupRestore.restoreBackup.checkStorageAvailability:invocation[0]'; - setShowRestoreInProgress: 'BACKUP_RESTORE'; - unsetShowRestoreInProgress: - | 'DISMISS_SHOW_RESTORE_IN_PROGRESS' - | 'STORE_ERROR' - | 'STORE_RESPONSE' - | 'done.invoke.backupRestore.restoreBackup.checkInternet:invocation[0]' - | 'done.invoke.backupRestore.restoreBackup.checkStorageAvailability:invocation[0]' - | 'error.platform.backupRestore.restoreBackup.checkInternet:invocation[0]' - | 'error.platform.backupRestore.restoreBackup.downloadBackupFileFromCloud:invocation[0]' - | 'error.platform.backupRestore.restoreBackup.unzipBackupFile:invocation[0]'; - }; - eventsCausingDelays: {}; - eventsCausingGuards: { - isInternetConnected: 'done.invoke.backupRestore.restoreBackup.checkInternet:invocation[0]'; - isMinimumStorageRequiredForBackupRestorationReached: 'done.invoke.backupRestore.restoreBackup.checkStorageAvailability:invocation[0]'; - }; - eventsCausingServices: { - checkInternet: 'BACKUP_RESTORE'; - checkStorageAvailability: 'done.invoke.backupRestore.restoreBackup.checkInternet:invocation[0]'; - downloadLatestBackup: 'done.invoke.backupRestore.restoreBackup.checkStorageAvailability:invocation[0]'; - readBackupFile: 'done.invoke.backupRestore.restoreBackup.unzipBackupFile:invocation[0]'; - unzipBackupFile: 'done.invoke.backupRestore.restoreBackup.downloadBackupFileFromCloud:invocation[0]'; - }; - matchesStates: - | 'init' - | 'restoreBackup' - | 'restoreBackup.checkInternet' - | 'restoreBackup.checkStorageAvailability' - | 'restoreBackup.downloadBackupFileFromCloud' - | 'restoreBackup.failure' - | 'restoreBackup.loadDataToMemory' - | 'restoreBackup.readBackupFile' - | 'restoreBackup.success' - | 'restoreBackup.unzipBackupFile' - | { - restoreBackup?: - | 'checkInternet' - | 'checkStorageAvailability' - | 'downloadBackupFileFromCloud' - | 'failure' - | 'loadDataToMemory' - | 'readBackupFile' - | 'success' - | 'unzipBackupFile'; - }; - tags: never; -} + // This file was automatically generated. Edits will be overwritten + + export interface Typegen0 { + '@@xstate/typegen': true; + internalEvents: { + "done.invoke.backupRestore.restoreBackup.checkInternet:invocation[0]": { type: "done.invoke.backupRestore.restoreBackup.checkInternet:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." }; +"done.invoke.backupRestore.restoreBackup.checkStorageAvailability:invocation[0]": { type: "done.invoke.backupRestore.restoreBackup.checkStorageAvailability:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." }; +"done.invoke.backupRestore.restoreBackup.downloadBackupFileFromCloud:invocation[0]": { type: "done.invoke.backupRestore.restoreBackup.downloadBackupFileFromCloud:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." }; +"done.invoke.backupRestore.restoreBackup.unzipBackupFile:invocation[0]": { type: "done.invoke.backupRestore.restoreBackup.unzipBackupFile:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." }; +"error.platform.backupRestore.restoreBackup.checkInternet:invocation[0]": { type: "error.platform.backupRestore.restoreBackup.checkInternet:invocation[0]"; data: unknown }; +"error.platform.backupRestore.restoreBackup.downloadBackupFileFromCloud:invocation[0]": { type: "error.platform.backupRestore.restoreBackup.downloadBackupFileFromCloud:invocation[0]"; data: unknown }; +"error.platform.backupRestore.restoreBackup.unzipBackupFile:invocation[0]": { type: "error.platform.backupRestore.restoreBackup.unzipBackupFile:invocation[0]"; data: unknown }; +"xstate.init": { type: "xstate.init" }; + }; + invokeSrcNameMap: { + "checkInternet": "done.invoke.backupRestore.restoreBackup.checkInternet:invocation[0]"; +"checkStorageAvailability": "done.invoke.backupRestore.restoreBackup.checkStorageAvailability:invocation[0]"; +"downloadLatestBackup": "done.invoke.backupRestore.restoreBackup.downloadBackupFileFromCloud:invocation[0]"; +"readBackupFile": "done.invoke.backupRestore.restoreBackup.readBackupFile:invocation[0]"; +"unzipBackupFile": "done.invoke.backupRestore.restoreBackup.unzipBackupFile:invocation[0]"; + }; + missingImplementations: { + actions: never; + delays: never; + guards: never; + services: never; + }; + eventsCausingActions: { + "cleanupFiles": "STORE_ERROR" | "STORE_RESPONSE" | "done.invoke.backupRestore.restoreBackup.checkInternet:invocation[0]" | "done.invoke.backupRestore.restoreBackup.checkStorageAvailability:invocation[0]" | "error.platform.backupRestore.restoreBackup.checkInternet:invocation[0]" | "error.platform.backupRestore.restoreBackup.downloadBackupFileFromCloud:invocation[0]" | "error.platform.backupRestore.restoreBackup.unzipBackupFile:invocation[0]"; +"downloadUnsyncedBackupFiles": "DOWNLOAD_UNSYNCED_BACKUP_FILES"; +"loadDataToMemory": "DATA_FROM_FILE"; +"refreshVCs": "STORE_RESPONSE"; +"sendDataRestoreErrorEvent": "done.invoke.backupRestore.restoreBackup.checkInternet:invocation[0]" | "error.platform.backupRestore.restoreBackup.checkInternet:invocation[0]"; +"sendDataRestoreFailureEvent": "STORE_ERROR" | "done.invoke.backupRestore.restoreBackup.checkInternet:invocation[0]" | "done.invoke.backupRestore.restoreBackup.checkStorageAvailability:invocation[0]" | "error.platform.backupRestore.restoreBackup.checkInternet:invocation[0]" | "error.platform.backupRestore.restoreBackup.downloadBackupFileFromCloud:invocation[0]" | "error.platform.backupRestore.restoreBackup.unzipBackupFile:invocation[0]"; +"sendDataRestoreStartEvent": "BACKUP_RESTORE"; +"sendDataRestoreSuccessEvent": "STORE_RESPONSE"; +"setBackupFileName": "done.invoke.backupRestore.restoreBackup.downloadBackupFileFromCloud:invocation[0]"; +"setDataFromBackupFile": "DATA_FROM_FILE"; +"setRestoreErrorReason": "error.platform.backupRestore.restoreBackup.downloadBackupFileFromCloud:invocation[0]" | "error.platform.backupRestore.restoreBackup.unzipBackupFile:invocation[0]"; +"setRestoreErrorReasonAsNetworkError": "done.invoke.backupRestore.restoreBackup.checkInternet:invocation[0]" | "error.platform.backupRestore.restoreBackup.checkInternet:invocation[0]"; +"setRestoreTechnicalError": "STORE_ERROR" | "done.invoke.backupRestore.restoreBackup.checkStorageAvailability:invocation[0]"; +"setShowRestoreInProgress": "BACKUP_RESTORE"; +"unsetShowRestoreInProgress": "DISMISS_SHOW_RESTORE_IN_PROGRESS" | "STORE_ERROR" | "STORE_RESPONSE" | "done.invoke.backupRestore.restoreBackup.checkInternet:invocation[0]" | "done.invoke.backupRestore.restoreBackup.checkStorageAvailability:invocation[0]" | "error.platform.backupRestore.restoreBackup.checkInternet:invocation[0]" | "error.platform.backupRestore.restoreBackup.downloadBackupFileFromCloud:invocation[0]" | "error.platform.backupRestore.restoreBackup.unzipBackupFile:invocation[0]"; + }; + eventsCausingDelays: { + + }; + eventsCausingGuards: { + "isInternetConnected": "done.invoke.backupRestore.restoreBackup.checkInternet:invocation[0]"; +"isMinimumStorageRequiredForBackupRestorationReached": "done.invoke.backupRestore.restoreBackup.checkStorageAvailability:invocation[0]"; + }; + eventsCausingServices: { + "checkInternet": "BACKUP_RESTORE"; +"checkStorageAvailability": "done.invoke.backupRestore.restoreBackup.checkInternet:invocation[0]"; +"downloadLatestBackup": "done.invoke.backupRestore.restoreBackup.checkStorageAvailability:invocation[0]"; +"readBackupFile": "done.invoke.backupRestore.restoreBackup.unzipBackupFile:invocation[0]"; +"unzipBackupFile": "done.invoke.backupRestore.restoreBackup.downloadBackupFileFromCloud:invocation[0]"; + }; + matchesStates: "init" | "restoreBackup" | "restoreBackup.checkInternet" | "restoreBackup.checkStorageAvailability" | "restoreBackup.downloadBackupFileFromCloud" | "restoreBackup.failure" | "restoreBackup.loadDataToMemory" | "restoreBackup.readBackupFile" | "restoreBackup.success" | "restoreBackup.unzipBackupFile" | { "restoreBackup"?: "checkInternet" | "checkStorageAvailability" | "downloadBackupFileFromCloud" | "failure" | "loadDataToMemory" | "readBackupFile" | "success" | "unzipBackupFile"; }; + tags: never; + } + \ No newline at end of file diff --git a/machines/backupAndRestore/backupWithEncryption.typegen.ts b/machines/backupAndRestore/backupWithEncryption.typegen.ts index c6abfb2086..c9e67cdee1 100644 --- a/machines/backupAndRestore/backupWithEncryption.typegen.ts +++ b/machines/backupAndRestore/backupWithEncryption.typegen.ts @@ -1,104 +1,58 @@ -// This file was automatically generated. Edits will be overwritten -export interface Typegen0 { - '@@xstate/typegen': true; - internalEvents: { - 'done.invoke.WithEncryption.backingUp.checkStorageAvailability:invocation[0]': { - type: 'done.invoke.WithEncryption.backingUp.checkStorageAvailability:invocation[0]'; - data: unknown; - __tip: 'See the XState TS docs to learn how to strongly type this.'; - }; - 'done.invoke.WithEncryption.backingUp.zipBackupFile:invocation[0]': { - type: 'done.invoke.WithEncryption.backingUp.zipBackupFile:invocation[0]'; - data: unknown; - __tip: 'See the XState TS docs to learn how to strongly type this.'; - }; - 'done.invoke.WithEncryption.hashKey:invocation[0]': { - type: 'done.invoke.WithEncryption.hashKey:invocation[0]'; - data: unknown; - __tip: 'See the XState TS docs to learn how to strongly type this.'; - }; - 'error.platform.WithEncryption.backingUp.zipBackupFile:invocation[0]': { - type: 'error.platform.WithEncryption.backingUp.zipBackupFile:invocation[0]'; - data: unknown; - }; - 'error.platform.WithEncryption.requestOtp:invocation[0]': { - type: 'error.platform.WithEncryption.requestOtp:invocation[0]'; - data: unknown; - }; - 'xstate.init': {type: 'xstate.init'}; - }; - invokeSrcNameMap: { - checkStorageAvailability: 'done.invoke.WithEncryption.backingUp.checkStorageAvailability:invocation[0]'; - hashEncKey: 'done.invoke.WithEncryption.hashKey:invocation[0]'; - requestOtp: 'done.invoke.WithEncryption.requestOtp:invocation[0]'; - writeDataToFile: 'done.invoke.WithEncryption.backingUp.writeDataToFile:invocation[0]'; - zipBackupFile: 'done.invoke.WithEncryption.backingUp.zipBackupFile:invocation[0]'; - }; - missingImplementations: { - actions: - | '' - | 'sendDataBackupFailureEvent' - | 'sendDataBackupStartEvent' - | 'sendDataBackupSuccessEvent' - | 'setFileName'; - delays: never; - guards: 'isMinimumStorageRequiredForBackupReached'; - services: 'checkStorageAvailability' | 'requestOtp'; - }; - eventsCausingActions: { - '': 'error.platform.WithEncryption.requestOtp:invocation[0]'; - fetchAllDataFromDB: 'done.invoke.WithEncryption.backingUp.checkStorageAvailability:invocation[0]'; - sendDataBackupFailureEvent: - | 'done.invoke.WithEncryption.backingUp.checkStorageAvailability:invocation[0]' - | 'error.platform.WithEncryption.backingUp.zipBackupFile:invocation[0]'; - sendDataBackupStartEvent: 'STORE_RESPONSE'; - sendDataBackupSuccessEvent: 'done.invoke.WithEncryption.backingUp.zipBackupFile:invocation[0]'; - setBaseEncKey: 'SET_BASE_ENC_KEY'; - setDataFromStorage: 'STORE_RESPONSE'; - setFileName: 'FILE_NAME'; - setHashedKey: 'done.invoke.WithEncryption.hashKey:invocation[0]'; - setOtp: 'INPUT_OTP'; - storeHashedEncKey: 'done.invoke.WithEncryption.hashKey:invocation[0]'; - storePasswordKeyType: 'SET_BASE_ENC_KEY'; - storePhoneNumberKeyType: 'INPUT_OTP'; - }; - eventsCausingDelays: {}; - eventsCausingGuards: { - isMinimumStorageRequiredForBackupReached: 'done.invoke.WithEncryption.backingUp.checkStorageAvailability:invocation[0]'; - }; - eventsCausingServices: { - checkStorageAvailability: 'STORE_RESPONSE'; - hashEncKey: 'INPUT_OTP' | 'STORE_RESPONSE'; - requestOtp: 'SEND_OTP'; - writeDataToFile: 'STORE_RESPONSE'; - zipBackupFile: 'FILE_NAME'; - }; - matchesStates: - | 'backUp' - | 'backingUp' - | 'backingUp.checkStorageAvailability' - | 'backingUp.failure' - | 'backingUp.fetchDataFromDB' - | 'backingUp.idle' - | 'backingUp.success' - | 'backingUp.writeDataToFile' - | 'backingUp.zipBackupFile' - | 'hashKey' - | 'init' - | 'passwordBackup' - | 'phoneNumberBackup' - | 'requestOtp' - | 'selectPref' - | { - backingUp?: - | 'checkStorageAvailability' - | 'failure' - | 'fetchDataFromDB' - | 'idle' - | 'success' - | 'writeDataToFile' - | 'zipBackupFile'; - }; - tags: never; -} + // This file was automatically generated. Edits will be overwritten + + export interface Typegen0 { + '@@xstate/typegen': true; + internalEvents: { + "done.invoke.WithEncryption.backingUp.checkStorageAvailability:invocation[0]": { type: "done.invoke.WithEncryption.backingUp.checkStorageAvailability:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." }; +"done.invoke.WithEncryption.backingUp.zipBackupFile:invocation[0]": { type: "done.invoke.WithEncryption.backingUp.zipBackupFile:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." }; +"done.invoke.WithEncryption.hashKey:invocation[0]": { type: "done.invoke.WithEncryption.hashKey:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." }; +"error.platform.WithEncryption.backingUp.zipBackupFile:invocation[0]": { type: "error.platform.WithEncryption.backingUp.zipBackupFile:invocation[0]"; data: unknown }; +"error.platform.WithEncryption.requestOtp:invocation[0]": { type: "error.platform.WithEncryption.requestOtp:invocation[0]"; data: unknown }; +"xstate.init": { type: "xstate.init" }; + }; + invokeSrcNameMap: { + "checkStorageAvailability": "done.invoke.WithEncryption.backingUp.checkStorageAvailability:invocation[0]"; +"hashEncKey": "done.invoke.WithEncryption.hashKey:invocation[0]"; +"requestOtp": "done.invoke.WithEncryption.requestOtp:invocation[0]"; +"writeDataToFile": "done.invoke.WithEncryption.backingUp.writeDataToFile:invocation[0]"; +"zipBackupFile": "done.invoke.WithEncryption.backingUp.zipBackupFile:invocation[0]"; + }; + missingImplementations: { + actions: "" | "sendDataBackupFailureEvent" | "sendDataBackupStartEvent" | "sendDataBackupSuccessEvent" | "setFileName"; + delays: never; + guards: "isMinimumStorageRequiredForBackupReached"; + services: "checkStorageAvailability" | "requestOtp"; + }; + eventsCausingActions: { + "": "error.platform.WithEncryption.requestOtp:invocation[0]"; +"fetchAllDataFromDB": "done.invoke.WithEncryption.backingUp.checkStorageAvailability:invocation[0]"; +"sendDataBackupFailureEvent": "done.invoke.WithEncryption.backingUp.checkStorageAvailability:invocation[0]" | "error.platform.WithEncryption.backingUp.zipBackupFile:invocation[0]"; +"sendDataBackupStartEvent": "STORE_RESPONSE"; +"sendDataBackupSuccessEvent": "done.invoke.WithEncryption.backingUp.zipBackupFile:invocation[0]"; +"setBaseEncKey": "SET_BASE_ENC_KEY"; +"setDataFromStorage": "STORE_RESPONSE"; +"setFileName": "FILE_NAME"; +"setHashedKey": "done.invoke.WithEncryption.hashKey:invocation[0]"; +"setOtp": "INPUT_OTP"; +"storeHashedEncKey": "done.invoke.WithEncryption.hashKey:invocation[0]"; +"storePasswordKeyType": "SET_BASE_ENC_KEY"; +"storePhoneNumberKeyType": "INPUT_OTP"; + }; + eventsCausingDelays: { + + }; + eventsCausingGuards: { + "isMinimumStorageRequiredForBackupReached": "done.invoke.WithEncryption.backingUp.checkStorageAvailability:invocation[0]"; + }; + eventsCausingServices: { + "checkStorageAvailability": "STORE_RESPONSE"; +"hashEncKey": "INPUT_OTP" | "STORE_RESPONSE"; +"requestOtp": "SEND_OTP"; +"writeDataToFile": "STORE_RESPONSE"; +"zipBackupFile": "FILE_NAME"; + }; + matchesStates: "backUp" | "backingUp" | "backingUp.checkStorageAvailability" | "backingUp.failure" | "backingUp.fetchDataFromDB" | "backingUp.idle" | "backingUp.success" | "backingUp.writeDataToFile" | "backingUp.zipBackupFile" | "hashKey" | "init" | "passwordBackup" | "phoneNumberBackup" | "requestOtp" | "selectPref" | { "backingUp"?: "checkStorageAvailability" | "failure" | "fetchDataFromDB" | "idle" | "success" | "writeDataToFile" | "zipBackupFile"; }; + tags: never; + } + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 6ca5d5fe5b..8459994159 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "@digitalcredentials/vc": "^1.1.2", "@expo-google-fonts/inter": "^0.2.3", "@expo/metro-config": "~0.10.0", + "@invertase/react-native-apple-authentication": "^2.3.0", "@iriscan/biometric-sdk-react-native": "0.2.6", "@mosip/secure-keystore": "^0.1.7", "@mosip/tuvali": "^0.4.9", @@ -4562,6 +4563,14 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, + "node_modules/@invertase/react-native-apple-authentication": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@invertase/react-native-apple-authentication/-/react-native-apple-authentication-2.3.0.tgz", + "integrity": "sha512-D3NNPv98EmkkCJyQEZhRn1zPC5EH+8LKBS+ddFsDyc3rVGWE7Ct0ffpxZ5T60w6wamIPjojIMSfEPUxbQ28+og==", + "engines": { + "node": ">=14" + } + }, "node_modules/@iriscan/biometric-sdk-react-native": { "version": "0.2.6", "resolved": "https://registry.npmjs.org/@iriscan/biometric-sdk-react-native/-/biometric-sdk-react-native-0.2.6.tgz", @@ -31436,7 +31445,7 @@ "bs58": "^4.0.1", "crypto-ld": "^4.0.2", "esm": "^3.2.25", - "node-forge": "~0.9.1", + "node-forge": "^1.3.1", "semver": "^7.3.2", "sodium-native": "^3.1.1" }, @@ -31777,7 +31786,7 @@ "resolved": "https://registry.npmjs.org/@expo/code-signing-certificates/-/code-signing-certificates-0.0.5.tgz", "integrity": "sha512-BNhXkY1bblxKZpltzAx98G2Egj9g1Q+JRcvR7E99DOj862FTCX+ZPsAUtPTr7aHxwtrL7+fL3r0JSmM9kBm+Bw==", "requires": { - "node-forge": "^1.2.1", + "node-forge": "^1.3.1", "nullthrows": "^1.1.1" } }, @@ -32700,6 +32709,11 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, + "@invertase/react-native-apple-authentication": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@invertase/react-native-apple-authentication/-/react-native-apple-authentication-2.3.0.tgz", + "integrity": "sha512-D3NNPv98EmkkCJyQEZhRn1zPC5EH+8LKBS+ddFsDyc3rVGWE7Ct0ffpxZ5T60w6wamIPjojIMSfEPUxbQ28+og==" + }, "@iriscan/biometric-sdk-react-native": { "version": "0.2.6", "resolved": "https://registry.npmjs.org/@iriscan/biometric-sdk-react-native/-/biometric-sdk-react-native-0.2.6.tgz", @@ -46289,7 +46303,7 @@ "es6-promise": "^4.2.8", "lodash": "^4.17.21", "long": "^5.2.0", - "node-forge": "^1.2.1", + "node-forge": "^1.3.1", "pako": "^2.0.4", "process": "^0.11.10", "uuid": "^9.0.0" diff --git a/package.json b/package.json index 0b08dbb1cf..30bbcaf95a 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "@digitalcredentials/vc": "^1.1.2", "@expo-google-fonts/inter": "^0.2.3", "@expo/metro-config": "~0.10.0", + "@invertase/react-native-apple-authentication": "^2.3.0", "@iriscan/biometric-sdk-react-native": "0.2.6", "@mosip/secure-keystore": "^0.1.7", "@mosip/tuvali": "^0.4.9", diff --git a/screens/HomeScreenLayout.tsx b/screens/HomeScreenLayout.tsx index c86add0671..d0446e58e2 100644 --- a/screens/HomeScreenLayout.tsx +++ b/screens/HomeScreenLayout.tsx @@ -48,12 +48,12 @@ export const HomeScreenLayout: React.FC = props => { + {SvgImage.infoIcon()} - + {t('help')} diff --git a/screens/Settings/DataBackupAndRestore.tsx b/screens/Settings/DataBackupAndRestore.tsx index 0bbd35acf5..9b9bbcb0c4 100644 --- a/screens/Settings/DataBackupAndRestore.tsx +++ b/screens/Settings/DataBackupAndRestore.tsx @@ -12,7 +12,7 @@ import {useBackupAndRestoreSetup} from '../backupAndRestore/BackupAndRestoreSetu import BackupAndRestoreScreen from '../backupAndRestore/BackupAndRestoreScreen'; import testIDProps, {getDriveName} from '../../shared/commonUtil'; import {useOverlayVisibleAfterTimeout} from '../../shared/hooks/useOverlayVisibleAfterTimeout'; -import {isAndroid} from '../../shared/constants'; +import {isAndroid, isIOS} from '../../shared/constants'; export const DataBackupAndRestore: React.FC = ({} = () => { const controller = useBackupAndRestoreSetup(); @@ -34,7 +34,6 @@ export const DataBackupAndRestore: React.FC = ({} = () => { controller.isSigningIn, delay, ); - return ( { - {controller.isSigningInFailed && ( + {((controller.isSigningInFailed && !isIOS()) || + controller.isCloudSignInFailed) && ( { /> )} - {(isSigningIn || isSigningInSuccessful) && ( - - )} + {(isSigningIn || isSigningInSuccessful) && + !controller.isCloudSignInFailed && ( + + )} {isLoaderVisible && } = props => { const AccountSection = ( + headerText={isIOS() ? t('') : t('driveSettings')} + headerIcon={ + isIOS() + ? SvgImage.ICloudIcon(86, 25) + : SvgImage.GoogleDriveIconSmall(28, 25) + }> - {t('storage')} + {t('storage', { + driveName: getDriveName(), + accountType: getAccountType(), + })} = props => { + + + + {SvgImage.infoIcon()} + + + {t('Help?')} + + + } /> } @@ -227,7 +240,7 @@ const BackupAndRestoreScreen: React.FC = props => { ) : ( {LastBackupSection} - {isAndroid() && AccountSection} + {AccountSection} {RestoreSection} )} diff --git a/screens/backupAndRestore/BackupAndRestoreSetupController.ts b/screens/backupAndRestore/BackupAndRestoreSetupController.ts index bc76930fd3..876596b8ea 100644 --- a/screens/backupAndRestore/BackupAndRestoreSetupController.ts +++ b/screens/backupAndRestore/BackupAndRestoreSetupController.ts @@ -4,6 +4,7 @@ import {useContext, useRef} from 'react'; import { BackupAndRestoreSetupEvents, backupAndRestoreSetupMachine, + selectIsCloudSignedInFailed, selectIsLoading, selectIsNetworkError as selectIsNetworkErrorDuringSetup, selectIsSigningIn, @@ -71,6 +72,10 @@ export function useBackupAndRestoreSetup() { backupAndRestoreSetupService, selectIsSigningInFailure, ), + isCloudSignInFailed: useSelector( + backupAndRestoreSetupService, + selectIsCloudSignedInFailed, + ), isSigningInSuccessful: useSelector( backupAndRestoreSetupService, selectIsSigningInSuccessful, diff --git a/shared/CloudBackupAndRestoreUtils.ts b/shared/CloudBackupAndRestoreUtils.ts index 174797b77f..efdbd52169 100644 --- a/shared/CloudBackupAndRestoreUtils.ts +++ b/shared/CloudBackupAndRestoreUtils.ts @@ -2,10 +2,16 @@ import { GoogleSignin, statusCodes, } from '@react-native-google-signin/google-signin'; +import RNSecureStorage, {ACCESSIBLE} from 'react-native-secure-key-store'; import {CloudStorage, CloudStorageScope} from 'react-native-cloud-storage'; import {GOOGLE_ANDROID_CLIENT_ID} from 'react-native-dotenv'; import {readFile, writeFile} from 'react-native-fs'; import {BackupDetails} from '../types/backup-and-restore/backup'; +import { + AppleButton, + appleAuth, +} from '@invertase/react-native-apple-authentication'; +import jwt_decode from 'jwt-decode'; import {bytesToMB, sleep} from './commonUtil'; import { IOS_SIGNIN_FAILED, @@ -128,7 +134,39 @@ class Cloud { static async signIn(): Promise { if (isIOS()) { - return {isIOS: true}; + let profileInfo; + + // start a login request + try { + const appleAuthRequestResponse = await appleAuth.performRequest({ + requestedOperation: appleAuth.Operation.LOGIN, + requestedScopes: [appleAuth.Scope.FULL_NAME, appleAuth.Scope.EMAIL], + }); + const {email, nonce, identityToken, realUserStatus /* etc */} = + appleAuthRequestResponse; + profileInfo = {email: email, picture: null}; + await RNSecureStorage.set( + 'userIdentifier', + JSON.stringify(appleAuthRequestResponse), + {accessible: ACCESSIBLE.WHEN_UNLOCKED}, + ); + + return {status: this.status.SUCCESS, profileInfo: profileInfo}; + } catch (error) { + if (error.code === appleAuth.Error.CANCELED) { + console.warn('User canceled Apple Sign in.'); + return { + status: this.status.DECLINED, + error, + }; + } else { + console.error(error); + return { + status: this.status.FAILURE, + error, + }; + } + } } this.configure(); try { @@ -168,9 +206,30 @@ class Cloud { try { if (isIOS()) { const isSignedIn = await CloudStorage.isCloudAvailable(); - return { - isSignedIn, - }; + + const userIdentifier = await RNSecureStorage.get('userIdentifier'); + const userToken = JSON.parse(userIdentifier + ''); + const user = userToken.user; + const email = userToken.email; + + const credentialState = await appleAuth.getCredentialStateForUser(user); + const profileInfo = {email: email, picture: undefined}; + if ( + credentialState === appleAuth.State.AUTHORIZED && + isSignedIn === true + ) { + return { + isSignedIn: true, + isAuthorised: true, + profileInfo: profileInfo, + }; + } else { + return { + isSignedIn: false, + isAuthorised: true, + profileInfo: profileInfo, + }; + } } this.configure(); const isSignedIn = await GoogleSignin.isSignedIn(); @@ -180,12 +239,14 @@ class Cloud { return { isSignedIn: true, profileInfo, + isAuthorised: true, }; } else { const profileInfo = await this.profileInfo(); return { isSignedIn: true, profileInfo, + isAuthorised: true, }; } } catch (error) { @@ -199,6 +260,7 @@ class Cloud { return { error: errorReason || error, isSignedIn: false, + isAuthorised: false, }; } } @@ -414,7 +476,7 @@ export default Cloud; export type ProfileInfo = { email: string; - picture: string; + picture: string|undefined; }; export type SignInResult = { @@ -431,6 +493,7 @@ export type isSignedInResult = { isSignedIn: boolean; error?: string | null; profileInfo?: ProfileInfo; + isAuthorised?: boolean; }; export type CloudUploadResult = { diff --git a/shared/commonUtil.ts b/shared/commonUtil.ts index 447ff5037b..07e759dba4 100644 --- a/shared/commonUtil.ts +++ b/shared/commonUtil.ts @@ -1,7 +1,13 @@ import argon2 from 'react-native-argon2'; import {AnyState} from 'xstate'; import {getDeviceNameSync} from 'react-native-device-info'; -import {GOOGLE_DRIVE_NAME, ICLOUD_DRIVE_NAME, isAndroid} from './constants'; +import { + GOOGLE_DRIVE_NAME, + ICLOUD_DRIVE_NAME, + isAndroid, + GMAIL, + APPLE, +} from './constants'; import {generateSecureRandom} from 'react-native-securerandom'; import forge from 'node-forge'; import {useEffect, useState} from 'react'; @@ -113,6 +119,8 @@ export const bytesToMB = (bytes: number): string => { return Number(megabytes).toFixed(2); }; +export const getAccountType = () => (isAndroid() ? GMAIL : APPLE); + export const getDriveName = () => isAndroid() ? GOOGLE_DRIVE_NAME : ICLOUD_DRIVE_NAME; diff --git a/shared/constants.ts b/shared/constants.ts index 6b62722073..3f498fbe2b 100644 --- a/shared/constants.ts +++ b/shared/constants.ts @@ -125,4 +125,6 @@ export const IOS_SIGNIN_FAILED = 'iCloud not available'; export const REQUEST_TIMEOUT = 'request timedout'; export const BIOMETRIC_CANCELLED = 'User has cancelled biometric'; export const GOOGLE_DRIVE_NAME = 'Google Drive'; +export const GMAIL = 'gmail'; +export const APPLE = 'Apple'; export const ICLOUD_DRIVE_NAME = 'iCloud';