diff --git a/components/VcDetails.tsx b/components/VcDetails.tsx index e12965c9..c0bc02c0 100644 --- a/components/VcDetails.tsx +++ b/components/VcDetails.tsx @@ -23,6 +23,13 @@ const VerifiedIcon: React.FC = () => { export const VcDetails: React.FC = (props) => { const { t, i18n } = useTranslation('VcDetails'); + //Assigning the UIN and VID from the VC details to display the idtype label using condition + const uin = props.vc?.verifiableCredential.credentialSubject.UIN; + const vid = props.vc?.verifiableCredential.credentialSubject.VID; + + //Assigning the idtype based on the policy + const idType = uin ? t('uin') : vid ? t('vid') : t('idtype'); + return ( = (props) => { weight="bold" size="smaller" color={Theme.Colors.DetailsLabel}> - {props.vc?.idType} + {idType} - {props.vc?.id} + {uin ? uin : vid ? vid : null} diff --git a/components/VcItem.tsx b/components/VcItem.tsx index a261804a..04fe5952 100644 --- a/components/VcItem.tsx +++ b/components/VcItem.tsx @@ -109,13 +109,23 @@ export const VcItem: React.FC = (props) => { const service = useInterpret(machine.current); const context = useSelector(service, selectContext); const verifiableCredential = useSelector(service, selectVerifiableCredential); - const uin = useSelector(service, selectId); + + //Assigning the UIN and VID from the VC details to display the idtype label using condition + const uin = verifiableCredential + ? verifiableCredential.credentialSubject.UIN + : null; + const vid = verifiableCredential + ? verifiableCredential.credentialSubject.VID + : null; const tag = useSelector(service, selectTag); const generatedOn = useSelector(service, selectGeneratedOn); const fullName = !verifiableCredential ? '' : getLocalizedField(verifiableCredential.credentialSubject.fullName); + //Assigning the idtype based on the policy + const idtype = uin ? t('uin') : vid ? t('vid') : t('idtype'); + const id = tag || uin ? tag || uin : vid ? vid : null; const selectableOrCheck = props.selectable ? ( = (props) => { {getDetails(t('fullName'), fullName, verifiableCredential)} - {getDetails(t('uin'), tag || uin, verifiableCredential)} + {getDetails(idtype, id, verifiableCredential)} {getDetails(t('generatedOn'), generatedOn, verifiableCredential)} {getDetails(t('status'), t('valid'), verifiableCredential)} diff --git a/locales/en.json b/locales/en.json index 09f6743b..bc25d101 100644 --- a/locales/en.json +++ b/locales/en.json @@ -15,6 +15,8 @@ "VcDetails": { "generatedOn": "Generated on", "uin":"UIN", + "vid":"VID", + "idtype":"Idtype", "status": "Status", "valid": "Valid", "photo": "Photo", diff --git a/types/vc.ts b/types/vc.ts index 46cfb72f..180c8678 100644 --- a/types/vc.ts +++ b/types/vc.ts @@ -31,6 +31,7 @@ export interface DecodedCredential { export interface CredentialSubject { UIN: string; + VID: string; addressLine1: string; addressLine2: string; addressLine3: string;