diff --git a/android/app/src/main/java/io/mosip/residentapp/RNEventMapper.java b/android/app/src/main/java/io/mosip/residentapp/RNEventMapper.java index 683ea54e..57f73675 100644 --- a/android/app/src/main/java/io/mosip/residentapp/RNEventMapper.java +++ b/android/app/src/main/java/io/mosip/residentapp/RNEventMapper.java @@ -4,14 +4,12 @@ import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.WritableMap; import io.mosip.tuvali.common.events.*; -import java.lang.reflect.Field; - public class RNEventMapper { public static WritableMap toMap(Event event) { WritableMap writableMap = Arguments.createMap(); writableMap.putString("type", getEventType(event)); - populateProperties(event, writableMap); + populateEventFields(event, writableMap); return writableMap; } @@ -36,37 +34,23 @@ public class RNEventMapper { } } - private static void populateProperties(Event event, WritableMap writableMap) { - for (Field field : event.getClass().getDeclaredFields()) { - try { - field.setAccessible(true); - populateProperty(field, event, writableMap); - field.setAccessible(false); - } catch (Exception e) { - System.out.println("Unable to populate RN event " + field.getName()); - } - } - } + private static void populateEventFields(Event event, WritableMap map) { + if (event instanceof DataReceivedEvent) { + DataReceivedEvent e = (DataReceivedEvent) event; + map.putString("data", e.getData()); + map.putInt("crcFailureCount", e.getCrcFailureCount()); + map.putInt("totalChunkCount", e.getTotalChunkCount()); - private static void populateProperty(Field field, Event event, WritableMap writableMap) throws IllegalAccessException { - Object propertyValue = field.get(event); - if (propertyValue instanceof Enum) { - propertyValue = readEnumValue((Enum) propertyValue); - } - if (propertyValue instanceof Integer) { - writableMap.putInt(field.getName(), (Integer) propertyValue); - } else { - writableMap.putString(field.getName(), propertyValue.toString()); - } - } + } else if (event instanceof ErrorEvent) { + ErrorEvent e = (ErrorEvent) event; + map.putString("message", e.getMessage()); + map.putString("code", e.getCode()); + + } else if (event instanceof VerificationStatusEvent) { + VerificationStatusEvent e = (VerificationStatusEvent) event; + map.putInt("status", e.getStatus().getValue()); - private static Object readEnumValue(Enum enumValue) { - try { - Field valueField = enumValue.getClass().getDeclaredField("value"); - valueField.setAccessible(true); - return valueField.get(enumValue); - } catch (Exception e) { - return enumValue.ordinal(); } + // ConnectedEvent, DisconnectedEvent, SecureChannelEstablishedEvent have no extra fields } } diff --git a/ios/Inji/AppDelegate.h b/ios/Inji/AppDelegate.h index 1514e028..ff99e11a 100644 --- a/ios/Inji/AppDelegate.h +++ b/ios/Inji/AppDelegate.h @@ -1,12 +1,9 @@ #import #import #import -#import "RNAppAuthAuthorizationFlowManager.h" #import -@interface AppDelegate : EXAppDelegateWrapper +@interface AppDelegate : EXAppDelegateWrapper -@property(nonatomic, weak)idauthorizationFlowManagerDelegate; - -@end \ No newline at end of file +@end diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 53a0f15e..cb444502 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1126,9 +1126,6 @@ PODS: - React-Mapbuffer (0.74.5): - glog - React-debug - - react-native-app-auth (7.2.0): - - AppAuth (>= 1.7.3) - - React-Core - react-native-cloud-storage (1.4.0): - DoubleConversion - glog @@ -1482,7 +1479,7 @@ PODS: - React-Core - RNPermissions (3.8.4): - React-Core - - RNScreens (3.31.1): + - RNScreens (3.33.0): - DoubleConversion - glog - hermes-engine @@ -1597,7 +1594,6 @@ DEPENDENCIES: - React-jsitracing (from `../node_modules/react-native/ReactCommon/hermes/executor/`) - React-logger (from `../node_modules/react-native/ReactCommon/logger`) - React-Mapbuffer (from `../node_modules/react-native/ReactCommon`) - - react-native-app-auth (from `../node_modules/react-native-app-auth`) - react-native-cloud-storage (from `../node_modules/react-native-cloud-storage`) - react-native-get-random-values (from `../node_modules/react-native-get-random-values`) - "react-native-image-editor (from `../node_modules/@react-native-community/image-editor`)" @@ -1798,8 +1794,6 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/logger" React-Mapbuffer: :path: "../node_modules/react-native/ReactCommon" - react-native-app-auth: - :path: "../node_modules/react-native-app-auth" react-native-cloud-storage: :path: "../node_modules/react-native-cloud-storage" react-native-get-random-values: @@ -1983,7 +1977,6 @@ SPEC CHECKSUMS: React-jsitracing: 3b6060bbf5317663667e1dd93560c7943ab86ccc React-logger: 257858bd55f3a4e1bc0cf07ddc8fb9faba6f8c7c React-Mapbuffer: 6c1cacdbf40b531f549eba249e531a7d0bfd8e7f - react-native-app-auth: 63fa4e58c5bd29aeb974d3a06a23c5858322d533 react-native-cloud-storage: 15f24d9b9f175ce07473c3af86b6add72a727c95 react-native-get-random-values: 21325b2244dfa6b58878f51f9aa42821e7ba3d06 react-native-image-editor: b09448ba9171308ff5ac6c9f66f49ad4cbfaee06 @@ -2029,7 +2022,7 @@ SPEC CHECKSUMS: RNGoogleSignin: aac5c1ec73422109dec1da770247a1e410dcc620 RNLocalize: 298e85ce16540a11de40c1a588ead39fc5e9a072 RNPermissions: f1b49dd05fa9b83993cd05a9ee115247944d8f1a - RNScreens: b32a9ff15bea7fcdbe5dff6477bc503f792b1208 + RNScreens: d2a12528d1abe4922e7ee5c9a00dd40c827c2ab5 RNSecureRandom: 07efbdf2cd99efe13497433668e54acd7df49fef RNShare: 0fad69ae2d71de9d1f7b9a43acf876886a6cb99c RNSVG: 43b64ed39c14ce830d840903774154ca0c1f27ec diff --git a/machines/openID4VP/openID4VPMachine.typegen.ts b/machines/openID4VP/openID4VPMachine.typegen.ts index 20bd448f..e69de29b 100644 --- a/machines/openID4VP/openID4VPMachine.typegen.ts +++ b/machines/openID4VP/openID4VPMachine.typegen.ts @@ -1,104 +0,0 @@ - - // This file was automatically generated. Edits will be overwritten - - export interface Typegen0 { - '@@xstate/typegen': true; - internalEvents: { - "done.invoke.OpenID4VP.authenticateVerifier:invocation[0]": { type: "done.invoke.OpenID4VP.authenticateVerifier:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." }; -"done.invoke.OpenID4VP.checkIfClientValidationIsRequired:invocation[0]": { type: "done.invoke.OpenID4VP.checkIfClientValidationIsRequired:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." }; -"done.invoke.OpenID4VP.checkKeyPair:invocation[0]": { type: "done.invoke.OpenID4VP.checkKeyPair:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." }; -"done.invoke.OpenID4VP.checkVerifierTrust:invocation[0]": { type: "done.invoke.OpenID4VP.checkVerifierTrust:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." }; -"done.invoke.OpenID4VP.getKeyPairFromKeystore:invocation[0]": { type: "done.invoke.OpenID4VP.getKeyPairFromKeystore:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." }; -"done.invoke.OpenID4VP.getTrustedVerifiersList:invocation[0]": { type: "done.invoke.OpenID4VP.getTrustedVerifiersList:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." }; -"done.invoke.OpenID4VP.sendingVP:invocation[0]": { type: "done.invoke.OpenID4VP.sendingVP:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." }; -"done.invoke.OpenID4VP.storeTrustedVerifier:invocation[0]": { type: "done.invoke.OpenID4VP.storeTrustedVerifier:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." }; -"error.platform.OpenID4VP.authenticateVerifier:invocation[0]": { type: "error.platform.OpenID4VP.authenticateVerifier:invocation[0]"; data: unknown }; -"error.platform.OpenID4VP.checkKeyPair:invocation[0]": { type: "error.platform.OpenID4VP.checkKeyPair:invocation[0]"; data: unknown }; -"error.platform.OpenID4VP.checkVerifierTrust:invocation[0]": { type: "error.platform.OpenID4VP.checkVerifierTrust:invocation[0]"; data: unknown }; -"error.platform.OpenID4VP.getKeyPairFromKeystore:invocation[0]": { type: "error.platform.OpenID4VP.getKeyPairFromKeystore:invocation[0]"; data: unknown }; -"error.platform.OpenID4VP.getTrustedVerifiersList:invocation[0]": { type: "error.platform.OpenID4VP.getTrustedVerifiersList:invocation[0]"; data: unknown }; -"error.platform.OpenID4VP.sendingVP:invocation[0]": { type: "error.platform.OpenID4VP.sendingVP:invocation[0]"; data: unknown }; -"xstate.after(200)#OpenID4VP.delayBeforeDismissToParent": { type: "xstate.after(200)#OpenID4VP.delayBeforeDismissToParent" }; -"xstate.init": { type: "xstate.init" }; -"xstate.stop": { type: "xstate.stop" }; - }; - invokeSrcNameMap: { - "fetchTrustedVerifiers": "done.invoke.OpenID4VP.getTrustedVerifiersList:invocation[0]"; -"getAuthenticationResponse": "done.invoke.OpenID4VP.authenticateVerifier:invocation[0]"; -"getKeyPair": "done.invoke.OpenID4VP.getKeyPairFromKeystore:invocation[0]"; -"getSelectedKey": "done.invoke.OpenID4VP.checkKeyPair:invocation[0]"; -"isVerifierTrusted": "done.invoke.OpenID4VP.checkVerifierTrust:invocation[0]"; -"sendVP": "done.invoke.OpenID4VP.sendingVP:invocation[0]"; -"shouldValidateClient": "done.invoke.OpenID4VP.checkIfClientValidationIsRequired:invocation[0]"; -"storeTrustedVerifier": "done.invoke.OpenID4VP.storeTrustedVerifier:invocation[0]"; - }; - missingImplementations: { - actions: "compareAndStoreSelectedVC" | "dismissTrustModal" | "forwardToParent" | "getFaceAuthConsent" | "getVcsMatchingAuthRequest" | "incrementOpenID4VPRetryCount" | "loadKeyPair" | "logActivity" | "resetError" | "resetFaceCaptureBannerStatus" | "resetIsFaceVerificationRetryAttempt" | "resetIsShareWithSelfie" | "resetIsShowLoadingScreen" | "resetOpenID4VPRetryCount" | "setAuthenticationError" | "setAuthenticationResponse" | "setError" | "setFlowType" | "setIsFaceVerificationRetryAttempt" | "setIsOVPViaDeepLink" | "setIsShareWithSelfie" | "setIsShowLoadingScreen" | "setMiniViewShareSelectedVC" | "setSelectedVCs" | "setSendVPShareError" | "setShareLogTypeUnverified" | "setShowFaceAuthConsent" | "setTrustedVerifiers" | "setTrustedVerifiersApiCallError" | "setUrlEncodedAuthorizationRequest" | "shareDeclineStatus" | "showTrustConsentModal" | "storeShowFaceAuthConsent" | "updateFaceCaptureBannerStatus" | "updateShowFaceAuthConsent"; - delays: never; - guards: "hasKeyPair" | "isAnyVCHasImage" | "isClientValidationRequred" | "isFaceVerificationRetryAttempt" | "isSelectedVCMatchingRequest" | "isShareWithSelfie" | "isSimpleOpenID4VPShare" | "showFaceAuthConsentScreen"; - services: "fetchTrustedVerifiers" | "getAuthenticationResponse" | "getKeyPair" | "getSelectedKey" | "isVerifierTrusted" | "sendVP" | "shouldValidateClient" | "storeTrustedVerifier"; - }; - eventsCausingActions: { - "compareAndStoreSelectedVC": "SET_SELECTED_VC"; -"dismissTrustModal": "CANCEL" | "VERIFIER_TRUST_CONSENT_GIVEN" | "done.invoke.OpenID4VP.checkVerifierTrust:invocation[0]" | "done.invoke.OpenID4VP.storeTrustedVerifier:invocation[0]"; -"forwardToParent": "CANCEL" | "DISMISS_POPUP"; -"getFaceAuthConsent": "AUTHENTICATE"; -"getVcsMatchingAuthRequest": "DOWNLOADED_VCS"; -"incrementOpenID4VPRetryCount": "RETRY"; -"loadKeyPair": "done.invoke.OpenID4VP.getKeyPairFromKeystore:invocation[0]"; -"logActivity": "LOG_ACTIVITY"; -"resetError": "RESET_ERROR" | "RESET_RETRY_COUNT" | "RETRY"; -"resetFaceCaptureBannerStatus": "ACCEPT_REQUEST" | "CLOSE_BANNER"; -"resetIsFaceVerificationRetryAttempt": "DISMISS"; -"resetIsShareWithSelfie": "CANCEL" | "DISMISS_POPUP"; -"resetIsShowLoadingScreen": "DISMISS_POPUP" | "done.invoke.OpenID4VP.authenticateVerifier:invocation[0]" | "error.platform.OpenID4VP.authenticateVerifier:invocation[0]" | "xstate.stop"; -"resetOpenID4VPRetryCount": "RESET_RETRY_COUNT"; -"setAuthenticationError": "error.platform.OpenID4VP.authenticateVerifier:invocation[0]"; -"setAuthenticationResponse": "done.invoke.OpenID4VP.authenticateVerifier:invocation[0]"; -"setError": "error.platform.OpenID4VP.checkKeyPair:invocation[0]" | "error.platform.OpenID4VP.getKeyPairFromKeystore:invocation[0]"; -"setFlowType": "AUTHENTICATE"; -"setIsFaceVerificationRetryAttempt": "FACE_INVALID"; -"setIsOVPViaDeepLink": "AUTHENTICATE"; -"setIsShareWithSelfie": "AUTHENTICATE"; -"setIsShowLoadingScreen": "AUTHENTICATE"; -"setMiniViewShareSelectedVC": "AUTHENTICATE"; -"setSelectedVCs": "ACCEPT_REQUEST" | "VERIFY_AND_ACCEPT_REQUEST"; -"setSendVPShareError": "error.platform.OpenID4VP.sendingVP:invocation[0]"; -"setShareLogTypeUnverified": "ACCEPT_REQUEST"; -"setShowFaceAuthConsent": "FACE_VERIFICATION_CONSENT"; -"setTrustedVerifiers": "done.invoke.OpenID4VP.getTrustedVerifiersList:invocation[0]"; -"setTrustedVerifiersApiCallError": "error.platform.OpenID4VP.getTrustedVerifiersList:invocation[0]"; -"setUrlEncodedAuthorizationRequest": "AUTHENTICATE"; -"shareDeclineStatus": "CONFIRM"; -"showTrustConsentModal": "done.invoke.OpenID4VP.checkVerifierTrust:invocation[0]" | "error.platform.OpenID4VP.checkVerifierTrust:invocation[0]"; -"storeShowFaceAuthConsent": "FACE_VERIFICATION_CONSENT"; -"updateFaceCaptureBannerStatus": "FACE_VALID"; -"updateShowFaceAuthConsent": "done.invoke.OpenID4VP.checkIfClientValidationIsRequired:invocation[0]"; - }; - eventsCausingDelays: { - "SHARING_TIMEOUT": "CONFIRM" | "FACE_VALID" | "RETRY"; - }; - eventsCausingGuards: { - "hasKeyPair": "FACE_VALID" | "done.invoke.OpenID4VP.checkKeyPair:invocation[0]"; -"isAnyVCHasImage": "CHECK_FOR_IMAGE"; -"isClientValidationRequred": "done.invoke.OpenID4VP.checkIfClientValidationIsRequired:invocation[0]"; -"isFaceVerificationRetryAttempt": "FACE_INVALID"; -"isSelectedVCMatchingRequest": "CHECK_SELECTED_VC"; -"isShareWithSelfie": "CONFIRM" | "done.invoke.OpenID4VP.sendingVP:invocation[0]"; -"isSimpleOpenID4VPShare": "CANCEL" | "DISMISS" | "DISMISS_POPUP" | "DOWNLOADED_VCS" | "FACE_VERIFICATION_CONSENT"; -"showFaceAuthConsentScreen": "CONFIRM"; - }; - eventsCausingServices: { - "fetchTrustedVerifiers": "done.invoke.OpenID4VP.checkIfClientValidationIsRequired:invocation[0]"; -"getAuthenticationResponse": "done.invoke.OpenID4VP.checkKeyPair:invocation[0]"; -"getKeyPair": "done.invoke.OpenID4VP.checkIfClientValidationIsRequired:invocation[0]" | "done.invoke.OpenID4VP.getTrustedVerifiersList:invocation[0]"; -"getSelectedKey": "FACE_VALID" | "done.invoke.OpenID4VP.getKeyPairFromKeystore:invocation[0]"; -"isVerifierTrusted": "done.invoke.OpenID4VP.authenticateVerifier:invocation[0]"; -"sendVP": "CONFIRM" | "FACE_VALID" | "RETRY"; -"shouldValidateClient": "STORE_RESPONSE"; -"storeTrustedVerifier": "VERIFIER_TRUST_CONSENT_GIVEN"; - }; - matchesStates: "authenticateVerifier" | "checkFaceAuthConsent" | "checkIfAnySelectedVCHasImage" | "checkIfClientValidationIsRequired" | "checkIfMatchingVCsHasSelectedVC" | "checkKeyPair" | "checkVerifierTrust" | "delayBeforeDismissToParent" | "faceVerificationConsent" | "getConsentForVPSharing" | "getKeyPairFromKeystore" | "getTrustedVerifiersList" | "getVCsSatisfyingAuthRequest" | "invalidIdentity" | "requestVerifierConsent" | "selectingVCs" | "sendDismissToParent" | "sendingVP" | "setSelectedVC" | "shareVPDeclineStatusToVerifier" | "showConfirmationPopup" | "showError" | "storeTrustedVerifier" | "success" | "verifyingIdentity" | "waitingForData"; - tags: never; - } - \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 7930af9b..7ea631c6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -64,9 +64,9 @@ "react-i18next": "^11.16.6", "react-native": "0.74.5", "react-native-android-location-services-dialog-box": "^2.8.2", - "react-native-app-auth": "^7.1.1", "react-native-app-intro-slider": "^4.0.4", "react-native-argon2": "^2.0.1", + "react-native-base64": "^0.2.2", "react-native-biometrics-changed": "^1.1.8", "react-native-bluetooth-state-manager": "^1.3.2", "react-native-cli": "^2.0.1", @@ -25310,19 +25310,6 @@ "react-native": ">= 0.56.0" } }, - "node_modules/react-native-app-auth": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/react-native-app-auth/-/react-native-app-auth-7.2.0.tgz", - "integrity": "sha512-Vw7td8oXklM0nXcerz/6E8Y6Ww+yDRMSohREllYceUe1570kNI7EIwGhzF3+yKjI4QADi8m/LGb7GdwkDxM4XQ==", - "license": "MIT", - "dependencies": { - "invariant": "2.2.4", - "react-native-base64": "0.0.2" - }, - "peerDependencies": { - "react-native": ">=0.63.0" - } - }, "node_modules/react-native-app-intro-slider": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/react-native-app-intro-slider/-/react-native-app-intro-slider-4.0.4.tgz", @@ -25334,9 +25321,10 @@ "integrity": "sha512-/iOi0S+VVgS1gQGtQgL4ZxUVS4gz6Lav3bgIbtNmr9KbOunnBYzP6/yBe/XxkbpXvasHDwdQnuppOH/nuOBn7w==" }, "node_modules/react-native-base64": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/react-native-base64/-/react-native-base64-0.0.2.tgz", - "integrity": "sha512-Fu/J1a2y0X22EJDWqJR2oEa1fpP4gTFjYxk8ElJdt1Yak3HOXmFJ7EohLVHU2DaQkgmKfw8qb7u/48gpzveRbg==" + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/react-native-base64/-/react-native-base64-0.2.2.tgz", + "integrity": "sha512-9iDzlDQrJqRlgoi7GnO4dqK/7/6lpA3DFrArhp85tDB7ZI6wLr7luHihb/pX6jhm4zlHqOz2OYSGJ6PSgyUO1g==", + "license": "MIT" }, "node_modules/react-native-biometrics-changed": { "version": "1.1.8", @@ -49432,15 +49420,6 @@ "integrity": "sha512-zBTi0xJQoF6GdImRhXOCXezYuALlPgbctqG3eOrZu63hdrlvTBhqATkb6DB5JM9kpcMbX1skMIOI3m71zKGsPA==", "requires": {} }, - "react-native-app-auth": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/react-native-app-auth/-/react-native-app-auth-7.2.0.tgz", - "integrity": "sha512-Vw7td8oXklM0nXcerz/6E8Y6Ww+yDRMSohREllYceUe1570kNI7EIwGhzF3+yKjI4QADi8m/LGb7GdwkDxM4XQ==", - "requires": { - "invariant": "2.2.4", - "react-native-base64": "0.0.2" - } - }, "react-native-app-intro-slider": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/react-native-app-intro-slider/-/react-native-app-intro-slider-4.0.4.tgz", @@ -49452,9 +49431,9 @@ "integrity": "sha512-/iOi0S+VVgS1gQGtQgL4ZxUVS4gz6Lav3bgIbtNmr9KbOunnBYzP6/yBe/XxkbpXvasHDwdQnuppOH/nuOBn7w==" }, "react-native-base64": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/react-native-base64/-/react-native-base64-0.0.2.tgz", - "integrity": "sha512-Fu/J1a2y0X22EJDWqJR2oEa1fpP4gTFjYxk8ElJdt1Yak3HOXmFJ7EohLVHU2DaQkgmKfw8qb7u/48gpzveRbg==" + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/react-native-base64/-/react-native-base64-0.2.2.tgz", + "integrity": "sha512-9iDzlDQrJqRlgoi7GnO4dqK/7/6lpA3DFrArhp85tDB7ZI6wLr7luHihb/pX6jhm4zlHqOz2OYSGJ6PSgyUO1g==" }, "react-native-biometrics-changed": { "version": "1.1.8", diff --git a/package.json b/package.json index 6ba4979e..1f8937ca 100644 --- a/package.json +++ b/package.json @@ -69,9 +69,9 @@ "react-i18next": "^11.16.6", "react-native": "0.74.5", "react-native-android-location-services-dialog-box": "^2.8.2", - "react-native-app-auth": "^7.1.1", "react-native-app-intro-slider": "^4.0.4", "react-native-argon2": "^2.0.1", + "react-native-base64": "^0.2.2", "react-native-biometrics-changed": "^1.1.8", "react-native-bluetooth-state-manager": "^1.3.2", "react-native-cli": "^2.0.1",