[INJIMOB-2415] store the wellknown data as object in activity log file (#1733)

Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com>
Co-authored-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com>
This commit is contained in:
Alka Prasad
2024-12-09 12:09:16 +05:30
committed by GitHub
parent 3090399e3c
commit 1c0cc471b3
2 changed files with 20 additions and 11 deletions

View File

@@ -269,19 +269,23 @@ export const getCredentialTypeFromWellKnown = (
wellknown: IssuerWellknownResponse,
credentialConfigurationId: string | undefined = undefined,
): string => {
if (credentialConfigurationId !== undefined) {
const supportedCredentialsWellknown = getMatchingCredentialIssuerMetadata(
wellknown,
credentialConfigurationId,
try {
if (credentialConfigurationId !== undefined) {
const supportedCredentialsWellknown = getMatchingCredentialIssuerMetadata(
wellknown,
credentialConfigurationId,
);
return getCredentialType(supportedCredentialsWellknown);
}
console.error(
'credentialConfigurationId not available for fetching the Credential type',
);
return getCredentialType(supportedCredentialsWellknown);
throw new Error(
`Invalid credentialConfigurationId - ${credentialConfigurationId} passed`,
);
} catch (error) {
return i18n.t('VcDetails:identityCard');
}
console.error(
'credentialConfigurationId not available for fetching the Credential type',
);
throw new Error(
`Invalid credentialConfigurationId - ${credentialConfigurationId} passed`,
);
};
export class Display {

View File

@@ -6,6 +6,7 @@ import {StoreEvents} from './store';
import {VCActivityLog} from '../components/ActivityLogEvent';
import {IssuerWellknownResponse} from './VerifiableCredential/VCMetaMachine/vc';
import {VPShareActivityLog} from '../components/VPShareActivityLogEvent';
import {parseJSON} from '../shared/Utils';
const model = createModel(
{
@@ -155,6 +156,10 @@ export const activityLogMachine =
setAllWellknownConfigResponse: model.assign({
wellKnownIssuerMap: (_, event) => {
Object.entries(event.response).forEach(([key, value]) => {
event.response[key] = parseJSON(value);
});
return event.response as Record<string, Object>;
},
}),