Inji-344: Refactoring VC Key (#798)

* feat(inji-344): Use VC Key class instead of separate functions for managing vc key

* feat(inji-344): Use properties from VcKey Class instead of reading from vckey string

* feat(inji-344): Rename vcKey to vcMetadata

* feat(inji-344): Use vc's unique id or vckey instead of joined string of vc metadata

* feat(inji-344): Use vc key instead of unique id to avoid confusion. Fix issues reg parsing vc metadata

* feat(inji-344):fix redownloading issue

Co-authored-by: Tilak <tilakpuli15@gmail.com>

* feat(inji-344): Remove vc getting stored on update of pin status

* feat(inji-344): update other vc's pin status to false when any vc is pinned

* feat(inji-344): remove hash ID for UIN

* feat(inji-344): revert google services json

* feat(inji-344): remove mmkv logs added for debugging

* feat(inji-344): fix received vcs not getting displayed on reopen of app

* feat(inji-344): fix id not shown in revoke component

---------

Co-authored-by: Sri Kanth Kola <srikanthsri7447@gmail.com>
This commit is contained in:
Tilak Puli
2023-09-20 16:51:59 +05:30
committed by GitHub
parent 43efe2a2fc
commit ec9fd9f6d9
61 changed files with 1006 additions and 968 deletions

View File

@@ -1,17 +1,16 @@
import { Platform } from 'react-native';
import { VC } from '../types/vc';
import {Platform} from 'react-native';
import {
MIMOTO_HOST,
ESIGNET_HOST,
GOOGLE_NEARBY_MESSAGES_API_KEY,
} from 'react-native-dotenv';
import { Argon2iConfig } from './commonUtil';
import {Argon2iConfig} from './commonUtil';
export let MIMOTO_BASE_URL = MIMOTO_HOST;
export let ESIGNET_BASE_URL = ESIGNET_HOST;
export const changeCrendetialRegistry = (host) => (MIMOTO_BASE_URL = host);
export const changeEsignetUrl = (host) => (ESIGNET_BASE_URL = host);
export const changeCrendetialRegistry = host => (MIMOTO_BASE_URL = host);
export const changeEsignetUrl = host => (ESIGNET_BASE_URL = host);
export const MY_VCS_STORE_KEY = 'myVCs';
@@ -19,23 +18,6 @@ export const RECEIVED_VCS_STORE_KEY = 'receivedVCs';
export const MY_LOGIN_STORE_KEY = 'myLogins';
export const VC_ITEM_STORE_KEY = (vc: Partial<VC>) =>
`vc:${vc.idType}:${vc.hashedId}:${vc.requestId}:${vc.isPinned}:${vc.id}`;
export const VC_ITEM_STORE_KEY_AFTER_DOWNLOAD = (vc: Partial<VC>) =>
`vc:${vc.idType}:${vc.hashedId}:${vc.requestId}:${vc.isPinned}`;
//Regex expression to evaluate if the key is for a VC
export const VC_ITEM_STORE_KEY_REGEX =
'^vc:(UIN|VID):[a-z0-9]+:[a-z0-9-]+:[true|false]+(:[0-9-]+)?$';
//To compare the vckey with requestId, when the vc is pinned
export const isSameVC = (vcKey: string, pinnedVcKey: string) => {
const requestId = vcKey.split(':')[3];
const pinnedRequestId = pinnedVcKey.split(':')[3];
return requestId === pinnedRequestId;
};
export let individualId = '';
export const GET_INDIVIDUAL_ID = (ind_Id: string) => {