mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-09 13:38:01 -05:00
[INJIMOB-2526] update logic for vc search in homescreen & fix backup restore duplicate key in vc screen (#1737)
* [INJIMOB-2526] update logic for vc search in homescreen Signed-off-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com> * [INJIMOB-2522] fix backup restore duplicate key in vc screen Signed-off-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com> --------- Signed-off-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com>
This commit is contained in:
@@ -409,7 +409,7 @@
|
||||
}
|
||||
},
|
||||
"MyVcsTab": {
|
||||
"searchByName": "البحث عن طريق الإسم",
|
||||
"searchByName": "يبحث",
|
||||
"bringYourDigitalID": "أحضر هويتك الرقمية",
|
||||
"generateVcDescription": "اضغط على \"إضافة بطاقة \" أدناه لتنزيل بطاقتك",
|
||||
"generateVcFABDescription": "اضغط على \"+\" أدناه لتنزيل بطاقتك",
|
||||
|
||||
@@ -410,7 +410,7 @@
|
||||
}
|
||||
},
|
||||
"MyVcsTab": {
|
||||
"searchByName": "Search by name",
|
||||
"searchByName": "Search",
|
||||
"bringYourDigitalID": "Bring your digital identity",
|
||||
"generateVcDescription": "Tap on \"Download card\" below to download your card",
|
||||
"generateVcFABDescription": "Tap on \"+\" below to download your card",
|
||||
|
||||
@@ -409,7 +409,7 @@
|
||||
}
|
||||
},
|
||||
"MyVcsTab": {
|
||||
"searchByName": "Maghanap ayon sa pangalan",
|
||||
"searchByName": "Maghanap",
|
||||
"bringYourDigitalID": "Dalhin ang Iyong Digital ID",
|
||||
"generateVcDescription": "Upang i-download ang iyong card i-tap ang I-download card sa ibaba",
|
||||
"generateVcFABDescription": "Upang i-download ang iyong card i-tap ang + sa ibaba",
|
||||
|
||||
@@ -410,7 +410,7 @@
|
||||
}
|
||||
},
|
||||
"MyVcsTab": {
|
||||
"searchByName": "नाम से खोजें",
|
||||
"searchByName": "खोजें",
|
||||
"downloadCard": "डाउनलोड कार्ड",
|
||||
"bringYourDigitalID": "अपनी डिजिटल आईडी लाओ",
|
||||
"generateVcDescription": "अपना कार्ड डाउनलोड करने के लिए नीचे डाउनलोड कार्ड टैप करें",
|
||||
|
||||
@@ -409,7 +409,7 @@
|
||||
}
|
||||
},
|
||||
"MyVcsTab": {
|
||||
"searchByName": "ಹೆಸರಿನಿಂದ ಹುಡುಕಿ",
|
||||
"searchByName": "ಹುಡುಕು",
|
||||
"downloadCard": "ಕಾರ್ಡ್ ಡೌನ್ಲೋಡ್ ಮಾಡಿ",
|
||||
"bringYourDigitalID": "ನಿಮ್ಮ ಡಿಜಿಟಲ್ ಐಡಿ ತನ್ನಿ",
|
||||
"generateVcDescription": "ನಿಮ್ಮ ಕಾರ್ಡ್ ಅನ್ನು ಡೌನ್ಲೋಡ್ ಮಾಡಲು ಕೆಳಗಿನ ಡೌನ್ಲೋಡ್ ಕಾರ್ಡ್ ಅನ್ನು ಟ್ಯಾಪ್ ಮಾಡಿ",
|
||||
|
||||
@@ -409,7 +409,7 @@
|
||||
}
|
||||
},
|
||||
"MyVcsTab": {
|
||||
"searchByName": "பெயரால் தேடுங்கள்",
|
||||
"searchByName": "தேடு",
|
||||
"bringYourDigitalID": "உங்கள் டிஜிட்டல் ஐடியைக் கொண்டு வாருங்கள்",
|
||||
"generateVcDescription": "உங்கள் அட்டை ஐப் பதிவிறக்க, கீழே உள்ள பதிவிறக்கு அட்டை என்பதைத் தட்டவும்",
|
||||
"generateVcFABDescription": "உங்கள் அட்டை ஐப் பதிவிறக்க, கீழே உள்ள + என்பதைத் தட்டவும்",
|
||||
|
||||
@@ -84,8 +84,9 @@ export const MyVcsTab: React.FC<HomeScreenTabProps> = props => {
|
||||
const credentialSubject =
|
||||
vc.verifiableCredential.credentialSubject ||
|
||||
vc.verifiableCredential.credential.credentialSubject;
|
||||
|
||||
if (credentialSubject) {
|
||||
if(isStringAndContains(searchText,vc['vcMetadata'].credentialType))
|
||||
isVcFound=true
|
||||
else if (credentialSubject) {
|
||||
isVcFound = searchNestedCredentialFields(
|
||||
searchTextLower,
|
||||
credentialSubject,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
Credential,
|
||||
CredentialTypes,
|
||||
VC,
|
||||
VcIdType,
|
||||
VerifiableCredential,
|
||||
@@ -8,6 +9,7 @@ import {Protocols} from './openId4VCI/Utils';
|
||||
import {getMosipIdentifier} from './commonUtil';
|
||||
import {VCFormat} from './VCFormat';
|
||||
import {isMosipVC} from './Utils';
|
||||
import { getCredentialType } from '../components/VC/common/VCUtils';
|
||||
|
||||
const VC_KEY_PREFIX = 'VC';
|
||||
const VC_ITEM_STORE_KEY_REGEX = '^VC_[a-zA-Z0-9_-]+$';
|
||||
@@ -27,6 +29,7 @@ export class VCMetadata {
|
||||
isExpired: boolean = false;
|
||||
|
||||
downloadKeyType: string = '';
|
||||
credentialType: string = '';
|
||||
constructor({
|
||||
idType = '',
|
||||
requestId = '',
|
||||
@@ -40,6 +43,7 @@ export class VCMetadata {
|
||||
format = '',
|
||||
downloadKeyType = '',
|
||||
isExpired = false,
|
||||
credentialType = '',
|
||||
} = {}) {
|
||||
this.idType = idType;
|
||||
this.requestId = requestId;
|
||||
@@ -53,6 +57,7 @@ export class VCMetadata {
|
||||
this.format = format;
|
||||
this.downloadKeyType = downloadKeyType;
|
||||
this.isExpired = isExpired;
|
||||
this.credentialType = credentialType
|
||||
}
|
||||
|
||||
//TODO: Remove any typing and use appropriate typing
|
||||
@@ -74,6 +79,7 @@ export class VCMetadata {
|
||||
? vc.vcMetadata.mosipIndividualId
|
||||
: getMosipIndividualId(vc.verifiableCredential, vc.issuer),
|
||||
downloadKeyType: vc.downloadKeyType,
|
||||
credentialType: vc.credentialType
|
||||
});
|
||||
}
|
||||
|
||||
@@ -113,7 +119,7 @@ export function parseMetadatas(metadataStrings: object[]) {
|
||||
return metadataStrings.map(o => new VCMetadata(o));
|
||||
}
|
||||
|
||||
export const getVCMetadata = (context: object, keyType: string) => {
|
||||
export const getVCMetadata = (context: object, keyType: string, credType: CredentialTypes) => {
|
||||
const [issuer, protocol, credentialId] =
|
||||
context.credentialWrapper?.identifier.split(':');
|
||||
|
||||
@@ -131,6 +137,7 @@ export const getVCMetadata = (context: object, keyType: string) => {
|
||||
),
|
||||
format: context['credentialWrapper'].format,
|
||||
downloadKeyType: keyType,
|
||||
credentialType: getCredentialType(context.selectedCredentialType)
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ export const API_CACHED_STORAGE_KEYS = {
|
||||
fetchIssuerWellknownConfig: (issuerId: string) =>
|
||||
`CACHE_FETCH_ISSUER_WELLKNOWN_CONFIG_${issuerId}`,
|
||||
fetchIssuerAuthorizationServerMetadata: (authorizationServerUrl: string) =>
|
||||
`CACHE_FETCH_ISSUER_AUTHORIZATION_SERVER_METADATA_${authorizationServerUrl}`,
|
||||
`CACHE_FETCH_ISSUER_AUTHORIZATION_SERVER_METADATA_${authorizationServerUrl}`,
|
||||
fetchTrustedVerifiers: 'CACHE_FETCH_TRUSTED_VERIFIERS',
|
||||
};
|
||||
|
||||
@@ -167,4 +167,6 @@ export const FACE_SDK_MODEL_PATH = isAndroid()
|
||||
export const FACE_SDK_MODEL_CHECKSUM =
|
||||
'797b4d99794965749635352d55da38d4748c28c659ee1502338badee4614ed06';
|
||||
|
||||
export const EXPIRED_VC_ERROR_CODE = 'ERR_VC_EXPIRED';
|
||||
export const EXPIRED_VC_ERROR_CODE = 'ERR_VC_EXPIRED';
|
||||
|
||||
export const BASE_36 = 36;
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
SETTINGS_STORE_KEY,
|
||||
ENOENT,
|
||||
API_CACHED_STORAGE_KEYS,
|
||||
BASE_36,
|
||||
} from './constants';
|
||||
import FileStorage, {
|
||||
getFilePath,
|
||||
@@ -346,7 +347,8 @@ class Storage {
|
||||
await Promise.all(
|
||||
allVCKeys.map(async key => {
|
||||
const vc = allVCs[key];
|
||||
const ts = Date.now();
|
||||
const ts =
|
||||
Date.now() + Math.random().toString(BASE_36).substring(2, 7);
|
||||
const prevUnixTimeStamp = vc.vcMetadata.timestamp;
|
||||
|
||||
const isVerified = await Storage.verifyCredential(
|
||||
|
||||
Reference in New Issue
Block a user