mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-09 05:27:57 -05:00
[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:
committed by
GitHub
parent
cbb68af5ad
commit
6c1e23a3d2
@@ -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
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user