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,6 +1,6 @@
import { assign, ContextFrom, EventFrom, send, StateFrom } from 'xstate';
import { createModel } from 'xstate/lib/model';
import { AppServices } from '../shared/GlobalContext';
import {assign, ContextFrom, EventFrom, send, StateFrom} from 'xstate';
import {createModel} from 'xstate/lib/model';
import {AppServices} from '../shared/GlobalContext';
import {
APP_ID_DICTIONARY,
APP_ID_LENGTH,
@@ -9,15 +9,15 @@ import {
SETTINGS_STORE_KEY,
ESIGNET_BASE_URL,
} from '../shared/constants';
import { VCLabel } from '../types/vc';
import { StoreEvents } from './store';
import {VCLabel} from '../types/vc';
import {StoreEvents} from './store';
import getAllConfigurations, {
COMMON_PROPS_KEY,
} from '../shared/commonprops/commonProps';
import Storage from '../shared/storage';
import ShortUniqueId from 'short-unique-id';
import { __AppId } from '../shared/GlobalVariables';
import { isCustomSecureKeystore } from '../shared/cryptoutil/cryptoUtil';
import {__AppId} from '../shared/GlobalVariables';
import {isCustomSecureKeystore} from '../shared/cryptoutil/cryptoUtil';
const model = createModel(
{
@@ -36,17 +36,17 @@ const model = createModel(
},
{
events: {
UPDATE_NAME: (name: string) => ({ name }),
UPDATE_VC_LABEL: (label: string) => ({ label }),
TOGGLE_BIOMETRIC_UNLOCK: (enable: boolean) => ({ enable }),
STORE_RESPONSE: (response: unknown) => ({ response }),
CHANGE_LANGUAGE: (language: string) => ({ language }),
UPDATE_NAME: (name: string) => ({name}),
UPDATE_VC_LABEL: (label: string) => ({label}),
TOGGLE_BIOMETRIC_UNLOCK: (enable: boolean) => ({enable}),
STORE_RESPONSE: (response: unknown) => ({response}),
CHANGE_LANGUAGE: (language: string) => ({language}),
UPDATE_MIMOTO_HOST: (credentialRegistry: string) => ({
credentialRegistry,
}),
UPDATE_ESIGNET_HOST: (esignetHostUrl: string) => ({ esignetHostUrl }),
UPDATE_ESIGNET_HOST: (esignetHostUrl: string) => ({esignetHostUrl}),
UPDATE_CREDENTIAL_REGISTRY_RESPONSE: (
credentialRegistryResponse: string
credentialRegistryResponse: string,
) => ({
credentialRegistryResponse: credentialRegistryResponse,
}),
@@ -55,7 +55,7 @@ const model = createModel(
CANCEL: () => ({}),
ACCEPT_HARDWARE_SUPPORT_NOT_EXISTS: () => ({}),
},
}
},
);
export const SettingsEvents = model.events;
@@ -81,8 +81,8 @@ export const settingsMachine = model.createMachine(
target: 'idle',
actions: ['setContext', 'updatePartialDefaults', 'storeContext'],
},
{ cond: 'hasData', target: 'idle', actions: ['setContext'] },
{ target: 'storingDefaults' },
{cond: 'hasData', target: 'idle', actions: ['setContext']},
{target: 'storingDefaults'},
],
},
},
@@ -165,7 +165,7 @@ export const settingsMachine = model.createMachine(
{
actions: {
requestStoredContext: send(StoreEvents.GET(SETTINGS_STORE_KEY), {
to: (context) => context.serviceRefs.store,
to: context => context.serviceRefs.store,
}),
updateDefaults: model.assign({
@@ -179,15 +179,15 @@ export const settingsMachine = model.createMachine(
}),
updatePartialDefaults: model.assign({
appId: (context) => context.appId || generateAppId(),
appId: context => context.appId || generateAppId(),
}),
storeContext: send(
(context) => {
const { serviceRefs, ...data } = context;
context => {
const {serviceRefs, ...data} = context;
return StoreEvents.SET(SETTINGS_STORE_KEY, data);
},
{ to: (context) => context.serviceRefs.store }
{to: context => context.serviceRefs.store},
),
setContext: model.assign((context, event) => {
@@ -255,7 +255,7 @@ export const settingsMachine = model.createMachine(
hasPartialData: (_, event) =>
event.response != null && event.response.appId == null,
},
}
},
);
export function createSettingsMachine(serviceRefs: AppServices) {