Skip to content

Commit

Permalink
Inji-406: Update debug logs for tampered vc error (#901)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
tilak-puli authored Oct 10, 2023
1 parent 778a24a commit 4ccc4de
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions shared/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
Expand Down Expand Up @@ -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),
);
});
}

Expand Down

0 comments on commit 4ccc4de

Please sign in to comment.