[INJIMOB-3453] fix share-with-selfie not coming with vc with face (#2095)

* [INJIMOB-3453] fix share-with-selfie not coming with vc with face and remove mosip vc hardcoding

Signed-off-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com>

* [INJIMOB-3453] pass issuerHost instead of issuer name in activitylogs

Signed-off-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com>

* [INJIMOB-3453] exclude processed credentialdata data in ble share

Signed-off-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com>

* [INJIMOB-3453] refactor: rename vcHasImage to getFaceAtribute

Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com>

* [INJIMOB-3453] refactor: modify fallback for face in VC

Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com>

* [INJIMOB-3453] fix: inexisting function import

Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com>

---------

Signed-off-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com>
Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com>
Co-authored-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com>
This commit is contained in:
KiruthikaJeyashankar
2025-10-03 11:57:25 +05:30
committed by GitHub
parent cbb68af5ad
commit 6c1e23a3d2
16 changed files with 336 additions and 54 deletions

View File

@@ -152,7 +152,7 @@ export const getFieldValue = (
return null;
}
return getLocalizedField(value?.toString());
}
}
}
}
};
@@ -715,3 +715,32 @@ const ProtectedCurve = {
const PROOF_TYPE_ALGORITHM_MAP = {
[-7]: 'ES256',
};
export function getFaceAttribute(verifiableCredential, format) {
let credentialSubject = {};
if (format === VCFormat.ldp_vc) {
credentialSubject =
verifiableCredential?.credential?.credentialSubject ??
verifiableCredential?.verifiableCredential.credential.credentialSubject ?? {};
} else if (format === VCFormat.mso_mdoc) {
const nameSpaces =
verifiableCredential?.processedCredential?.issuerSigned?.nameSpaces ??
verifiableCredential?.processedCredential?.nameSpaces ??
{};
credentialSubject = Object.values(nameSpaces)
.flat()
.reduce((acc, item) => {
const key = item.elementIdentifier;
const value = item.elementValue;
acc[key] = value;
return acc;
}, {} as Record<string, any>);
} else if (format === VCFormat.vc_sd_jwt || format === VCFormat.dc_sd_jwt) {
credentialSubject =
verifiableCredential?.processedCredential?.fullResolvedPayload ?? {};
}
const faceField =
getFaceField(credentialSubject)
return faceField
}

View File

@@ -2,7 +2,7 @@ import {useTranslation} from 'react-i18next';
import {SvgImage} from './ui/svg';
import {useKebabPopUp} from './KebabPopUpController';
import {isActivationNeeded} from '../shared/openId4VCI/Utils';
import {isMosipVC, VCShareFlowType} from '../shared/Utils';
import {VCShareFlowType} from '../shared/Utils';
export const getKebabMenuOptions = props => {
const controller = useKebabPopUp(props);
@@ -68,7 +68,7 @@ export const getKebabMenuOptions = props => {
if (props.vcMetadata.isVerified) {
vcActionsList.splice(1, 0, share);
if (isMosipVC(props.vcMetadata.issuer)) {
if (props.vcHasImage) {
vcActionsList.splice(2, 0, shareWithSelfieOption, VCActivationOption);
}
if (props.vcMetadata.isExpired) {

View File

@@ -462,7 +462,7 @@ export const VCItemActions = model => {
VCActivityLog.getLogFromObject({
_vcKey: context.vcMetadata.getVcKey(),
type: 'VC_DOWNLOADED',
issuer: context.vcMetadata.issuer!!,
issuer: context.vcMetadata.issuerHost!!,
credentialConfigurationId:
context.verifiableCredential.credentialConfigurationId,
timestamp: Date.now(),
@@ -481,7 +481,7 @@ export const VCItemActions = model => {
VCActivityLog.getLogFromObject({
credentialConfigurationId:
context.verifiableCredential.credentialConfigurationId,
issuer: vcMetadata.issuer!!,
issuer: vcMetadata.issuerHost!!,
_vcKey: vcMetadata.getVcKey(),
type: 'VC_REMOVED',
timestamp: Date.now(),
@@ -502,7 +502,7 @@ export const VCItemActions = model => {
type: 'WALLET_BINDING_SUCCESSFULL',
credentialConfigurationId:
context.verifiableCredential.credentialConfigurationId,
issuer: vcMetadata.issuer!!,
issuer: vcMetadata.issuerHost!!,
timestamp: Date.now(),
deviceName: '',
}),
@@ -522,7 +522,7 @@ export const VCItemActions = model => {
type: 'WALLET_BINDING_FAILURE',
credentialConfigurationId:
context.verifiableCredential.credentialConfigurationId,
issuer: vcMetadata.issuer!!,
issuer: vcMetadata.issuerHost!!,
timestamp: Date.now(),
deviceName: '',
}),

View File

@@ -2,8 +2,8 @@ import {StateFrom} from 'xstate';
import {VCMetadata} from '../../../shared/VCMetadata';
import {VCItemMachine} from './VCItemMachine';
import {
getFaceField,
getMosipLogo,
getFaceAttribute,
} from '../../../components/VC/common/VCUtils';
import {
Credential,
@@ -48,30 +48,8 @@ export function selectVerifiableCredentialData(
state: State,
): VerifiableCredentialData {
const vcMetadata = new VCMetadata(state.context.vcMetadata);
const verifiableCredential = state.context.verifiableCredential;
let credentialSubject = {};
if (state.context?.format === VCFormat.ldp_vc) {
credentialSubject =
verifiableCredential?.credential?.credentialSubject ?? {};
} else if (state.context?.format === VCFormat.mso_mdoc) {
const nameSpaces =
verifiableCredential?.processedCredential?.issuerSigned?.nameSpaces ??
verifiableCredential?.processedCredential?.nameSpaces ??
{};
credentialSubject = Object.values(nameSpaces)
.flat()
.reduce((acc, item) => {
const key = item.elementIdentifier;
const value = item.elementValue;
acc[key] = value;
return acc;
}, {} as Record<string, any>);
} else if (state.context?.format === VCFormat.vc_sd_jwt || state.context?.format === VCFormat.dc_sd_jwt) {
credentialSubject =
verifiableCredential?.processedCredential?.fullResolvedPayload ?? {};
}
const faceField =
getFaceField(credentialSubject) ??
getFaceAttribute(state.context.verifiableCredential,state.context.format) ??
state.context.credential?.biometrics?.face;
return {

View File

@@ -0,0 +1,64 @@
// This file was automatically generated. Edits will be overwritten
export interface Typegen0 {
'@@xstate/typegen': true;
internalEvents: {
"done.invoke.vcMeta.ready.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]": { type: "done.invoke.vcMeta.ready.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.vcMeta.ready.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]";
};
missingImplementations: {
actions: "addVcToInProgressDownloads" | "getVcItemResponse" | "loadMyVcs" | "loadReceivedVcs" | "logTamperedVCsremoved" | "prependToMyVcsMetadata" | "removeDownloadFailedVcsFromStorage" | "removeDownloadingFailedVcsFromMyVcs" | "removeVcFromInProgressDownlods" | "removeVcFromMyVcsMetadata" | "resetDownloadCreadentialsFailed" | "resetDownloadCredentialsSuccess" | "resetDownloadFailedVcs" | "resetInProgressVcsDownloaded" | "resetTamperedVcs" | "resetVerificationErrorMessage" | "resetVerificationStatus" | "resetWalletBindingSuccess" | "sendBackupEvent" | "setDownloadCreadentialsFailed" | "setDownloadCredentialsSuccess" | "setDownloadedVc" | "setDownloadingFailedVcs" | "setMyVcs" | "setReceivedVcs" | "setUpdatedVcMetadatas" | "setVerificationErrorMessage" | "setVerificationStatus" | "setWalletBindingSuccess" | "updateMyVcsMetadata";
delays: never;
guards: "isAnyVcTampered" | "isSignedIn";
services: "isUserSignedAlready";
};
eventsCausingActions: {
"addVcToInProgressDownloads": "ADD_VC_TO_IN_PROGRESS_DOWNLOADS";
"getVcItemResponse": "GET_VC_ITEM";
"loadMyVcs": "REFRESH_MY_VCS" | "REFRESH_RECEIVED_VCS" | "STORE_RESPONSE" | "VERIFY_VC_FAILED" | "xstate.init";
"loadReceivedVcs": "REFRESH_RECEIVED_VCS" | "STORE_RESPONSE";
"logTamperedVCsremoved": "done.invoke.vcMeta.ready.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]";
"prependToMyVcsMetadata": "VC_ADDED";
"removeDownloadFailedVcsFromStorage": "DELETE_VC";
"removeDownloadingFailedVcsFromMyVcs": "STORE_RESPONSE";
"removeVcFromInProgressDownlods": "DOWNLOAD_LIMIT_EXPIRED" | "REMOVE_VC_FROM_IN_PROGRESS_DOWNLOADS" | "VERIFY_VC_FAILED";
"removeVcFromMyVcsMetadata": "REMOVE_VC_FROM_CONTEXT";
"resetDownloadCreadentialsFailed": "RESET_DOWNLOADING_FAILED";
"resetDownloadCredentialsSuccess": "RESET_DOWNLOADING_SUCCESS";
"resetDownloadFailedVcs": "STORE_RESPONSE";
"resetInProgressVcsDownloaded": "RESET_IN_PROGRESS_VCS_DOWNLOADED";
"resetTamperedVcs": "REMOVE_TAMPERED_VCS";
"resetVerificationErrorMessage": "RESET_VERIFY_ERROR";
"resetVerificationStatus": "RESET_VERIFICATION_STATUS";
"resetWalletBindingSuccess": "RESET_WALLET_BINDING_SUCCESS";
"sendBackupEvent": "done.invoke.vcMeta.ready.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]";
"setDownloadCreadentialsFailed": "VC_DOWNLOADING_FAILED";
"setDownloadCredentialsSuccess": "VC_DOWNLOADED";
"setDownloadedVc": "VC_DOWNLOADED";
"setDownloadingFailedVcs": "DOWNLOAD_LIMIT_EXPIRED";
"setMyVcs": "STORE_RESPONSE";
"setReceivedVcs": "STORE_RESPONSE";
"setUpdatedVcMetadatas": "VC_METADATA_UPDATED";
"setVerificationErrorMessage": "VERIFY_VC_FAILED";
"setVerificationStatus": "SET_VERIFICATION_STATUS";
"setWalletBindingSuccess": "WALLET_BINDING_SUCCESS";
"updateMyVcsMetadata": "VC_METADATA_UPDATED";
};
eventsCausingDelays: {
};
eventsCausingGuards: {
"isAnyVcTampered": "SHOW_TAMPERED_POPUP";
"isSignedIn": "done.invoke.vcMeta.ready.tamperedVCs.triggerAutoBackupForTamperedVcDeletion:invocation[0]";
};
eventsCausingServices: {
"isUserSignedAlready": "REMOVE_TAMPERED_VCS";
};
matchesStates: "deletingFailedVcs" | "ready" | "ready.myVcs" | "ready.receivedVcs" | "ready.showTamperedPopup" | "ready.tamperedVCs" | "ready.tamperedVCs.idle" | "ready.tamperedVCs.triggerAutoBackupForTamperedVcDeletion" | { "ready"?: "myVcs" | "receivedVcs" | "showTamperedPopup" | "tamperedVCs" | { "tamperedVCs"?: "idle" | "triggerAutoBackupForTamperedVcDeletion"; }; };
tags: never;
}

View File

@@ -115,7 +115,8 @@ export const activityLogMachine =
}),
setActivities: model.assign({
activities: (_, event) => (event.response || []) as VCActivityLog[],
activities: (_, event) => {
return (event.response || []) as VCActivityLog[]},
}),
storeActivity: send(

View File

@@ -623,7 +623,7 @@ export const requestMachine =
credentialConfigurationId:
context.incomingVc.verifiableCredential
.credentialConfigurationId,
issuer: vcMetadata.issuer!!,
issuer: vcMetadata.issuerHost!!,
timestamp: Date.now(),
deviceName:
context.senderInfo.name || context.senderInfo.deviceName,

View File

@@ -254,7 +254,7 @@ export const ScanActions = (model: any) => {
: 'VC_SHARED_WITH_VERIFICATION_CONSENT',
credentialConfigurationId:
context.selectedVc.verifiableCredential.credentialConfigurationId,
issuer: vcMetadata.issuer!!,
issuer: vcMetadata.issuerHost!!,
timestamp: Date.now(),
deviceName:
context.receiverInfo.name || context.receiverInfo.deviceName,
@@ -274,7 +274,7 @@ export const ScanActions = (model: any) => {
timestamp: Date.now(),
credentialConfigurationId:
context.selectedVc.verifiableCredential.credentialConfigurationId,
issuer: vcMetadata.issuer!!,
issuer: vcMetadata.issuerHost!!,
deviceName:
context.receiverInfo.name || context.receiverInfo.deviceName,
}),
@@ -362,7 +362,7 @@ export const ScanActions = (model: any) => {
return ActivityLogEvents.LOG_ACTIVITY(
VCActivityLog.getLogFromObject({
_vcKey: vcMetadata.getVcKey(),
issuer: vcMetadata.issuer!!,
issuer: vcMetadata.issuerHost!!,
credentialConfigurationId:
selectedVc.verifiableCredential.credentialConfigurationId,
type: 'QRLOGIN_SUCCESFULL',

View File

@@ -1,7 +1,7 @@
import {StateFrom} from 'xstate';
import {scanMachine} from './scanMachine';
import {VCMetadata} from '../../../shared/VCMetadata';
import {getMosipLogo} from '../../../components/VC/common/VCUtils';
import {getMosipLogo, getFaceAttribute} from '../../../components/VC/common/VCUtils';
type State = StateFrom<typeof scanMachine>;
@@ -30,6 +30,9 @@ export function selectCredential(state: State) {
export function selectVerifiableCredentialData(state: State) {
const vcMetadata = new VCMetadata(state.context.selectedVc?.vcMetadata);
const faceField =
getFaceAttribute(state.context.selectedVc,state.context.selectedVc?.format) ??
state.context.selectedVc?.credential?.biometrics?.face;
return [
{
vcMetadata: vcMetadata,
@@ -37,10 +40,7 @@ export function selectVerifiableCredentialData(state: State) {
issuerLogo:
state.context.selectedVc?.verifiableCredential?.issuerLogo ||
getMosipLogo(),
face:
state.context.selectedVc?.verifiableCredential?.credential
?.credentialSubject?.face ||
state.context.selectedVc?.credential?.biometrics?.face,
face:faceField,
wellKnown: state.context.selectedVc?.verifiableCredential?.wellKnown,
},
];

View File

@@ -1,5 +1,5 @@
import {isLocationEnabled} from 'react-native-device-info';
import Storage, { isMinimumStorageLimitReached } from '../../../shared/storage';
import { isMinimumStorageLimitReached } from '../../../shared/storage';
import BluetoothStateManager from 'react-native-bluetooth-state-manager';
import {
check,
@@ -169,10 +169,10 @@ export const ScanServices = (model: any) => {
});
}
};
const { processedCredential, ...rest } = context.selectedVc;
const payload = JSON.stringify(rest);
wallet.sendData(
JSON.stringify({
...context.selectedVc,
}),
payload
);
const subscription = subscribe(statusCallback);
return () => subscription?.remove();

View File

@@ -1,3 +1,4 @@
import { getFaceAttribute } from '../../components/VC/common/VCUtils';
import {VCShareFlowType} from '../../shared/Utils';
export const openID4VPGuards = () => {
@@ -25,7 +26,7 @@ export const openID4VPGuards = () => {
const hasImage = Object.values(context.selectedVCs)
.flatMap(vc => vc)
.some(
vc => vc.verifiableCredential?.credential?.credentialSubject?.face,
vc => getFaceAttribute(vc.verifiableCredential,vc.format) != null,
);
return !!hasImage;
},

View File

@@ -0,0 +1,104 @@
// 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;
}

View File

@@ -0,0 +1,107 @@
// 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.checkFreshInstall:invocation[0]": { type: "done.invoke.store.checkFreshInstall:invocation[0]"; 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: {
"checkFreshInstall": "done.invoke.store.checkFreshInstall:invocation[0]";
"checkStorageInitialisedOrNot": "done.invoke.store.checkStorageInitialisation:invocation[0]";
"clear": "done.invoke.store.resettingStorage:invocation[0]";
"clearKeys": "done.invoke.store.clearIosKeys:invocation[0]";
"generateEncryptionKey": "done.invoke.store.generatingEncryptionKey:invocation[0]";
"getEncryptionKey": "done.invoke.store.gettingEncryptionKey:invocation[0]";
"hasEncryptionKey": "done.invoke.store.checkEncryptionKey:invocation[0]";
"store": "done.invoke._store";
};
missingImplementations: {
actions: never;
delays: never;
guards: never;
services: never;
};
eventsCausingActions: {
"forwardStoreRequest": "APPEND" | "CLEAR" | "EXPORT" | "FETCH_ALL_WELLKNOWN_CONFIG" | "GET" | "GET_VCS_DATA" | "PREPEND" | "REMOVE" | "REMOVE_ITEMS" | "REMOVE_VC_METADATA" | "RESTORE_BACKUP" | "SET" | "UPDATE";
"notifyParent": "KEY_RECEIVED" | "READY" | "done.invoke.store.resettingStorage:invocation[0]";
"setEncryptionKey": "KEY_RECEIVED";
};
eventsCausingDelays: {
};
eventsCausingGuards: {
"hasData": "done.invoke.store.checkFreshInstall:invocation[0]";
"isCustomSecureKeystore": "KEY_RECEIVED";
};
eventsCausingServices: {
"checkFreshInstall": "BIOMETRIC_CANCELLED" | "xstate.init";
"checkStorageInitialisedOrNot": "ERROR";
"clear": "KEY_RECEIVED";
"clearKeys": "done.invoke.store.checkFreshInstall:invocation[0]";
"generateEncryptionKey": "ERROR" | "IGNORE" | "READY";
"getEncryptionKey": "TRY_AGAIN";
"hasEncryptionKey": never;
"store": "KEY_RECEIVED" | "READY" | "done.invoke.store.resettingStorage:invocation[0]";
};
matchesStates: "checkEncryptionKey" | "checkFreshInstall" | "checkStorageInitialisation" | "clearIosKeys" | "failedReadingKey" | "generatingEncryptionKey" | "gettingEncryptionKey" | "ready" | "resettingStorage";
tags: never;
}
// 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.checkFreshInstall:invocation[0]": { type: "done.invoke.store.checkFreshInstall:invocation[0]"; 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: {
"checkFreshInstall": "done.invoke.store.checkFreshInstall:invocation[0]";
"checkStorageInitialisedOrNot": "done.invoke.store.checkStorageInitialisation:invocation[0]";
"clear": "done.invoke.store.resettingStorage:invocation[0]";
"clearKeys": "done.invoke.store.clearIosKeys:invocation[0]";
"generateEncryptionKey": "done.invoke.store.generatingEncryptionKey:invocation[0]";
"getEncryptionKey": "done.invoke.store.gettingEncryptionKey:invocation[0]";
"hasEncryptionKey": "done.invoke.store.checkEncryptionKey:invocation[0]";
"store": "done.invoke._store";
};
missingImplementations: {
actions: never;
delays: never;
guards: never;
services: never;
};
eventsCausingActions: {
"forwardStoreRequest": "APPEND" | "CLEAR" | "EXPORT" | "FETCH_ALL_WELLKNOWN_CONFIG" | "GET" | "GET_VCS_DATA" | "PREPEND" | "REMOVE" | "REMOVE_ITEMS" | "REMOVE_VC_METADATA" | "RESTORE_BACKUP" | "SET" | "UPDATE";
"notifyParent": "KEY_RECEIVED" | "READY" | "done.invoke.store.resettingStorage:invocation[0]";
"setEncryptionKey": "KEY_RECEIVED";
};
eventsCausingDelays: {
};
eventsCausingGuards: {
"hasData": "done.invoke.store.checkFreshInstall:invocation[0]";
"isCustomSecureKeystore": "KEY_RECEIVED";
};
eventsCausingServices: {
"checkFreshInstall": "BIOMETRIC_CANCELLED" | "xstate.init";
"checkStorageInitialisedOrNot": "ERROR";
"clear": "KEY_RECEIVED";
"clearKeys": "done.invoke.store.checkFreshInstall:invocation[0]";
"generateEncryptionKey": "ERROR" | "IGNORE" | "READY";
"getEncryptionKey": "TRY_AGAIN";
"hasEncryptionKey": never;
"store": "KEY_RECEIVED" | "READY" | "done.invoke.store.resettingStorage:invocation[0]";
};
matchesStates: "checkEncryptionKey" | "checkFreshInstall" | "checkStorageInitialisation" | "clearIosKeys" | "failedReadingKey" | "generatingEncryptionKey" | "gettingEncryptionKey" | "ready" | "resettingStorage";
tags: never;
}

View File

@@ -42,14 +42,13 @@ import {selectShareableVcs} from '../../machines/VerifiableCredential/VCMetaMach
import {RootRouteProps} from '../../routes';
import {BOTTOM_TAB_ROUTES} from '../../routes/routesConstants';
import {GlobalContext} from '../../shared/GlobalContext';
import {formatTextWithGivenLimit, isMosipVC} from '../../shared/Utils';
import {formatTextWithGivenLimit} from '../../shared/Utils';
import {VCMetadata} from '../../shared/VCMetadata';
import {VPShareOverlayProps} from './VPShareOverlay';
import {ActivityLogEvents} from '../../machines/activityLog';
import {VPShareActivityLog} from '../../components/VPShareActivityLogEvent';
import {SelectedCredentialsForVPSharing} from '../../machines/VerifiableCredential/VCMetaMachine/vc';
import {isIOS} from '../../shared/constants';
import { verifier } from '../../shared/tuvali';
import { getFaceAttribute } from '../../components/VC/common/VCUtils';
type MyVcsTabNavigation = NavigationProp<RootRouteProps>;
@@ -98,14 +97,14 @@ export function useSendVPScreen() {
return Object.values(vcs)
.flatMap(vc => vc)
.some(vc => {
return isMosipVC(vc.vcMetadata?.issuer);
return getFaceAttribute(vc.verifiableCredential,vc.format) != null;
});
};
const checkIfAllVCsHasImage = vcs => {
return Object.values(vcs)
.flatMap(vc => vc)
.every(vc => isMosipVC(vc.vcMetadata.issuer));
.every(vc => getFaceAttribute(vc.verifiableCredential,vc.format) != null);
};
const getSelectedVCs = (): Record<string, any[]> => {

View File

@@ -17,7 +17,6 @@ import {
import {TelemetryConstants} from '../../shared/telemetry/TelemetryConstants';
import {
getVCsOrderedByPinStatus,
isMosipVC,
VCItemContainerFlowType,
} from '../../shared/Utils';
import {FaceVerificationAlertOverlay} from './FaceVerificationAlertOverlay';
@@ -33,7 +32,6 @@ export const SendVcScreen: React.FC = () => {
controller.shareableVcsMetadata,
);
let service;
if (shareableVcsMetadataOrderedByPinStatus?.length > 0) {
const vcMetadata = shareableVcsMetadataOrderedByPinStatus[0];
const firstVCMachine = useRef(
@@ -102,7 +100,7 @@ export const SendVcScreen: React.FC = () => {
<Column
style={Theme.SendVcScreenStyles.shareOptionButtonsContainer}
backgroundColor={Theme.Colors.whiteBackgroundColor}>
{isMosipVC(controller.verifiableCredentialData[0].issuer) && (
{controller.verifiableCredentialData[0].face && (
<Button
type="gradient"
title={t('acceptRequestAndVerify')}

View File

@@ -91,6 +91,7 @@ export function useSendVcScreen() {
} = vcRef.getSnapshot().context;
const vcData = {
...rest,
processedCredential,
verifiableCredential: filteredVerifiableCredential,
};
scanService.send(