diff --git a/components/VCVerification.tsx b/components/VCVerification.tsx
index 05309de6..5886843f 100644
--- a/components/VCVerification.tsx
+++ b/components/VCVerification.tsx
@@ -21,13 +21,8 @@ export const VCVerification: React.FC = ({wellknown, isVerified}: any) => {
{statusIcon}
+ color={getTextColor(wellknown, Theme.Colors.Details)}
+ style={Theme.Styles.verificationStatus}>
{statusText}
diff --git a/components/ui/themes/DefaultTheme.ts b/components/ui/themes/DefaultTheme.ts
index 32ef096b..f51ac27b 100644
--- a/components/ui/themes/DefaultTheme.ts
+++ b/components/ui/themes/DefaultTheme.ts
@@ -170,9 +170,9 @@ export const DefaultTheme = {
backgroundColor: Colors.Grey,
borderRadius: 4,
},
- detailsValue: {
- color: Colors.Black,
+ verificationStatus: {
fontSize: 12,
+ fontFamily: 'Inter_600SemiBold',
},
statusLabel: {
color: Colors.Gray30,
diff --git a/components/ui/themes/PurpleTheme.ts b/components/ui/themes/PurpleTheme.ts
index 1737a2f6..abdd8dc5 100644
--- a/components/ui/themes/PurpleTheme.ts
+++ b/components/ui/themes/PurpleTheme.ts
@@ -173,9 +173,9 @@ export const PurpleTheme = {
backgroundColor: Colors.Grey,
borderRadius: 4,
},
- detailsValue: {
- color: Colors.Black,
+ verificationStatus: {
fontSize: 12,
+ fontFamily: 'Inter_600SemiBold',
},
statusLabel: {
color: Colors.Gray30,
diff --git a/locales/ara.json b/locales/ara.json
index 5959ef83..1015ab83 100644
--- a/locales/ara.json
+++ b/locales/ara.json
@@ -412,7 +412,7 @@
"VcVerificationBanner": {
"inProgress": "نحن نقوم بالتحقق من بطاقتك، قد يستغرق هذا بعض الوقت. بمجرد التحقق، ستتمكن من تفعيل بطاقتك.",
"success": "تم التحقق من {{vcDetails}} بنجاح وهو متاح الآن للتنشيط.",
- "error": "عذرًا، لا يمكننا التحقق من {{vcDetails}} الآن. الرجاء معاودة المحاولة في وقت لاحق."
+ "error": "عذرًا، لا يمكننا التحقق من {{vcDetails}} الآن. الرجاء معاودة المحاولة في وقت لاحق. وحتى ذلك الحين، لن تتمكن من تفعيل بطاقتك أو مشاركتها."
},
"ViewVcModal": {
"title": "تفاصيل الهوية",
diff --git a/locales/en.json b/locales/en.json
index 2d07b053..d36439a0 100644
--- a/locales/en.json
+++ b/locales/en.json
@@ -413,7 +413,7 @@
"VcVerificationBanner": {
"inProgress": "We are validating your card, this may take sometime. Once verified, you’ll be able to activate your card.",
"success": "{{vcDetails}} is verified successfully and now available for activation.",
- "error": "Sorry, we are unable to verify the {{vcDetails}} right now. Please try again later."
+ "error": "Sorry, we are unable to verify the {{vcDetails}} right now. Please try again later. Until then, you won't be able to activate or share your card."
},
"ViewVcModal": {
"title": "ID Details",
diff --git a/locales/fil.json b/locales/fil.json
index 681a291e..625f15c9 100644
--- a/locales/fil.json
+++ b/locales/fil.json
@@ -410,10 +410,10 @@
"noReceivedVcsText": "Pindutin ang Humiling sa ibaba para makatanggap ng card"
},
"VcVerificationBanner": {
- "inProgress": "Pina-validate namin ang iyong card, maaaring magtagal ito. Kapag na-verify na, magagawa mong i-activate ang iyong card.",
- "success": "Matagumpay na na-verify ang {{vcDetails}} at magagamit na ngayon para sa pag-activate.",
- "error": "Paumanhin, hindi namin ma-verify ang {{vcDetails}} ngayon. Subukang muli mamaya."
- },
+ "inProgress": "Pina-validate namin ang iyong card, maaaring magtagal ito. Kapag na-verify na, magagawa mong i-activate ang iyong card.",
+ "success": "Matagumpay na na-verify ang {{vcDetails}} at magagamit na ngayon para sa pag-activate.",
+ "error": "Paumanhin, hindi namin ma-verify ang {{vcDetails}} ngayon. Subukang muli mamaya. Hanggang sa panahong iyon, hindi mo maa-activate o maibabahagi ang iyong card."
+ },
"ViewVcModal": {
"title": "Mga Detalye ng ID",
"inProgress": "Isinasagawa",
diff --git a/locales/hin.json b/locales/hin.json
index 7a6394b6..95ceb9e2 100644
--- a/locales/hin.json
+++ b/locales/hin.json
@@ -414,7 +414,7 @@
"VcVerificationBanner": {
"inProgress": "हम आपके कार्ड का सत्यापन कर रहे हैं, इसमें कुछ समय लग सकता है। एक बार सत्यापित हो जाने पर, आप अपना कार्ड सक्रिय कर सकेंगे।",
"success": "{{vcDetails}} सफलतापूर्वक सत्यापित हो गया है और अब सक्रियण के लिए उपलब्ध है।",
- "error": "क्षमा करें, हम अभी {{vcDetails}} को सत्यापित करने में असमर्थ हैं। कृपया बाद में पुन: प्रयास करें।"
+ "error": "क्षमा करें, हम अभी {{vcDetails}} को सत्यापित करने में असमर्थ हैं। कृपया बाद में पुन: प्रयास करें। तब तक, आप अपना कार्ड सक्रिय या साझा नहीं कर पाएंगे।"
},
"ViewVcModal": {
"title": "आईडी विवरण",
diff --git a/locales/kan.json b/locales/kan.json
index b6c061dd..f46a30a4 100644
--- a/locales/kan.json
+++ b/locales/kan.json
@@ -412,7 +412,7 @@
"VcVerificationBanner": {
"inProgress": "ನಾವು ನಿಮ್ಮ ಕಾರ್ಡ್ ಅನ್ನು ಮೌಲ್ಯೀಕರಿಸುತ್ತಿದ್ದೇವೆ, ಇದಕ್ಕೆ ಸ್ವಲ್ಪ ಸಮಯ ತೆಗೆದುಕೊಳ್ಳಬಹುದು. ಒಮ್ಮೆ ಪರಿಶೀಲಿಸಿದ ನಂತರ, ನಿಮ್ಮ ಕಾರ್ಡ್ ಅನ್ನು ಸಕ್ರಿಯಗೊಳಿಸಲು ನಿಮಗೆ ಸಾಧ್ಯವಾಗುತ್ತದೆ.",
"success": "{{vcDetails}} ಅನ್ನು ಯಶಸ್ವಿಯಾಗಿ ಪರಿಶೀಲಿಸಲಾಗಿದೆ ಮತ್ತು ಇದೀಗ ಸಕ್ರಿಯಗೊಳಿಸುವಿಕೆಗೆ ಲಭ್ಯವಿದೆ.",
- "error": "ಕ್ಷಮಿಸಿ, ಇದೀಗ {{vcDetails}} ಅನ್ನು ಪರಿಶೀಲಿಸಲು ನಮಗೆ ಸಾಧ್ಯವಾಗುತ್ತಿಲ್ಲ. ದಯವಿಟ್ಟು ನಂತರ ಮತ್ತೆ ಪ್ರಯತ್ನಿಸಿ."
+ "error": "ಕ್ಷಮಿಸಿ, ಇದೀಗ {{vcDetails}} ಅನ್ನು ಪರಿಶೀಲಿಸಲು ನಮಗೆ ಸಾಧ್ಯವಾಗುತ್ತಿಲ್ಲ. ದಯವಿಟ್ಟು ನಂತರ ಮತ್ತೆ ಪ್ರಯತ್ನಿಸಿ. ಅಲ್ಲಿಯವರೆಗೆ, ನಿಮ್ಮ ಕಾರ್ಡ್ ಅನ್ನು ಸಕ್ರಿಯಗೊಳಿಸಲು ಅಥವಾ ಹಂಚಿಕೊಳ್ಳಲು ನಿಮಗೆ ಸಾಧ್ಯವಾಗುವುದಿಲ್ಲ."
},
"ViewVcModal": {
"title": "ಐಡಿ ವಿವರಗಳು",
diff --git a/locales/tam.json b/locales/tam.json
index 57470734..3d5297e5 100644
--- a/locales/tam.json
+++ b/locales/tam.json
@@ -410,10 +410,10 @@
"noReceivedVcsText": "அட்டை பெறுவதற்கு கீழே உள்ள கோரிக்கையைத் தட்டவும்"
},
"VcVerificationBanner": {
- "inProgress": "உங்கள் கார்டை நாங்கள் சரிபார்க்கிறோம், இதற்கு சிறிது நேரம் ஆகலாம். சரிபார்க்கப்பட்டதும், உங்கள் கார்டைச் செயல்படுத்த முடியும்.",
- "success": "{{vcDetails}} வெற்றிகரமாகச் சரிபார்க்கப்பட்டது, இப்போது செயல்படுத்துவதற்குக் கிடைக்கிறது.",
- "error": "மன்னிக்கவும், இப்போது எங்களால் {{vcDetails}} ஐச் சரிபார்க்க முடியவில்லை. பிறகு முயற்சிக்கவும்."
- },
+ "inProgress": "உங்கள் கார்டை நாங்கள் சரிபார்க்கிறோம், இதற்கு சிறிது நேரம் ஆகலாம். சரிபார்க்கப்பட்டதும், உங்கள் கார்டைச் செயல்படுத்த முடியும்.",
+ "success": "{{vcDetails}} வெற்றிகரமாகச் சரிபார்க்கப்பட்டது, இப்போது செயல்படுத்துவதற்குக் கிடைக்கிறது.",
+ "error": "மன்னிக்கவும், இப்போது எங்களால் {{vcDetails}} ஐச் சரிபார்க்க முடியவில்லை. பிறகு முயற்சிக்கவும். அதுவரை உங்களால் கார்டை இயக்கவோ பகிரவோ முடியாது."
+ },
"ViewVcModal": {
"title": "அடையாள விவரங்கள்",
"inProgress": "செயல்பாட்டில் உள்ளது",
diff --git a/machines/Issuers/IssuersActions.ts b/machines/Issuers/IssuersActions.ts
index cd2e59bb..dcb4099b 100644
--- a/machines/Issuers/IssuersActions.ts
+++ b/machines/Issuers/IssuersActions.ts
@@ -40,21 +40,6 @@ export const IssuersActions = (model: any) => {
isVerified: false,
}),
}),
- sendVerificationError: send(
- (context: any, _event) => {
- return {
- type: 'VERIFY_VC_FAILED',
- errorMessage: context.errorMessage,
- vcMetadata: context.vcMetadata,
- };
- },
- {
- to: context => context.serviceRefs.vcMeta,
- },
- ),
- setErrorAsVerificationError: assign({
- errorMessage: (_context, event) => (event.data as Error).message,
- }),
setIssuers: model.assign({
issuers: (_: any, event: any) => event.data,
}),
@@ -254,6 +239,11 @@ export const IssuersActions = (model: any) => {
);
},
+ updateVerificationErrorMessage: assign({
+ verificationErrorMessage: (_, event: any) =>
+ (event.data as Error).message,
+ }),
+
resetVerificationErrorMessage: model.assign({
verificationErrorMessage: () => '',
}),
diff --git a/machines/Issuers/IssuersGuards.ts b/machines/Issuers/IssuersGuards.ts
index 50ec1519..32bc726f 100644
--- a/machines/Issuers/IssuersGuards.ts
+++ b/machines/Issuers/IssuersGuards.ts
@@ -7,7 +7,7 @@ import {VerificationErrorType} from '../../shared/vcjs/verifyCredential';
export const IssuersGuards = () => {
return {
- isPendingVerificationError: (_context, event) =>
+ isVerificationPendingBecauseOfNetworkIssue: (_context, event) =>
(event.data as Error).message == VerificationErrorType.NETWORK_ERROR,
isSignedIn: (_: any, event: any) =>
(event.data as isSignedInResult).isSignedIn,
diff --git a/machines/Issuers/IssuersMachine.ts b/machines/Issuers/IssuersMachine.ts
index b50be242..a985bf50 100644
--- a/machines/Issuers/IssuersMachine.ts
+++ b/machines/Issuers/IssuersMachine.ts
@@ -332,7 +332,7 @@ export const IssuersMachine = model.createMachine(
],
onError: [
{
- cond: 'isPendingVerificationError',
+ cond: 'isVerificationPendingBecauseOfNetworkIssue',
actions: ['resetLoadingReason', 'resetIsVerified'],
target: 'storing',
},
@@ -340,7 +340,7 @@ export const IssuersMachine = model.createMachine(
actions: [
'resetLoadingReason',
'sendErrorEndEvent',
- 'setErrorAsVerificationError',
+ 'updateVerificationErrorMessage',
],
target: 'handleVCVerificationFailure',
},
@@ -349,7 +349,11 @@ export const IssuersMachine = model.createMachine(
},
handleVCVerificationFailure: {
- entry: 'sendVerificationError',
+ on: {
+ RESET_VERIFY_ERROR: {
+ actions: ['resetVerificationErrorMessage'],
+ },
+ },
},
storing: {
diff --git a/machines/Issuers/IssuersMachine.typegen.ts b/machines/Issuers/IssuersMachine.typegen.ts
index 10e1767d..3d699d38 100644
--- a/machines/Issuers/IssuersMachine.typegen.ts
+++ b/machines/Issuers/IssuersMachine.typegen.ts
@@ -97,16 +97,15 @@ export interface Typegen0 {
| 'resetError'
| 'resetIsVerified'
| 'resetLoadingReason'
+ | 'resetVerificationErrorMessage'
| 'sendBackupEvent'
| 'sendDownloadingFailedToVcMeta'
| 'sendErrorEndEvent'
| 'sendImpressionEvent'
| 'sendSuccessEndEvent'
- | 'sendVerificationError'
| 'setCredentialTypes'
| 'setCredentialWrapper'
| 'setError'
- | 'setErrorAsVerificationError'
| 'setIsVerified'
| 'setIssuers'
| 'setLoadingReasonAsDisplayIssuers'
@@ -127,7 +126,8 @@ export interface Typegen0 {
| 'storeVcMetaContext'
| 'storeVcsContext'
| 'storeVerifiableCredentialData'
- | 'storeVerifiableCredentialMeta';
+ | 'storeVerifiableCredentialMeta'
+ | 'updateVerificationErrorMessage';
delays: never;
guards:
| 'canSelectIssuerAgain'
@@ -139,8 +139,8 @@ export interface Typegen0 {
| 'isMultipleCredentialsSupported'
| 'isOIDCConfigError'
| 'isOIDCflowCancelled'
- | 'isPendingVerificationError'
| 'isSignedIn'
+ | 'isVerificationPendingBecauseOfNetworkIssue'
| 'shouldFetchIssuersAgain';
services:
| 'checkInternet'
@@ -175,12 +175,12 @@ export interface Typegen0 {
| 'error.platform.issuersMachine.downloadIssuerConfig:invocation[0]'
| 'error.platform.issuersMachine.performAuthorization:invocation[0]'
| 'error.platform.issuersMachine.verifyingCredential:invocation[0]';
+ resetVerificationErrorMessage: 'RESET_VERIFY_ERROR';
sendBackupEvent: 'done.invoke.issuersMachine.storing:invocation[0]';
sendDownloadingFailedToVcMeta: 'error.platform.issuersMachine.downloadCredentials:invocation[0]';
sendErrorEndEvent: 'error.platform.issuersMachine.verifyingCredential:invocation[0]';
sendImpressionEvent: 'done.invoke.issuersMachine.displayIssuers:invocation[0]';
sendSuccessEndEvent: 'done.invoke.issuersMachine.verifyingCredential:invocation[0]';
- sendVerificationError: 'error.platform.issuersMachine.verifyingCredential:invocation[0]';
setCredentialTypes: 'done.invoke.issuersMachine.downloadCredentialTypes:invocation[0]';
setCredentialWrapper: 'done.invoke.issuersMachine.downloadCredentials:invocation[0]';
setError:
@@ -189,7 +189,6 @@ export interface Typegen0 {
| 'error.platform.issuersMachine.downloadCredentials:invocation[0]'
| 'error.platform.issuersMachine.downloadIssuerConfig:invocation[0]'
| 'error.platform.issuersMachine.performAuthorization:invocation[0]';
- setErrorAsVerificationError: 'error.platform.issuersMachine.verifyingCredential:invocation[0]';
setIsVerified: 'done.invoke.issuersMachine.verifyingCredential:invocation[0]';
setIssuers: 'done.invoke.issuersMachine.displayIssuers:invocation[0]';
setLoadingReasonAsDisplayIssuers: 'TRY_AGAIN';
@@ -230,6 +229,7 @@ export interface Typegen0 {
storeVerifiableCredentialMeta:
| 'done.invoke.issuersMachine.verifyingCredential:invocation[0]'
| 'error.platform.issuersMachine.verifyingCredential:invocation[0]';
+ updateVerificationErrorMessage: 'error.platform.issuersMachine.verifyingCredential:invocation[0]';
};
eventsCausingDelays: {};
eventsCausingGuards: {
@@ -242,8 +242,8 @@ export interface Typegen0 {
isMultipleCredentialsSupported: 'done.invoke.issuersMachine.downloadCredentialTypes:invocation[0]';
isOIDCConfigError: 'error.platform.issuersMachine.performAuthorization:invocation[0]';
isOIDCflowCancelled: 'error.platform.issuersMachine.performAuthorization:invocation[0]';
- isPendingVerificationError: 'error.platform.issuersMachine.verifyingCredential:invocation[0]';
isSignedIn: 'done.invoke.issuersMachine.storing:invocation[0]';
+ isVerificationPendingBecauseOfNetworkIssue: 'error.platform.issuersMachine.verifyingCredential:invocation[0]';
shouldFetchIssuersAgain: 'TRY_AGAIN';
};
eventsCausingServices: {
diff --git a/machines/Issuers/IssuersService.ts b/machines/Issuers/IssuersService.ts
index 8ea9bd65..8b55467c 100644
--- a/machines/Issuers/IssuersService.ts
+++ b/machines/Issuers/IssuersService.ts
@@ -118,7 +118,6 @@ export const IssuersService = () => {
}
const verificationResult = await verifyCredential(
context.verifiableCredential?.credential,
- context.vcMetadata,
);
if (!verificationResult.isVerified) {
throw new Error(verificationResult.errorMessage);
diff --git a/machines/VerifiableCredential/VCItemMachine/VCItemGaurds.ts b/machines/VerifiableCredential/VCItemMachine/VCItemGaurds.ts
index 55a3a099..544de8cb 100644
--- a/machines/VerifiableCredential/VCItemMachine/VCItemGaurds.ts
+++ b/machines/VerifiableCredential/VCItemMachine/VCItemGaurds.ts
@@ -17,7 +17,7 @@ export const VCItemGaurds = () => {
isCustomSecureKeystore: () => isHardwareKeystoreExists,
- isPendingVerificationError: (_context, event) =>
+ isVerificationPendingBecauseOfNetworkIssue: (_context, event) =>
(event.data as Error).message == VerificationErrorType.NETWORK_ERROR,
};
};
diff --git a/machines/VerifiableCredential/VCItemMachine/VCItemMachine.ts b/machines/VerifiableCredential/VCItemMachine/VCItemMachine.ts
index a6639f68..24dc2b8a 100644
--- a/machines/VerifiableCredential/VCItemMachine/VCItemMachine.ts
+++ b/machines/VerifiableCredential/VCItemMachine/VCItemMachine.ts
@@ -457,7 +457,7 @@ export const VCItemMachine = model.createMachine(
},
onError: [
{
- cond: 'isPendingVerificationError',
+ cond: 'isVerificationPendingBecauseOfNetworkIssue',
actions: ['resetIsVerified', 'storeContext'],
},
{
@@ -561,18 +561,9 @@ export const VCItemMachine = model.createMachine(
},
onError: [
{
- cond: 'isPendingVerificationError',
+ cond: 'isVerificationPendingBecauseOfNetworkIssue',
actions: ['resetIsVerified', 'storeContext'],
},
- {
- actions: [
- (_, event) =>
- console.error(
- 'error has occured while doing verification::',
- event.data,
- ),
- ],
- },
],
},
after: {
diff --git a/machines/VerifiableCredential/VCItemMachine/VCItemMachine.typegen.ts b/machines/VerifiableCredential/VCItemMachine/VCItemMachine.typegen.ts
index 830a8625..08d33f69 100644
--- a/machines/VerifiableCredential/VCItemMachine/VCItemMachine.typegen.ts
+++ b/machines/VerifiableCredential/VCItemMachine/VCItemMachine.typegen.ts
@@ -192,8 +192,8 @@ export interface Typegen0 {
| 'hasCredential'
| 'isCustomSecureKeystore'
| 'isDownloadAllowed'
- | 'isPendingVerificationError'
- | 'isSignedIn';
+ | 'isSignedIn'
+ | 'isVerificationPendingBecauseOfNetworkIssue';
services:
| 'addWalletBindingId'
| 'checkDownloadExpiryLimit'
@@ -342,12 +342,12 @@ export interface Typegen0 {
| 'done.invoke.vc-item-machine.vcUtilitiesState.walletBinding.addKeyPair:invocation[0]'
| 'done.invoke.vc-item-machine.vcUtilitiesState.walletBinding.addingWalletBindingId:invocation[0]';
isDownloadAllowed: 'POLL';
- isPendingVerificationError:
- | 'error.platform.vc-item-machine.vcUtilitiesState.verifyingCredential:invocation[0]'
- | 'error.platform.vc-item-machine.verifyState.verifyingCredential:invocation[0]';
isSignedIn:
| 'done.invoke.vc-item-machine.vcUtilitiesState.kebabPopUp.triggerAutoBackup:invocation[0]'
| 'done.invoke.vc-item-machine.vcUtilitiesState.verifyingCredential.triggerAutoBackupForVcDownload:invocation[0]';
+ isVerificationPendingBecauseOfNetworkIssue:
+ | 'error.platform.vc-item-machine.vcUtilitiesState.verifyingCredential:invocation[0]'
+ | 'error.platform.vc-item-machine.verifyState.verifyingCredential:invocation[0]';
};
eventsCausingServices: {
addWalletBindingId: 'done.invoke.vc-item-machine.vcUtilitiesState.walletBinding.addKeyPair:invocation[0]';
diff --git a/machines/VerifiableCredential/VCItemMachine/VCItemServices.ts b/machines/VerifiableCredential/VCItemMachine/VCItemServices.ts
index 7cf884dc..c07c68d7 100644
--- a/machines/VerifiableCredential/VCItemMachine/VCItemServices.ts
+++ b/machines/VerifiableCredential/VCItemMachine/VCItemServices.ts
@@ -17,6 +17,7 @@ import {CredentialDownloadResponse, request} from '../../../shared/request';
import {WalletBindingResponse} from '../VCMetaMachine/vc';
import {verifyCredential} from '../../../shared/vcjs/verifyCredential';
import {getMosipIdentifier} from '../../../shared/commonUtil';
+import {getVerifiableCredential} from './VCItemSelectors';
export const VCItemServices = model => {
return {
@@ -197,8 +198,10 @@ export const VCItemServices = model => {
verifyCredential: async context => {
if (context.verifiableCredential) {
const verificationResult = await verifyCredential(
- context.verifiableCredential,
- context.vcMetadata,
+ getVerifiableCredential(
+ context.vcMetadata,
+ context.verifiableCredential,
+ ),
);
if (!verificationResult.isVerified) {
throw new Error(verificationResult.errorMessage);
diff --git a/shared/openId4VCI/Utils.ts b/shared/openId4VCI/Utils.ts
index f3297088..7439cc03 100644
--- a/shared/openId4VCI/Utils.ts
+++ b/shared/openId4VCI/Utils.ts
@@ -54,8 +54,7 @@ export function getVcVerificationDetails(
vcType: getIDType(
getVerifiableCredential(vcMetadata, verifiableCredential),
),
- vcNumber: getVerifiableCredential(vcMetadata, verifiableCredential)
- .credentialSubject[`${vcMetadata.idType}`],
+ vcNumber: vcMetadata.id,
};
}
diff --git a/shared/vcjs/verifyCredential.ts b/shared/vcjs/verifyCredential.ts
index 2901519a..f760fe71 100644
--- a/shared/vcjs/verifyCredential.ts
+++ b/shared/vcjs/verifyCredential.ts
@@ -26,17 +26,11 @@ const ProofPurpose = {
};
export async function verifyCredential(
- verifiableCredential: VerifiableCredential | Credential,
- vcMetadata: VCMetadata,
+ verifiableCredential: Credential,
): Promise {
try {
let purpose: PublicKeyProofPurpose | AssertionProofPurpose;
- const proof = VCMetadata.fromVC(vcMetadata).isFromOpenId4VCI()
- ? verifiableCredential.credential.proof
- : verifiableCredential.proof;
- const credential = VCMetadata.fromVC(vcMetadata).isFromOpenId4VCI()
- ? verifiableCredential.credential
- : verifiableCredential;
+ const proof = verifiableCredential.proof;
switch (proof.proofPurpose) {
case ProofPurpose.PublicKey:
purpose = new PublicKeyProofPurpose();
@@ -65,7 +59,7 @@ export async function verifyCredential(
const vcjsOptions = {
purpose,
suite,
- credential: credential,
+ credential: verifiableCredential,
documentLoader: jsonld.documentLoaders.xhr(),
};
@@ -75,9 +69,21 @@ export async function verifyCredential(
//ToDo Handle Expiration error message
} catch (error) {
+ console.error('Error occured while verifying the VC:', error);
+ const stacktrace = __DEV__ ? verifiableCredential : {};
+ sendErrorEvent(
+ getErrorEventData(
+ TelemetryConstants.FlowType.vcVerification,
+ TelemetryConstants.ErrorId.vcVerificationFailed,
+ error +
+ '-' +
+ getMosipIdentifier(verifiableCredential.credentialSubject),
+ stacktrace,
+ ),
+ );
return {
isVerified: false,
- errorMessage: error,
+ errorMessage: VerificationErrorType.TECHNICAL_ERROR,
};
}
}