@injistack/react-inji-verify-sdk 0.17.0-beta.12 → 0.17.0-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,22 +2,27 @@
2
2
 
3
3
  Inji Verify SDK provides ready-to-use **React components** to integrate [OpenID4VP](https://openid.net/specs/openid-4-verifiable-presentations-1_0.html)-based **Verifiable Credential (VC) and Verifiable Presentation (VP) verification** into any React TypeScript web application.
4
4
 
5
-
6
5
  ## Usage Guide
7
6
 
8
7
  ### Step 1: Install the Package
8
+
9
9
  ```bash
10
10
  npm i @injistack/react-inji-verify-sdk
11
11
  ```
12
12
 
13
13
  ### Step 2: Import and Use
14
+
14
15
  ```javascript
15
- import { OpenID4VPVerification, QRCodeVerification } from "@injistack/react-inji-verify-sdk";
16
+ import {
17
+ OpenID4VPVerification,
18
+ QRCodeVerification,
19
+ } from "@injistack/react-inji-verify-sdk";
16
20
  ```
17
21
 
18
22
  ### Step 3: Choose Your Verification Method
19
23
 
20
24
  **Option A: QR Code Verification (Scan & Upload)**
25
+
21
26
  ```javascript
22
27
  function MyApp() {
23
28
  return (
@@ -38,6 +43,7 @@ function MyApp() {
38
43
  ```
39
44
 
40
45
  **Option B: OpenID4VP Verification**
46
+
41
47
  ```javascript
42
48
  function MyApp() {
43
49
  return (
@@ -72,25 +78,30 @@ When verification is completed, the response received is as below:
72
78
  vpResultStatus: "SUCCESS" // Overall verification status
73
79
  }
74
80
  ```
75
- >**Security Recommendation**
81
+
82
+ > **Security Recommendation**
76
83
  >
77
- >Avoid consuming results directly from VPProcessed or VCProcessed.
78
- Instead, use VPReceived or VCReceived events to capture the txnId, then retrieve the verification results securely from your backend's verification service endpoint.
79
- This ensures data integrity and prevents reliance on client-side verification data for final decisions.
84
+ > Avoid consuming results directly from VPProcessed or VCProcessed.
85
+ > Instead, use VPReceived or VCReceived events to capture the txnId, then retrieve the verification results securely from your backend's verification service endpoint.
86
+ > This ensures data integrity and prevents reliance on client-side verification data for final decisions.
80
87
 
81
88
  ## Pre-requisites
82
89
 
83
90
  ### What You Need:
91
+
84
92
  1. **A React project** (TypeScript recommended)
85
93
  2. **A verification backend** - You need a server that can verify credentials
86
94
  3. **Camera permissions** - For QR scanning features
87
95
 
88
96
  ### Backend Requirements:
97
+
89
98
  Your backend must support the OpenID4VP protocol. You can either:
99
+
90
100
  - Use the official `inji-verify-service`
91
101
  - Build your own following [this specification](https://openid.net/specs/openid-4-verifiable-presentations-1_0-ID3.html)
92
102
 
93
103
  **Important:** Your backend URL should look like:
104
+
94
105
  ```
95
106
  https://your-backend.com
96
107
  ```
@@ -102,6 +113,7 @@ https://your-backend.com
102
113
  **Perfect for:** Scanning QR codes from documents or uploading QR codes (PNG, JPEG, JPG, PDF)
103
114
 
104
115
  #### Basic Setup:
116
+
105
117
  ```javascript
106
118
  <QRCodeVerification
107
119
  verifyServiceUrl="https://your-backend.com"
@@ -113,28 +125,29 @@ https://your-backend.com
113
125
  ```
114
126
 
115
127
  #### All Available Options:
128
+
116
129
  ```javascript
117
130
  <QRCodeVerification
118
131
  // Required
119
132
  verifyServiceUrl="https://your-backend.com"
120
- onVCProcessed={(result) => console.log(result)} // OR use onVCReceived
133
+ onVCProcessed={(result) => console.log(result)} // OR use onVCReceived
121
134
  onError={(error) => console.log(error)}
122
135
  clientId="CLIENT_ID"
123
-
124
136
  // Optional
125
137
  triggerElement={<button>Custom Trigger</button>}
126
- transactionId="your-tracking-id" //Optional
138
+ transactionId="your-tracking-id" //Optional
127
139
  uploadButtonId="my-upload-btn"
128
- uploadButtonStyle={{ backgroundColor: 'blue' }}
129
- isEnableUpload={true} // Allow file uploads
130
- isEnableScan={true} // Allow camera scanning
131
- isEnableZoom={true} // Allow camera zoom
132
- isVPSubmissionSupported={false} // This attribute indicates whether VP submission is supported in Inji OVP VC sharing flow. By default, it is false which means that VP token will be directly sent in response. If set to true, then VP token will be submitted to the VP_SUBMISSION_ URL.
140
+ uploadButtonStyle={{ backgroundColor: "blue" }}
141
+ isEnableUpload={true} // Allow file uploads
142
+ isEnableScan={true} // Allow camera scanning
143
+ isEnableZoom={true} // Allow camera zoom
144
+ isVPSubmissionSupported={false} // This attribute indicates whether VP submission is supported in Inji OVP VC sharing flow. By default, it is false which means that VP token will be directly sent in response. If set to true, then VP token will be submitted to the VP_SUBMISSION_ URL.
133
145
  acceptVPWithoutHolderProof={false} // This attribute controls whether unsigned Verifiable Presentations (VPs without proof) are allowed in the Inji OVP VC sharing flow. By default, it is set to false, meaning unsigned VP tokens are not supported and an error is thrown if an unsigned VP is received. If set to true, VP tokens without a signature (proof) are allowed and can be verified. For data-share it is set to true by default.
134
146
  />
135
147
  ```
136
148
 
137
149
  **Choose One Callback:**
150
+
138
151
  - `onVCProcessed`: Get full verification results immediately
139
152
  - `onVCReceived`: Get just a transaction ID (your backend handles the rest)
140
153
 
@@ -143,6 +156,7 @@ https://your-backend.com
143
156
  **Perfect for:** Integrating with digital wallets (like mobile ID apps)
144
157
 
145
158
  #### Basic Setup:
159
+
146
160
  ```javascript
147
161
  <OpenID4VPVerification
148
162
  verifyServiceUrl="https://your-backend.com"
@@ -155,6 +169,7 @@ https://your-backend.com
155
169
  ```
156
170
 
157
171
  #### With Presentation Definition:
172
+
158
173
  ```javascript
159
174
  <OpenID4VPVerification
160
175
  verifyServiceUrl="https://your-backend.com"
@@ -170,11 +185,13 @@ https://your-backend.com
170
185
  #### Define What to Verify:
171
186
 
172
187
  **Option 1: Use a predefined template**
188
+
173
189
  ```javascript
174
- presentationDefinitionId="drivers-license-check"
190
+ presentationDefinitionId = "drivers-license-check";
175
191
  ```
176
192
 
177
193
  **Option 2: Define exactly what you want**
194
+
178
195
  ```javascript
179
196
  presentationDefinition={{
180
197
  id: "custom-verification",
@@ -207,19 +224,19 @@ presentationDefinition={{
207
224
 
208
225
  ### Common Props (Both Components)
209
226
 
210
- | Property | Type | Required | Description |
211
- |----------------------------------|---------------|----------|---------------------------------------------|
212
- | `verifyServiceUrl` | string | ✅ | Backend verification URL |
213
- | `onError` | function | ✅ | Callback invoked when an error occurs |
214
- | `triggerElement` | React element | ❌ | Custom button/element to start verification |
215
- | `transactionId` | string | ❌ | Optional client-side tracking ID |
216
- | `clientId` | string | ✅ | Client identifier |
217
- | `acceptVPWithoutHolderProof` | boolean | ❌ | Allow unsigned Verifiable Presentations |
227
+ | Property | Type | Required | Description |
228
+ | ---------------------------- | ------------- | -------- | ------------------------------------------- |
229
+ | `verifyServiceUrl` | string | ✅ | Backend verification URL |
230
+ | `onError` | function | ✅ | Callback invoked when an error occurs |
231
+ | `triggerElement` | React element | ❌ | Custom button/element to start verification |
232
+ | `transactionId` | string | ❌ | Optional client-side tracking ID |
233
+ | `clientId` | string | ✅ | Client identifier |
234
+ | `acceptVPWithoutHolderProof` | boolean | ❌ | Allow unsigned Verifiable Presentations |
218
235
 
219
236
  ### QRCodeVerification Specific
220
237
 
221
238
  | Property | Type | Default | Description |
222
- |---------------------------|----------|---------|------------------------------|
239
+ | ------------------------- | -------- | ------- | ---------------------------- |
223
240
  | `onVCProcessed` | function | - | Get full results immediately |
224
241
  | `onVCReceived` | function | - | Get transaction ID only |
225
242
  | `isEnableUpload` | boolean | true | Allow file uploads |
@@ -231,7 +248,7 @@ presentationDefinition={{
231
248
  ### OpenID4VPVerification Specific
232
249
 
233
250
  | Property | Type | Default | Description |
234
- |----------------------------|----------|----------------|------------------------------------|
251
+ | -------------------------- | -------- | -------------- | ---------------------------------- |
235
252
  | `protocol` | string | "openid4vp://" | Protocol for QR codes (optional) |
236
253
  | `presentationDefinitionId` | string | - | Predefined verification template |
237
254
  | `presentationDefinition` | object | - | Custom verification rules |
@@ -244,4 +261,4 @@ presentationDefinition={{
244
261
  ## ⚠️ Important Limitations
245
262
 
246
263
  - **React Only:** Won't work with Angular, Vue, or React Native
247
- - **Backend Required:** You must have a verification service running
264
+ - **Backend Required:** You must have a verification service running