@mosip/react-inji-verify-sdk 0.15.0-beta.2 → 0.15.0-beta.20
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 +35 -30
- package/dist/components/openid4vp-verification/OpenID4VPVerification.d.ts +1 -0
- package/dist/components/openid4vp-verification/OpenID4VPVerification.types.d.ts +16 -19
- package/dist/index.js +1 -1
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/dataProcessor.d.ts +0 -2
- package/dist/utils/utils.d.ts +1 -0
- package/package.json +1 -1
- package/dist/components/WalletSelectionModal/WalletSelectionModal.d.ts +0 -13
package/Readme.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# INJI VERIFY SDK
|
|
2
2
|
|
|
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) verification** into any React TypeScript web application.
|
|
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
5
|
|
|
6
|
-
##
|
|
6
|
+
## Usage Guide
|
|
7
7
|
|
|
8
8
|
### Step 1: Install the Package
|
|
9
9
|
```bash
|
|
@@ -36,7 +36,7 @@ function MyApp() {
|
|
|
36
36
|
}
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
**Option B:
|
|
39
|
+
**Option B: OpenID4VP Verification**
|
|
40
40
|
```javascript
|
|
41
41
|
function MyApp() {
|
|
42
42
|
return (
|
|
@@ -55,9 +55,9 @@ function MyApp() {
|
|
|
55
55
|
}
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
##
|
|
58
|
+
## Response Received
|
|
59
59
|
|
|
60
|
-
When verification is
|
|
60
|
+
When verification is completed, the response received is as below:
|
|
61
61
|
|
|
62
62
|
```javascript
|
|
63
63
|
{
|
|
@@ -70,8 +70,13 @@ When verification is complete, you'll receive results like this:
|
|
|
70
70
|
vpResultStatus: "SUCCESS" // Overall verification status
|
|
71
71
|
}
|
|
72
72
|
```
|
|
73
|
+
>**Security Recommendation**
|
|
74
|
+
>
|
|
75
|
+
>Avoid consuming results directly from VPProcessed or VCProcessed.
|
|
76
|
+
Instead, use VPReceived or VCReceived events to capture the txnId, then retrieve the verification results securely from your backend's verification service endpoint.
|
|
77
|
+
This ensures data integrity and prevents reliance on client-side verification data for final decisions.
|
|
73
78
|
|
|
74
|
-
##
|
|
79
|
+
## Pre-requisites
|
|
75
80
|
|
|
76
81
|
### What You Need:
|
|
77
82
|
1. **A React project** (TypeScript recommended)
|
|
@@ -194,36 +199,36 @@ presentationDefinition={{
|
|
|
194
199
|
|
|
195
200
|
### Common Props (Both Components)
|
|
196
201
|
|
|
197
|
-
| Property
|
|
198
|
-
|
|
199
|
-
| `verifyServiceUrl` | string
|
|
200
|
-
| `onError`
|
|
201
|
-
| `triggerElement`
|
|
202
|
-
| `transactionId`
|
|
202
|
+
| Property | Type | Required | Description |
|
|
203
|
+
|--------------------|---------------|----------|---------------------------------------------|
|
|
204
|
+
| `verifyServiceUrl` | string | ✅ | Your backend verification URL |
|
|
205
|
+
| `onError` | function | ✅ | What to do when something goes wrong |
|
|
206
|
+
| `triggerElement` | React element | ❌ | Custom button/element to start verification |
|
|
207
|
+
| `transactionId` | string | ❌ | Your own tracking ID |
|
|
203
208
|
|
|
204
209
|
### QRCodeVerification Specific
|
|
205
210
|
|
|
206
|
-
| Property
|
|
207
|
-
|
|
208
|
-
| `onVCProcessed`
|
|
209
|
-
| `onVCReceived`
|
|
210
|
-
| `isEnableUpload`
|
|
211
|
-
| `isEnableScan`
|
|
212
|
-
| `isEnableZoom`
|
|
213
|
-
| `uploadButtonStyle` | object
|
|
211
|
+
| Property | Type | Default | Description |
|
|
212
|
+
|---------------------|----------|---------|------------------------------|
|
|
213
|
+
| `onVCProcessed` | function | - | Get full results immediately |
|
|
214
|
+
| `onVCReceived` | function | - | Get transaction ID only |
|
|
215
|
+
| `isEnableUpload` | boolean | true | Allow file uploads |
|
|
216
|
+
| `isEnableScan` | boolean | true | Allow camera scanning |
|
|
217
|
+
| `isEnableZoom` | boolean | true | Allow camera zoom |
|
|
218
|
+
| `uploadButtonStyle` | object | - | Custom upload button styling |
|
|
214
219
|
|
|
215
220
|
### OpenID4VPVerification Specific
|
|
216
221
|
|
|
217
|
-
| Property
|
|
218
|
-
|
|
219
|
-
| `protocol`
|
|
220
|
-
| `presentationDefinitionId` | string
|
|
221
|
-
| `presentationDefinition`
|
|
222
|
-
| `onVpProcessed`
|
|
223
|
-
| `onVpReceived`
|
|
224
|
-
| `onQrCodeExpired`
|
|
225
|
-
| `
|
|
226
|
-
| `qrCodeStyles`
|
|
222
|
+
| Property | Type | Default | Description |
|
|
223
|
+
|----------------------------|----------|----------------|------------------------------------|
|
|
224
|
+
| `protocol` | string | "openid4vp://" | Protocol for QR codes (optional) |
|
|
225
|
+
| `presentationDefinitionId` | string | - | Predefined verification template |
|
|
226
|
+
| `presentationDefinition` | object | - | Custom verification rules |
|
|
227
|
+
| `onVpProcessed` | function | - | Get full results immediately |
|
|
228
|
+
| `onVpReceived` | function | - | Get transaction ID only |
|
|
229
|
+
| `onQrCodeExpired` | function | - | Handle QR code expiration |
|
|
230
|
+
| `isSameDeviceFlowEnabled` | boolean | true | Enable same-device flow (optional) |
|
|
231
|
+
| `qrCodeStyles` | object | - | Customize QR code appearance |
|
|
227
232
|
|
|
228
233
|
## ⚠️ Important Limitations
|
|
229
234
|
|
|
@@ -23,6 +23,7 @@ export interface QrData {
|
|
|
23
23
|
requestId: string;
|
|
24
24
|
authorizationDetails?: {
|
|
25
25
|
responseType: string;
|
|
26
|
+
responseMode: string;
|
|
26
27
|
clientId: string;
|
|
27
28
|
presentationDefinition: Record<string, unknown>;
|
|
28
29
|
presentationDefinitionUri?: string;
|
|
@@ -40,11 +41,6 @@ export interface VPRequestBody {
|
|
|
40
41
|
presentationDefinitionId?: string;
|
|
41
42
|
presentationDefinition?: PresentationDefinition;
|
|
42
43
|
}
|
|
43
|
-
export interface Wallet {
|
|
44
|
-
name: string;
|
|
45
|
-
scheme: string;
|
|
46
|
-
icon: string;
|
|
47
|
-
}
|
|
48
44
|
type ExclusivePresentationDefinition =
|
|
49
45
|
/**
|
|
50
46
|
* ID of the presentation definition used for verification.
|
|
@@ -79,14 +75,6 @@ type ExclusiveCallbacks =
|
|
|
79
75
|
onVPProcessed: (VPResult: VerificationResults) => void;
|
|
80
76
|
onVPReceived?: never;
|
|
81
77
|
};
|
|
82
|
-
type SameDeviceFlowEnabledProps = {
|
|
83
|
-
isEnableSameDeviceFlow: true;
|
|
84
|
-
supportedWallets: Wallet[];
|
|
85
|
-
};
|
|
86
|
-
type SameDeviceFlowDisabledProps = {
|
|
87
|
-
isEnableSameDeviceFlow?: false | undefined;
|
|
88
|
-
supportedWallets?: Wallet[];
|
|
89
|
-
};
|
|
90
78
|
interface InputDescriptor {
|
|
91
79
|
id: string;
|
|
92
80
|
format?: {
|
|
@@ -106,7 +94,7 @@ export interface PresentationDefinition {
|
|
|
106
94
|
};
|
|
107
95
|
input_descriptors: InputDescriptor[];
|
|
108
96
|
}
|
|
109
|
-
type
|
|
97
|
+
export type OpenID4VPVerificationProps = ExclusivePresentationDefinition & ExclusiveCallbacks & {
|
|
110
98
|
/**
|
|
111
99
|
|
|
112
100
|
React element that triggers the verification process (e.g., a button).
|
|
@@ -120,9 +108,9 @@ type BaseProps = ExclusivePresentationDefinition & ExclusiveCallbacks & {
|
|
|
120
108
|
*/
|
|
121
109
|
verifyServiceUrl: string;
|
|
122
110
|
/**
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
111
|
+
|
|
112
|
+
The client identifier for relaying party.
|
|
113
|
+
*/
|
|
126
114
|
clientId: string;
|
|
127
115
|
/**
|
|
128
116
|
|
|
@@ -135,6 +123,11 @@ type BaseProps = ExclusivePresentationDefinition & ExclusiveCallbacks & {
|
|
|
135
123
|
*/
|
|
136
124
|
transactionId?: string;
|
|
137
125
|
/**
|
|
126
|
+
Indicates whether the same device flow is enabled.
|
|
127
|
+
Defaults to true, allowing verification on the same device.
|
|
128
|
+
*/
|
|
129
|
+
isSameDeviceFlowEnabled?: boolean;
|
|
130
|
+
/**
|
|
138
131
|
|
|
139
132
|
Styling options for the QR code.
|
|
140
133
|
*/
|
|
@@ -154,7 +147,11 @@ type BaseProps = ExclusivePresentationDefinition & ExclusiveCallbacks & {
|
|
|
154
147
|
* Callback triggered when an error occurs during the verification process.
|
|
155
148
|
* This is a required field to ensure proper error handling.
|
|
156
149
|
*/
|
|
157
|
-
onError: (error:
|
|
150
|
+
onError: (error: AppError) => void;
|
|
151
|
+
};
|
|
152
|
+
export type AppError = {
|
|
153
|
+
errorMessage: string;
|
|
154
|
+
errorCode?: string;
|
|
155
|
+
transactionId?: string | null;
|
|
158
156
|
};
|
|
159
|
-
export type OpenID4VPVerificationProps = (BaseProps & SameDeviceFlowEnabledProps) | (BaseProps & SameDeviceFlowDisabledProps);
|
|
160
157
|
export {};
|