mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-10 14:07:59 -05:00
[INJIMOB-1078] remove debug logs and comments
Signed-off-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com>
This commit is contained in:
@@ -60,8 +60,6 @@ export class ActivityLog {
|
||||
}
|
||||
|
||||
export function getActionText(activity: ActivityLog, t, wellknown: Object) {
|
||||
console.log('getActionText ', JSON.stringify(activity, null, 2));
|
||||
console.log('getActionText ', JSON.stringify(wellknown, null, 2));
|
||||
if (!!activity.credentialConfigurationId) {
|
||||
const cardType = getIdType(
|
||||
wellknown,
|
||||
|
||||
@@ -38,7 +38,6 @@ export const VCCardView: React.FC<VCItemProps> = props => {
|
||||
useEffect(() => {
|
||||
const {issuer, wellKnown, credentialConfigurationId, vcMetadata: {format}} =
|
||||
verifiableCredentialData;
|
||||
console.log('issuer ', issuer);
|
||||
if (wellKnown) {
|
||||
getCredentialIssuersWellKnownConfig(
|
||||
issuer,
|
||||
|
||||
@@ -14,13 +14,10 @@ import {CREDENTIAL_REGISTRY_EDIT} from 'react-native-dotenv';
|
||||
import {VCVerification} from '../../VCVerification';
|
||||
import {MIMOTO_BASE_URL} from '../../../shared/constants';
|
||||
import {VCItemDetailsProps} from '../Views/VCDetailView';
|
||||
import {
|
||||
getMatchingCredentialIssuerMetadata,
|
||||
iterateMsoMdocFor,
|
||||
} from '../../../shared/openId4VCI/Utils';
|
||||
import {getMatchingCredentialIssuerMetadata} from '../../../shared/openId4VCI/Utils';
|
||||
import {parseJSON} from '../../../shared/Utils';
|
||||
import {VCItemContentProps} from '../Views/VCCardViewContent';
|
||||
import { VCFormat } from '../../../shared/VCFormat';
|
||||
import {VCFormat} from '../../../shared/VCFormat';
|
||||
|
||||
export const CARD_VIEW_DEFAULT_FIELDS = ['fullName'];
|
||||
export const DETAIL_VIEW_DEFAULT_FIELDS = [
|
||||
@@ -52,6 +49,20 @@ export const BOTTOM_SECTION_FIELDS_WITH_DETAILED_ADDRESS_FIELDS = [
|
||||
'credentialRegistry',
|
||||
];
|
||||
|
||||
function iterateMsoMdocFor(
|
||||
credential,
|
||||
namespace: string,
|
||||
element: 'elementIdentifier' | 'elementValue',
|
||||
fieldName: string,
|
||||
) {
|
||||
const foundItem = credential['issuerSigned']['nameSpaces'][namespace].find(
|
||||
element => {
|
||||
return element.elementIdentifier === fieldName;
|
||||
},
|
||||
);
|
||||
return foundItem[element];
|
||||
}
|
||||
|
||||
export const getFieldValue = (
|
||||
verifiableCredential: Credential,
|
||||
field: string,
|
||||
@@ -85,16 +96,13 @@ export const getFieldValue = (
|
||||
} else if (format === VCFormat.mso_mdoc) {
|
||||
const splitField = field.split('~');
|
||||
if (splitField.length > 1) {
|
||||
console.log('splitField ', splitField);
|
||||
const [namespace, fieldName] = splitField;
|
||||
const iterateMsoMdocFor1 = iterateMsoMdocFor(
|
||||
return iterateMsoMdocFor(
|
||||
verifiableCredential,
|
||||
namespace,
|
||||
'elementValue',
|
||||
fieldName,
|
||||
);
|
||||
console.log('iterateMsoMdocFor1 ', iterateMsoMdocFor1);
|
||||
return iterateMsoMdocFor1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,7 +134,6 @@ export const getFieldName = (
|
||||
} else if (format === VCFormat.mso_mdoc) {
|
||||
const splitField = field.split('~');
|
||||
if (splitField.length > 1) {
|
||||
console.log('splitField ', splitField);
|
||||
const [namespace, fieldName] = splitField;
|
||||
const fieldObj = wellknown.claims[namespace][fieldName];
|
||||
if (fieldObj) {
|
||||
@@ -184,30 +191,12 @@ export const fieldItemIterator = (
|
||||
wellknown: any,
|
||||
props: VCItemDetailsProps,
|
||||
) => {
|
||||
console.log(
|
||||
'fields to be shown in VC detail view ',
|
||||
JSON.stringify(fields, null, 2),
|
||||
);
|
||||
return fields.map(field => {
|
||||
const fieldName = getFieldName(
|
||||
field,
|
||||
wellknown,
|
||||
props.verifiableCredentialData.vcMetadata.format,
|
||||
);
|
||||
console.log('fieldName ', fieldName);
|
||||
/**
|
||||
* fields - [
|
||||
"org.iso.18013.5.1~family_name",
|
||||
"org.iso.18013.5.1~given_name",
|
||||
"org.iso.18013.5.1~document_number",
|
||||
"org.iso.18013.5.1~issuing_country",
|
||||
"org.iso.18013.5.1~issue_date",
|
||||
"org.iso.18013.5.1~expiry_date",
|
||||
"org.iso.18013.5.1~birth_date",
|
||||
"status",
|
||||
"idType"
|
||||
]
|
||||
*/
|
||||
const fieldValue = getFieldValue(
|
||||
verifiableCredential,
|
||||
field,
|
||||
@@ -268,8 +257,6 @@ export const getIdType = (
|
||||
credentialConfigurationId: string | undefined = undefined,
|
||||
): string => {
|
||||
if (wellknown && wellknown?.display) {
|
||||
console.log('getIdType if case');
|
||||
|
||||
const idTypeObj = wellknown.display.map((displayProps: any) => {
|
||||
return {language: displayProps.locale, value: displayProps.name};
|
||||
});
|
||||
@@ -281,16 +268,16 @@ export const getIdType = (
|
||||
if (!!!wellknown['credential_configurations_supported']) {
|
||||
return i18n.t('VcDetails:nationalCard');
|
||||
}
|
||||
console.log('getIdType else if case');
|
||||
try {
|
||||
if (!!credentialConfigurationId) {
|
||||
console.log('credentialConfigurationId avl');
|
||||
supportedCredentialsWellknown = getMatchingCredentialIssuerMetadata(
|
||||
wellknown,
|
||||
credentialConfigurationId,
|
||||
);
|
||||
} else {
|
||||
console.error('credentialConfigurationId not available for fetching the ID type');
|
||||
console.error(
|
||||
'credentialConfigurationId not available for fetching the ID type',
|
||||
);
|
||||
throw new Error(
|
||||
`invalid credential credentialConfigurationId - ${credentialConfigurationId} passed`,
|
||||
);
|
||||
@@ -301,26 +288,16 @@ export const getIdType = (
|
||||
);
|
||||
return i18n.t('VcDetails:nationalCard');
|
||||
}
|
||||
console.log(
|
||||
'supportedCredentialsWellknown ',
|
||||
supportedCredentialsWellknown,
|
||||
);
|
||||
if (Object.keys(supportedCredentialsWellknown).length === 0) {
|
||||
return i18n.t('VcDetails:nationalCard');
|
||||
}
|
||||
return getIdType(supportedCredentialsWellknown);
|
||||
} else {
|
||||
console.log('getIdType else case');
|
||||
return i18n.t('VcDetails:nationalCard');
|
||||
}
|
||||
};
|
||||
|
||||
export function DisplayName(props: VCItemContentProps): string | Object {
|
||||
console.log('display name ', JSON.stringify(props.credential, null, 2));
|
||||
console.log(
|
||||
'props.verifiableCredentialData.format ',
|
||||
props.verifiableCredentialData.format,
|
||||
);
|
||||
if (props.verifiableCredentialData.format === VCFormat.mso_mdoc) {
|
||||
return props.credential['issuerSigned']['nameSpaces'][
|
||||
'org.iso.18013.5.1'
|
||||
|
||||
@@ -100,10 +100,6 @@ export const VCItemServices = model => {
|
||||
return response;
|
||||
},
|
||||
fetchIssuerWellknown: async context => {
|
||||
console.log(
|
||||
'VCItemServices fetchIssuerWellknown ',
|
||||
context.vcMetadata.issuer,
|
||||
);
|
||||
const wellknownResponse = await CACHED_API.fetchIssuerWellknownConfig(
|
||||
context.vcMetadata.issuer,
|
||||
true,
|
||||
|
||||
@@ -405,7 +405,6 @@ export const appMachine = model.createMachine(
|
||||
services: {
|
||||
isQrLoginByDeepLink: () => async () => {
|
||||
const data = await QrLoginIntent.isQrLoginByDeepLink();
|
||||
//console.log('DeepLink: ', data);
|
||||
return data;
|
||||
},
|
||||
resetQRLoginDeepLinkData: () => async () => {
|
||||
|
||||
@@ -128,7 +128,6 @@ export const getVCMetadata = (context: object, keyType: string) => {
|
||||
const getDisplayId = (
|
||||
verifiableCredential: VerifiableCredential | Credential,
|
||||
) => {
|
||||
console.log('getDisplayId ', JSON.stringify(verifiableCredential, null, 2));
|
||||
if (verifiableCredential?.credential) {
|
||||
if (verifiableCredential.credential?.credentialSubject) {
|
||||
return (
|
||||
|
||||
@@ -65,9 +65,7 @@ export const isActivationNeeded = (issuer: string) => {
|
||||
export const Issuers_Key_Ref = 'OpenId4VCI_KeyPair';
|
||||
|
||||
export const getIdentifier = (context, credential: VerifiableCredential) => {
|
||||
//TODO: Format specific
|
||||
const credentialIdentifier = credential.credential.id;
|
||||
console.log('credentialIdentifier ', credentialIdentifier);
|
||||
if (credentialIdentifier === undefined) {
|
||||
return (
|
||||
context.selectedIssuer.credential_issuer +
|
||||
@@ -172,7 +170,6 @@ export const getCredentialIssuersWellKnownConfig = async (
|
||||
) => {
|
||||
let fields: string[] = defaultFields;
|
||||
let matchingWellknownDetails: any;
|
||||
console.log('getCredentialIssuersWellKnownConfig ', issuer);
|
||||
const wellknownResponse = await CACHED_API.fetchIssuerWellknownConfig(issuer!);
|
||||
try {
|
||||
if (wellknownResponse) {
|
||||
@@ -183,7 +180,6 @@ export const getCredentialIssuersWellKnownConfig = async (
|
||||
if (Object.keys(matchingWellknownDetails).includes('order')) {
|
||||
fields = matchingWellknownDetails.order;
|
||||
} else {
|
||||
console.log('no order is there');
|
||||
if (format === VCFormat.mso_mdoc) {
|
||||
fields = []
|
||||
Object.keys(matchingWellknownDetails.claims).forEach(namespace => {
|
||||
@@ -277,40 +273,12 @@ export enum ErrorMessage {
|
||||
}
|
||||
|
||||
export function CredentialIdForMsoMdoc(credential: VerifiableCredential) {
|
||||
console.log(
|
||||
"JSON.stringify(CredentialIdForMsoMdoc's credential) ",
|
||||
JSON.stringify(credential, null, 2),
|
||||
);
|
||||
return credential.credential['issuerSigned']['nameSpaces'][
|
||||
'org.iso.18013.5.1'
|
||||
].find(element => element.elementIdentifier === 'document_number')
|
||||
.elementValue;
|
||||
}
|
||||
|
||||
export function iterateMsoMdocFor(
|
||||
credential,
|
||||
namespace: string,
|
||||
element: 'elementIdentifier' | 'elementValue',
|
||||
fieldName: string,
|
||||
) {
|
||||
console.log(
|
||||
'iterateMsoMdocFor credential ',
|
||||
JSON.stringify(credential, null, 2),
|
||||
);
|
||||
const foundItem = credential['issuerSigned']['nameSpaces'][namespace].find(
|
||||
element => {
|
||||
console.log(
|
||||
'element inside find bloack ',
|
||||
JSON.stringify(element, null, 2),
|
||||
);
|
||||
|
||||
return element.elementIdentifier === fieldName;
|
||||
},
|
||||
);
|
||||
console.log('finded ', foundItem);
|
||||
return foundItem[element];
|
||||
}
|
||||
|
||||
export async function constructProofJWT(
|
||||
publicKey: string,
|
||||
privateKey: string,
|
||||
|
||||
Reference in New Issue
Block a user