Inji-406: Update debug logs for tampered vc error (#901)

* feat(inji-406): add logs for debugging tampered vc issues in received vcs as well

* feat(inji-406): add tag to identify logs for vc tampering
This commit is contained in:
Tilak Puli
2023-10-10 10:19:19 +05:30
committed by GitHub
parent 778a24ac99
commit 4ccc4de6c5

View File

@@ -24,7 +24,7 @@ import {
} from './cryptoutil/cryptoUtil';
import {VCMetadata} from './VCMetadata';
import {ENOENT, getItem} from '../machines/store';
import {MY_VCS_STORE_KEY} from './constants';
import {MY_VCS_STORE_KEY, RECEIVED_VCS_STORE_KEY} from './constants';
export const MMKV = new MMKVLoader().initialize();
const vcDirectoryPath = `${DocumentDirectoryPath}/inji/VC`;
@@ -83,11 +83,19 @@ class Storage {
const isCorrupted = await this.isCorruptedVC(key, encryptionKey, data);
if (isCorrupted) {
console.debug('VC is corrupted and will be deleted from storage');
console.debug('VC key: ', key);
console.debug('is Data null', data === null);
console.debug(
'[Inji-406]: VC is corrupted and will be deleted from storage',
);
console.debug('[Inji-406]: VC key: ', key);
console.debug('[Inji-406]: is Data null', data === null);
getItem(MY_VCS_STORE_KEY, [], encryptionKey).then(res => {
console.debug('vcKeys are ', res);
console.debug('[Inji-406]: vcKeys are ', JSON.stringify(res));
});
getItem(RECEIVED_VCS_STORE_KEY, null, encryptionKey).then(res => {
console.debug(
'[Inji-406]: received vcKeys is ',
JSON.stringify(res),
);
});
}