Files
inji-wallet/shared/constants.ts
PuBHARGAVI fe3f8a56e1 fix(INJI-329): fix received card expand view and redirect the user to history screen after VC transfer (#799)
* fix(INJI-329): remove onboarding related code from MyVcs machine to show the expanded view of received card

Onboarding is used to check whether we need to show the intro sliders or not now it is handled differently in AppLayout

* fix(INJI-329): redirect the user to the history screen after successfull vc share

* fix(INJI-329): show incoming card screen on the verifier after closing the success popup

redirect the user to received cards screen if user clicks on view received card button and QR code screen if clicks on back button

* refactor(INJI-329): extract bottom tab, scan and request screen names into separate file to maintain the consistency

* refactor(INJI-329): remove activeTab from routeConstants as it is not being used

before new UI merge we have 3 different tabs in home screen and activeTab is used for displaying the current active tab
2023-09-12 13:34:21 +05:30

84 lines
2.4 KiB
TypeScript

import { Platform } from 'react-native';
import { VC } from '../types/vc';
import {
MIMOTO_HOST,
GOOGLE_NEARBY_MESSAGES_API_KEY,
} from 'react-native-dotenv';
import { Argon2iConfig } from './commonUtil';
export let HOST = MIMOTO_HOST;
export const changeCrendetialRegistry = (host) => (HOST = host);
export const MY_VCS_STORE_KEY = 'myVCs';
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) => {
individualId = ind_Id;
};
export const ACTIVITY_LOG_STORE_KEY = 'activityLog';
export const SETTINGS_STORE_KEY = 'settings';
export const GNM_API_KEY = GOOGLE_NEARBY_MESSAGES_API_KEY;
// https://developers.google.com/android/reference/com/google/android/gms/nearby/messages/Message#MAX_CONTENT_SIZE_BYTES
export const GNM_MESSAGE_LIMIT = 102400 - 6400; // allowance for metadata
export const APP_ID_LENGTH = 12;
// Numbers and Upper case Alphabets without confusing characters like 0, 1, 2, I, O, Z
// prettier-ignore
export const APP_ID_DICTIONARY = [
'3', '4', '5', '6', '7', '8', '9',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L',
'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
];
export function isIOS(): boolean {
return Platform.OS === 'ios';
}
// Configuration for argon2i hashing algorithm
export const argon2iConfig: Argon2iConfig = {
iterations: 5,
memory: 16 * 1024,
parallelism: 2,
hashLength: 20,
mode: 'argon2i',
};
export const argon2iConfigForUinVid: Argon2iConfig = {
iterations: 5,
memory: 16 * 1024,
parallelism: 2,
hashLength: 5,
mode: 'argon2i',
};
export const argon2iSalt =
'1234567891011121314151617181920212223242526272829303132333435363';