OpenID4VP-VP Verification Integration Guide
Last updated
Was this helpful?
Last updated
Was this helpful?
Inji Verify SDK is a library which exposes React components for integrating Inji Verify features seamlessly into any relaying party application.
OpenId4VP component that creates QR code and performs OpenId4Vp sharing backend flow. OpenID4VP cross device flow can be performed by following the steps provided in
npm i @mosip/react-inji-verify-sdk
React
18.2.0
Typescript
4.9.5
Install the dependencies
npm install
Build the projectnpm run build
Publish the npm package using Verdaccio, We use . npm link or yarn link won't work as we have peer dependencies. Follow the docs to setup Verdaccio.
Then run npm publish --registry <http://localhost:<VERADACCIO_PORT>>
This guide walks you through integrating the OpenID4VP verification component into your React TypeScript project. It facilitates Verifiable Presentation (VP) verification using the OpenID4VP protocol and supports flexible workflows, including client-side and backend-to-backend verification.
Prerequisites
React Project Setup
Note The component is written in React + TypeScript, The component does not support other frontend frameworks like Angular, Vue, or React Native.
Backend Requirements
To use the component, you must host a verification backend that implements the OpenID4VP protocol. This backend is referred to as the inji-verify-service. It also needs to adhere to the OpenAPI spec defined here in case if the backend service is not inji-verify-service.
Important:
The component expects these endpoints to be accessible via a base URL (verifyServiceUrl).
Example:
Installation
npm i @mosip/react-inji-verify-sdk
Component Props
Exclusive Verification Flows
Only one of the following should be provided:
onVpReceived(txnId: string)
Use when your backend fetches the VP result later
onVpProcessed(vpResult: VerificationResults)
Use when the frontend needs the result directly
Presentation Definition Options
Only one of the following should be provided:
presentationDefinitionId
Fetch a predefined definition from the backend
presentationDefinition
Provide the full definition inline as a JSON object
Example — Inline presentationDefinition Usage
If you want to directly provide a Presentation Definition instead of fetching it by ID, you can pass it like this:
Tips: If you use presentationDefinition, do not pass presentationDefinitionId, and vice versa.
Required Props
verifyServiceUrl
string
Base URL for your verification backend
protocol
string
Protocol for QR (e.g.: "openid4vp://")
onQrCodeExpired
() => void
Callback when QR expires
onError
(err: Error) => void
Error handler callback
Optional Props
triggerElement
React.ReactNode
Element that triggers verification (e.g., a button)
transactionId
string
Optional external tracking ID
qrCodeStyles
object
Customize QR appearance (size, color, margin, etc.)
Integration Examples
VP Result via UI (frontend receives result)
VP Result via Backend (frontend just gets txnId)
Testing the Component (for QA)
Simulate Wallet Scan : Use a mobile wallet app that supports OpenID4VP, or use mock tools to scan the QR code.
Trigger Expiry : Don’t scan the QR and wait for expiry to ensure onQrCodeExpired fires.
Force Errors :
Stop the backend or simulate a 500 error.
Try missing required props or using both callbacks to see validation.
Supported
✅ ReactJS (with TypeScript)
✅ Modern React projects (17+)
Not Supported
❌ React Native
❌ Angular, Vue, or other frontend frameworks
❌ SSR frameworks like Next.js without customization
If you deploy the inji-verify/verify-service at: Then use this as the verifyServiceUrl in the component: verifyServiceUrl=""