Skip to content

Commit

Permalink
Merge pull request #1728 from tw-mosip/fix-wellknown-error
Browse files Browse the repository at this point in the history
[INJIMOB-2415] store the wellknown data as object in activity log file
  • Loading branch information
sree96 authored Dec 5, 2024
2 parents 0cc262d + 67389c6 commit 9e8e167
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
26 changes: 15 additions & 11 deletions components/VC/common/VCUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
);
throw new Error(
`Invalid credentialConfigurationId - ${credentialConfigurationId} passed`,
);
return getCredentialType(supportedCredentialsWellknown);
} 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 {
Expand Down
5 changes: 5 additions & 0 deletions machines/activityLog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
{
Expand Down Expand Up @@ -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>;
},
}),
Expand Down

0 comments on commit 9e8e167

Please sign in to comment.