@mosip/react-inji-verify-sdk 0.17.0-beta.11 → 0.17.0-beta.12
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 +107 -31
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,23 +1,87 @@
|
|
|
1
|
-
# INJI VERIFY SDK
|
|
1
|
+
# INJI VERIFY SDK (🛑 **Deprecated — Still Usable**)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **⚠️ Deprecation Notice**
|
|
4
|
+
>
|
|
5
|
+
> This package is **deprecated** and **no longer actively maintained**, but it will continue to **function as-is** for existing consumers.
|
|
6
|
+
>
|
|
7
|
+
> It has been replaced by:
|
|
8
|
+
>
|
|
9
|
+
> ```
|
|
10
|
+
> @injistack/react-inji-verify-sdk
|
|
11
|
+
> ```
|
|
12
|
+
>
|
|
13
|
+
> Future updates, bug fixes, security patches, and enhancements will be provided only under the new package.
|
|
14
|
+
>
|
|
15
|
+
> See the **Migration Guide** below if you want to switch.
|
|
16
|
+
|
|
17
|
+
---
|
|
4
18
|
|
|
19
|
+
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.
|
|
5
20
|
|
|
6
|
-
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 🚀 Usage Guide (Deprecated Package — Still Works)
|
|
24
|
+
|
|
25
|
+
### Step 1: Install
|
|
7
26
|
|
|
8
|
-
### Step 1: Install the Package
|
|
9
27
|
```bash
|
|
10
28
|
npm i @mosip/react-inji-verify-sdk
|
|
11
29
|
```
|
|
12
30
|
|
|
13
|
-
### Step 2: Import
|
|
14
|
-
|
|
15
|
-
|
|
31
|
+
### Step 2: Import Components
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import {
|
|
35
|
+
OpenID4VPVerification,
|
|
36
|
+
QRCodeVerification,
|
|
37
|
+
} from "@mosip/react-inji-verify-sdk";
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
(Usage examples remain the same and are omitted for brevity.)
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
# 🔄 Migration Guide — `@mosip` → `@injistack`
|
|
45
|
+
|
|
46
|
+
### 📌 **Why migrate?**
|
|
47
|
+
|
|
48
|
+
- Active support & maintenance moved to `@injistack`
|
|
49
|
+
- Future enhancements will not land in the deprecated package
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 1. Uninstall old package (optional)
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npm uninstall @mosip/react-inji-verify-sdk
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## 2. Install new package
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm install @injistack/react-inji-verify-sdk
|
|
16
63
|
```
|
|
17
64
|
|
|
65
|
+
## 3. Update imports
|
|
66
|
+
|
|
67
|
+
**Before:**
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
import { QRCodeVerification } from "@mosip/react-inji-verify-sdk";
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**After:**
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import { QRCodeVerification } from "@injistack/react-inji-verify-sdk";
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
18
81
|
### Step 3: Choose Your Verification Method
|
|
19
82
|
|
|
20
83
|
**Option A: QR Code Verification (Scan & Upload)**
|
|
84
|
+
|
|
21
85
|
```javascript
|
|
22
86
|
function MyApp() {
|
|
23
87
|
return (
|
|
@@ -38,6 +102,7 @@ function MyApp() {
|
|
|
38
102
|
```
|
|
39
103
|
|
|
40
104
|
**Option B: OpenID4VP Verification**
|
|
105
|
+
|
|
41
106
|
```javascript
|
|
42
107
|
function MyApp() {
|
|
43
108
|
return (
|
|
@@ -72,25 +137,30 @@ When verification is completed, the response received is as below:
|
|
|
72
137
|
vpResultStatus: "SUCCESS" // Overall verification status
|
|
73
138
|
}
|
|
74
139
|
```
|
|
75
|
-
|
|
140
|
+
|
|
141
|
+
> **Security Recommendation**
|
|
76
142
|
>
|
|
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.
|
|
143
|
+
> Avoid consuming results directly from VPProcessed or VCProcessed.
|
|
144
|
+
> Instead, use VPReceived or VCReceived events to capture the txnId, then retrieve the verification results securely from your backend's verification service endpoint.
|
|
145
|
+
> This ensures data integrity and prevents reliance on client-side verification data for final decisions.
|
|
80
146
|
|
|
81
147
|
## Pre-requisites
|
|
82
148
|
|
|
83
149
|
### What You Need:
|
|
150
|
+
|
|
84
151
|
1. **A React project** (TypeScript recommended)
|
|
85
152
|
2. **A verification backend** - You need a server that can verify credentials
|
|
86
153
|
3. **Camera permissions** - For QR scanning features
|
|
87
154
|
|
|
88
155
|
### Backend Requirements:
|
|
156
|
+
|
|
89
157
|
Your backend must support the OpenID4VP protocol. You can either:
|
|
158
|
+
|
|
90
159
|
- Use the official `inji-verify-service`
|
|
91
160
|
- Build your own following [this specification](https://openid.net/specs/openid-4-verifiable-presentations-1_0-ID3.html)
|
|
92
161
|
|
|
93
162
|
**Important:** Your backend URL should look like:
|
|
163
|
+
|
|
94
164
|
```
|
|
95
165
|
https://your-backend.com
|
|
96
166
|
```
|
|
@@ -102,6 +172,7 @@ https://your-backend.com
|
|
|
102
172
|
**Perfect for:** Scanning QR codes from documents or uploading QR codes (PNG, JPEG, JPG, PDF)
|
|
103
173
|
|
|
104
174
|
#### Basic Setup:
|
|
175
|
+
|
|
105
176
|
```javascript
|
|
106
177
|
<QRCodeVerification
|
|
107
178
|
verifyServiceUrl="https://your-backend.com"
|
|
@@ -113,28 +184,29 @@ https://your-backend.com
|
|
|
113
184
|
```
|
|
114
185
|
|
|
115
186
|
#### All Available Options:
|
|
187
|
+
|
|
116
188
|
```javascript
|
|
117
189
|
<QRCodeVerification
|
|
118
190
|
// Required
|
|
119
191
|
verifyServiceUrl="https://your-backend.com"
|
|
120
|
-
onVCProcessed={(result) => console.log(result)}
|
|
192
|
+
onVCProcessed={(result) => console.log(result)} // OR use onVCReceived
|
|
121
193
|
onError={(error) => console.log(error)}
|
|
122
194
|
clientId="CLIENT_ID"
|
|
123
|
-
|
|
124
195
|
// Optional
|
|
125
196
|
triggerElement={<button>Custom Trigger</button>}
|
|
126
|
-
transactionId="your-tracking-id"
|
|
197
|
+
transactionId="your-tracking-id" //Optional
|
|
127
198
|
uploadButtonId="my-upload-btn"
|
|
128
|
-
uploadButtonStyle={{ backgroundColor:
|
|
129
|
-
isEnableUpload={true}
|
|
130
|
-
isEnableScan={true}
|
|
131
|
-
isEnableZoom={true}
|
|
132
|
-
isVPSubmissionSupported={false}
|
|
199
|
+
uploadButtonStyle={{ backgroundColor: "blue" }}
|
|
200
|
+
isEnableUpload={true} // Allow file uploads
|
|
201
|
+
isEnableScan={true} // Allow camera scanning
|
|
202
|
+
isEnableZoom={true} // Allow camera zoom
|
|
203
|
+
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
204
|
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
205
|
/>
|
|
135
206
|
```
|
|
136
207
|
|
|
137
208
|
**Choose One Callback:**
|
|
209
|
+
|
|
138
210
|
- `onVCProcessed`: Get full verification results immediately
|
|
139
211
|
- `onVCReceived`: Get just a transaction ID (your backend handles the rest)
|
|
140
212
|
|
|
@@ -143,6 +215,7 @@ https://your-backend.com
|
|
|
143
215
|
**Perfect for:** Integrating with digital wallets (like mobile ID apps)
|
|
144
216
|
|
|
145
217
|
#### Basic Setup:
|
|
218
|
+
|
|
146
219
|
```javascript
|
|
147
220
|
<OpenID4VPVerification
|
|
148
221
|
verifyServiceUrl="https://your-backend.com"
|
|
@@ -155,6 +228,7 @@ https://your-backend.com
|
|
|
155
228
|
```
|
|
156
229
|
|
|
157
230
|
#### With Presentation Definition:
|
|
231
|
+
|
|
158
232
|
```javascript
|
|
159
233
|
<OpenID4VPVerification
|
|
160
234
|
verifyServiceUrl="https://your-backend.com"
|
|
@@ -170,11 +244,13 @@ https://your-backend.com
|
|
|
170
244
|
#### Define What to Verify:
|
|
171
245
|
|
|
172
246
|
**Option 1: Use a predefined template**
|
|
247
|
+
|
|
173
248
|
```javascript
|
|
174
|
-
presentationDefinitionId="drivers-license-check"
|
|
249
|
+
presentationDefinitionId = "drivers-license-check";
|
|
175
250
|
```
|
|
176
251
|
|
|
177
252
|
**Option 2: Define exactly what you want**
|
|
253
|
+
|
|
178
254
|
```javascript
|
|
179
255
|
presentationDefinition={{
|
|
180
256
|
id: "custom-verification",
|
|
@@ -207,19 +283,19 @@ presentationDefinition={{
|
|
|
207
283
|
|
|
208
284
|
### Common Props (Both Components)
|
|
209
285
|
|
|
210
|
-
| Property
|
|
211
|
-
|
|
212
|
-
| `verifyServiceUrl`
|
|
213
|
-
| `onError`
|
|
214
|
-
| `triggerElement`
|
|
215
|
-
| `transactionId`
|
|
216
|
-
| `clientId`
|
|
217
|
-
| `acceptVPWithoutHolderProof`
|
|
286
|
+
| Property | Type | Required | Description |
|
|
287
|
+
| ---------------------------- | ------------- | -------- | ------------------------------------------- |
|
|
288
|
+
| `verifyServiceUrl` | string | ✅ | Backend verification URL |
|
|
289
|
+
| `onError` | function | ✅ | Callback invoked when an error occurs |
|
|
290
|
+
| `triggerElement` | React element | ❌ | Custom button/element to start verification |
|
|
291
|
+
| `transactionId` | string | ❌ | Optional client-side tracking ID |
|
|
292
|
+
| `clientId` | string | ✅ | Client identifier |
|
|
293
|
+
| `acceptVPWithoutHolderProof` | boolean | ❌ | Allow unsigned Verifiable Presentations |
|
|
218
294
|
|
|
219
295
|
### QRCodeVerification Specific
|
|
220
296
|
|
|
221
297
|
| Property | Type | Default | Description |
|
|
222
|
-
|
|
298
|
+
| ------------------------- | -------- | ------- | ---------------------------- |
|
|
223
299
|
| `onVCProcessed` | function | - | Get full results immediately |
|
|
224
300
|
| `onVCReceived` | function | - | Get transaction ID only |
|
|
225
301
|
| `isEnableUpload` | boolean | true | Allow file uploads |
|
|
@@ -231,7 +307,7 @@ presentationDefinition={{
|
|
|
231
307
|
### OpenID4VPVerification Specific
|
|
232
308
|
|
|
233
309
|
| Property | Type | Default | Description |
|
|
234
|
-
|
|
310
|
+
| -------------------------- | -------- | -------------- | ---------------------------------- |
|
|
235
311
|
| `protocol` | string | "openid4vp://" | Protocol for QR codes (optional) |
|
|
236
312
|
| `presentationDefinitionId` | string | - | Predefined verification template |
|
|
237
313
|
| `presentationDefinition` | object | - | Custom verification rules |
|
|
@@ -244,4 +320,4 @@ presentationDefinition={{
|
|
|
244
320
|
## ⚠️ Important Limitations
|
|
245
321
|
|
|
246
322
|
- **React Only:** Won't work with Angular, Vue, or React Native
|
|
247
|
-
- **Backend Required:** You must have a verification service running
|
|
323
|
+
- **Backend Required:** You must have a verification service running
|