@injistack/react-inji-verify-sdk 0.19.0-beta.11 → 0.19.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
CHANGED
|
@@ -78,13 +78,15 @@ function MyApp() {
|
|
|
78
78
|
triggerElement={<button>Show QR for Wallet Scan</button>}
|
|
79
79
|
verifyServiceUrl="https://your-backend.com/v1/verify"
|
|
80
80
|
clientId="did:example:123456789" // DID example
|
|
81
|
-
|
|
81
|
+
dcqlQuery={{
|
|
82
|
+
credentials: [{ id: "id_card", format: "ldp_vc", meta: {} }]
|
|
83
|
+
}}
|
|
82
84
|
isSameDeviceFlowEnabled={false} // QR code flow
|
|
83
85
|
onVPProcessed={(result) => {
|
|
84
86
|
console.log("VP processed:", result);
|
|
85
87
|
}}
|
|
86
88
|
onQrCodeExpired={() => {
|
|
87
|
-
console.log("
|
|
89
|
+
console.log("QR code expired - ask user to retry");
|
|
88
90
|
}}
|
|
89
91
|
onError={(error) => {
|
|
90
92
|
console.error("Verification error:", error);
|
|
@@ -265,7 +267,7 @@ If `summariseResults = false`, the response will be:
|
|
|
265
267
|
"allChecksSuccessful": true,
|
|
266
268
|
"schemaAndSignatureCheck": { "valid": true, "error": null },
|
|
267
269
|
"expiryCheck": { "valid": true },
|
|
268
|
-
"
|
|
270
|
+
"statusCheck": [
|
|
269
271
|
{ "purpose": "revocation", "valid": true, "error": null }
|
|
270
272
|
],
|
|
271
273
|
"claims": {...}
|
|
@@ -279,10 +281,10 @@ If `summariseResults = false`, the response will be:
|
|
|
279
281
|
| `allChecksSuccessful` | boolean | Final aggregated validation flag |
|
|
280
282
|
| `schemaAndSignatureCheck` | object | Validates schema and signature check |
|
|
281
283
|
| `expiryCheck` | object | If false, the credential is EXPIRED |
|
|
282
|
-
| `
|
|
283
|
-
| `
|
|
284
|
-
| `
|
|
285
|
-
| `
|
|
284
|
+
| `statusCheck` | array | Contains revocation and other status validations |
|
|
285
|
+
| `statusCheck[].error` | object | If present, throws an error instead of returning a status |
|
|
286
|
+
| `statusCheck[].purpose` | string | Identifies purpose (e.g., "revocation") |
|
|
287
|
+
| `statusCheck[].valid` | boolean | If false for revocation → credential is revoked |
|
|
286
288
|
| `claims` | object | Includes all claims from credentialSubject |
|
|
287
289
|
|
|
288
290
|
### Option B: OpenID4VP Verification
|
|
@@ -307,42 +309,24 @@ export default function VerifyCrossDevice() {
|
|
|
307
309
|
triggerElement={<button>Show QR for Wallet Scan</button>}
|
|
308
310
|
verifyServiceUrl="https://your-backend.com/v1/verify"
|
|
309
311
|
clientId="did:example:123456789" // DID example
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
},
|
|
318
|
-
input_descriptors: [
|
|
319
|
-
{
|
|
320
|
-
id: "id-card-check",
|
|
321
|
-
constraints: {
|
|
322
|
-
fields: [
|
|
323
|
-
{
|
|
324
|
-
path: ["$.type"],
|
|
325
|
-
filter: {
|
|
326
|
-
type: "object",
|
|
327
|
-
pattern: "DriverLicenseCredential",
|
|
328
|
-
},
|
|
329
|
-
},
|
|
330
|
-
],
|
|
331
|
-
},
|
|
332
|
-
},
|
|
333
|
-
],
|
|
312
|
+
dcqlQuery={{
|
|
313
|
+
credentials: [{
|
|
314
|
+
id: "id_card",
|
|
315
|
+
format: "ldp_vc",
|
|
316
|
+
meta: { type_values: [["DriverLicenseCredential"]] },
|
|
317
|
+
claims: [{ path: ["$.credentialSubject.name"] }]
|
|
318
|
+
}]
|
|
334
319
|
}}
|
|
335
320
|
isSameDeviceFlowEnabled={false} // QR code flow
|
|
336
321
|
onVPProcessed={(result) => {
|
|
337
322
|
console.log("VP processed:", result);
|
|
338
323
|
}}
|
|
339
324
|
onQrCodeExpired={() => {
|
|
340
|
-
console.log("
|
|
325
|
+
console.log("QR code expired - ask user to retry");
|
|
341
326
|
}}
|
|
342
327
|
onError={(error) => {
|
|
343
328
|
console.error("Verification error:", error);
|
|
344
329
|
}}
|
|
345
|
-
|
|
346
330
|
/>
|
|
347
331
|
);
|
|
348
332
|
}
|
|
@@ -357,12 +341,12 @@ sequenceDiagram
|
|
|
357
341
|
UserBrowser->>VerifierBackend: Start verification(/vp-session-request,response_code_validation_required=false)
|
|
358
342
|
|
|
359
343
|
VerifierBackend->>VerifierBackend: Generate transaction_id and request_id
|
|
360
|
-
VerifierBackend-->>UserBrowser: Set HttpOnly Cookie (
|
|
344
|
+
VerifierBackend-->>UserBrowser: Set HttpOnly Cookie (transaction_id)
|
|
361
345
|
VerifierBackend-->>UserBrowser: Return OpenID4VP request + QR code
|
|
362
346
|
|
|
363
347
|
UserBrowser->>MobileWallet: User scans QR code
|
|
364
348
|
|
|
365
|
-
MobileWallet->>VerifierBackend: Submit vp_token
|
|
349
|
+
MobileWallet->>VerifierBackend: Submit vp_token (form-encoded, keyed by DCQL query_id)
|
|
366
350
|
|
|
367
351
|
loop Long Polling
|
|
368
352
|
UserBrowser->>VerifierBackend: GET /vp-request/{requestId}/status
|
|
@@ -371,9 +355,9 @@ sequenceDiagram
|
|
|
371
355
|
|
|
372
356
|
VerifierBackend-->>UserBrowser: Completed
|
|
373
357
|
|
|
374
|
-
UserBrowser->>VerifierBackend:
|
|
358
|
+
UserBrowser->>VerifierBackend: POST /vp-session-results (Cookie transaction_id automatically sent)
|
|
375
359
|
|
|
376
|
-
VerifierBackend->>VerifierBackend: Resolve
|
|
360
|
+
VerifierBackend->>VerifierBackend: Resolve transaction_id from cookie
|
|
377
361
|
VerifierBackend->>VerifierBackend: Fetch transaction state
|
|
378
362
|
|
|
379
363
|
VerifierBackend-->>UserBrowser: Verification result
|
|
@@ -390,30 +374,12 @@ export default function VerifySameDevice() {
|
|
|
390
374
|
triggerElement={<button>Verify with Wallet</button>}
|
|
391
375
|
verifyServiceUrl="https://your-backend.com/v1/verify"
|
|
392
376
|
clientId="client-12345" // non-DID example
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
},
|
|
400
|
-
},
|
|
401
|
-
input_descriptors: [
|
|
402
|
-
{
|
|
403
|
-
id: "id-card-check",
|
|
404
|
-
constraints: {
|
|
405
|
-
fields: [
|
|
406
|
-
{
|
|
407
|
-
path: ["$.type"],
|
|
408
|
-
filter: {
|
|
409
|
-
type: "object",
|
|
410
|
-
pattern: "DriverLicenseCredential",
|
|
411
|
-
},
|
|
412
|
-
},
|
|
413
|
-
],
|
|
414
|
-
},
|
|
415
|
-
},
|
|
416
|
-
],
|
|
377
|
+
dcqlQuery={{
|
|
378
|
+
credentials: [{
|
|
379
|
+
id: "id_card",
|
|
380
|
+
format: "ldp_vc",
|
|
381
|
+
meta: { type_values: [["DriverLicenseCredential"]] }
|
|
382
|
+
}]
|
|
417
383
|
}}
|
|
418
384
|
isSameDeviceFlowEnabled={true} //default value
|
|
419
385
|
// No webWalletBaseUrl → triggers mobile wallet via deep link
|
|
@@ -438,12 +404,12 @@ sequenceDiagram
|
|
|
438
404
|
UserBrowser->>VerifierBackend: Start verification(/vp-session-request,response_code_validation_required=false)
|
|
439
405
|
|
|
440
406
|
VerifierBackend->>VerifierBackend: Generate transaction_id and request_id
|
|
441
|
-
VerifierBackend-->>UserBrowser: Set HttpOnly Cookie (
|
|
407
|
+
VerifierBackend-->>UserBrowser: Set HttpOnly Cookie (transaction_id)
|
|
442
408
|
VerifierBackend-->>UserBrowser: Return OpenID4VP authorization request
|
|
443
409
|
|
|
444
410
|
UserBrowser->>MobileWallet: Open mobile wallet via deep link
|
|
445
411
|
|
|
446
|
-
MobileWallet->>VerifierBackend: Submit vp_token
|
|
412
|
+
MobileWallet->>VerifierBackend: Submit vp_token (form-encoded, keyed by DCQL query_id)
|
|
447
413
|
|
|
448
414
|
Note right of MobileWallet: User manually switches back to browser
|
|
449
415
|
|
|
@@ -454,13 +420,13 @@ sequenceDiagram
|
|
|
454
420
|
|
|
455
421
|
VerifierBackend-->>UserBrowser: Completed
|
|
456
422
|
|
|
457
|
-
UserBrowser->>VerifierBackend:
|
|
423
|
+
UserBrowser->>VerifierBackend: POST /vp-session-results (Cookie transaction_id automatically sent)
|
|
458
424
|
|
|
459
|
-
VerifierBackend->>VerifierBackend: Resolve
|
|
425
|
+
VerifierBackend->>VerifierBackend: Resolve transaction_id from cookie
|
|
460
426
|
VerifierBackend->>VerifierBackend: Fetch transaction state
|
|
461
427
|
|
|
462
428
|
VerifierBackend-->>UserBrowser: Verification result
|
|
463
|
-
VerifierBackend-->>UserBrowser: Clear cookie (
|
|
429
|
+
VerifierBackend-->>UserBrowser: Clear cookie (transaction_id)
|
|
464
430
|
```
|
|
465
431
|
|
|
466
432
|
#### 3. Same Device Flow with Web Wallet
|
|
@@ -474,30 +440,12 @@ export default function VerifySameDevice() {
|
|
|
474
440
|
triggerElement={<button>Verify with Wallet</button>}
|
|
475
441
|
verifyServiceUrl="https://your-backend.com/v1/verify"
|
|
476
442
|
clientId="did:example:123456789" // DID example
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
},
|
|
484
|
-
},
|
|
485
|
-
input_descriptors: [
|
|
486
|
-
{
|
|
487
|
-
id: "id-card-check",
|
|
488
|
-
constraints: {
|
|
489
|
-
fields: [
|
|
490
|
-
{
|
|
491
|
-
path: ["$.type"],
|
|
492
|
-
filter: {
|
|
493
|
-
type: "object",
|
|
494
|
-
pattern: "DriverLicenseCredential",
|
|
495
|
-
},
|
|
496
|
-
},
|
|
497
|
-
],
|
|
498
|
-
},
|
|
499
|
-
},
|
|
500
|
-
],
|
|
443
|
+
dcqlQuery={{
|
|
444
|
+
credentials: [{
|
|
445
|
+
id: "id_card",
|
|
446
|
+
format: "ldp_vc",
|
|
447
|
+
meta: { type_values: [["DriverLicenseCredential"]] }
|
|
448
|
+
}]
|
|
501
449
|
}}
|
|
502
450
|
isSameDeviceFlowEnabled={true} //default value
|
|
503
451
|
webWalletBaseUrl="https://wallet.example.com" // required to support web-wallets
|
|
@@ -522,25 +470,25 @@ sequenceDiagram
|
|
|
522
470
|
UserBrowser->>VerifierBackend: Start verification\n(/vp-session-request,\nresponse_code_validation_required=true)
|
|
523
471
|
|
|
524
472
|
VerifierBackend->>VerifierBackend: Generate transaction_id\nand request_id
|
|
525
|
-
VerifierBackend-->>UserBrowser: Set HttpOnly Cookie (
|
|
473
|
+
VerifierBackend-->>UserBrowser: Set HttpOnly Cookie (transaction_id)
|
|
526
474
|
VerifierBackend-->>UserBrowser: Return OpenID4VP authorization request
|
|
527
475
|
|
|
528
476
|
UserBrowser->>WebWallet: Open Web Wallet
|
|
529
477
|
|
|
530
|
-
WebWallet->>VerifierBackend: Submit vp_token
|
|
478
|
+
WebWallet->>VerifierBackend: Submit vp_token (form-encoded, keyed by DCQL query_id)
|
|
531
479
|
VerifierBackend-->>WebWallet: Return response_code
|
|
532
480
|
|
|
533
481
|
WebWallet-->>UserBrowser: Redirect to redirect_uri
|
|
534
482
|
|
|
535
483
|
UserBrowser->>UserBrowser: Extract response_code
|
|
536
484
|
|
|
537
|
-
UserBrowser->>VerifierBackend:
|
|
485
|
+
UserBrowser->>VerifierBackend: POST /vp-session-results?response_code=xyz\n(Cookie transaction_id automatically sent)
|
|
538
486
|
|
|
539
|
-
VerifierBackend->>VerifierBackend: Validate response_code +
|
|
487
|
+
VerifierBackend->>VerifierBackend: Validate response_code + transaction_id
|
|
540
488
|
VerifierBackend->>VerifierBackend: Fetch transaction state
|
|
541
489
|
|
|
542
490
|
VerifierBackend-->>UserBrowser: Verification result
|
|
543
|
-
VerifierBackend-->>UserBrowser: Clear cookie (
|
|
491
|
+
VerifierBackend-->>UserBrowser: Clear cookie (transaction_id)
|
|
544
492
|
```
|
|
545
493
|
|
|
546
494
|
> **NOTE**
|
|
@@ -559,31 +507,13 @@ export default function VerifyServerToServer() {
|
|
|
559
507
|
triggerElement={<button>Start Verification</button>}
|
|
560
508
|
verifyServiceUrl="https://your-backend.com/v1/verify"
|
|
561
509
|
clientId="did:example:123456789" // DID example
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
},
|
|
570
|
-
input_descriptors: [
|
|
571
|
-
{
|
|
572
|
-
id: "id-card-check",
|
|
573
|
-
constraints: {
|
|
574
|
-
fields: [
|
|
575
|
-
{
|
|
576
|
-
path: ["$.type"],
|
|
577
|
-
filter: {
|
|
578
|
-
type: "object",
|
|
579
|
-
pattern: "DriverLicenseCredential",
|
|
580
|
-
},
|
|
581
|
-
},
|
|
582
|
-
],
|
|
583
|
-
},
|
|
584
|
-
},
|
|
585
|
-
],
|
|
586
|
-
}}
|
|
510
|
+
dcqlQuery={{
|
|
511
|
+
credentials: [{
|
|
512
|
+
id: "id_card",
|
|
513
|
+
format: "ldp_vc",
|
|
514
|
+
meta: { type_values: [["DriverLicenseCredential"]] }
|
|
515
|
+
}]
|
|
516
|
+
}}
|
|
587
517
|
isSameDeviceFlowEnabled={false}
|
|
588
518
|
onVPReceived={(transactionId) => {
|
|
589
519
|
//using the transactionId one can securely fetch the result from service
|
|
@@ -655,51 +585,51 @@ If `summariseResults = false`, the response will be:
|
|
|
655
585
|
| `statusChecks.valid` | boolean | If false for revocation → credential is revoked |
|
|
656
586
|
| `claims` | object | Includes all claims from credentialSubject |
|
|
657
587
|
|
|
658
|
-
###
|
|
588
|
+
### DCQL Query:
|
|
659
589
|
|
|
660
|
-
|
|
590
|
+
The `dcqlQuery` prop describes which credentials to request from the wallet, following the [DCQL (Digital Credentials Query Language)](https://openid.net/specs/openid-4-verifiable-presentations-1_0.html) format.
|
|
661
591
|
|
|
662
|
-
**
|
|
592
|
+
**Minimal example — request a single ldp_vc:**
|
|
663
593
|
|
|
664
594
|
```javascript
|
|
665
|
-
|
|
595
|
+
dcqlQuery={{
|
|
596
|
+
credentials: [{
|
|
597
|
+
id: "id_card",
|
|
598
|
+
format: "ldp_vc",
|
|
599
|
+
meta: { type_values: [["DriverLicenseCredential"]] }
|
|
600
|
+
}]
|
|
601
|
+
}}
|
|
666
602
|
```
|
|
667
603
|
|
|
668
|
-
**
|
|
604
|
+
**Request specific claims:**
|
|
669
605
|
|
|
670
606
|
```javascript
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
],
|
|
692
|
-
},
|
|
693
|
-
},
|
|
607
|
+
dcqlQuery={{
|
|
608
|
+
credentials: [{
|
|
609
|
+
id: "id_card",
|
|
610
|
+
format: "dc+sd-jwt",
|
|
611
|
+
meta: { vct_values: ["DriverLicenseCredential"] },
|
|
612
|
+
claims: [
|
|
613
|
+
{ path: ["$.given_name"] },
|
|
614
|
+
{ path: ["$.birth_date"] }
|
|
615
|
+
]
|
|
616
|
+
}]
|
|
617
|
+
}}
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
**Request multiple credential types (OR logic via credential_sets):**
|
|
621
|
+
|
|
622
|
+
```javascript
|
|
623
|
+
dcqlQuery={{
|
|
624
|
+
credentials: [
|
|
625
|
+
{ id: "mdl", format: "dc+sd-jwt", meta: { vct_values: ["DriverLicense"] } },
|
|
626
|
+
{ id: "pid", format: "ldp_vc", meta: { type_values: [["PersonalID"]] } }
|
|
694
627
|
],
|
|
628
|
+
credential_sets: [
|
|
629
|
+
{ options: [["mdl"], ["pid"]] } // wallet can satisfy with either
|
|
630
|
+
]
|
|
695
631
|
}}
|
|
696
632
|
```
|
|
697
|
-
> **NOTE**
|
|
698
|
-
>
|
|
699
|
-
> Only one of presentationDefinitionId or presentationDefinition should be provided at a time.
|
|
700
|
-
> It is recommended to use:
|
|
701
|
-
>- presentationDefinitionId when leveraging predefined templates.
|
|
702
|
-
>- presentationDefinition when custom verification requirements are needed.
|
|
703
633
|
|
|
704
634
|
## 🎛️ Component Options Reference
|
|
705
635
|
|
|
@@ -730,17 +660,16 @@ presentationDefinition={{
|
|
|
730
660
|
|
|
731
661
|
### OpenID4VPVerification Specific
|
|
732
662
|
|
|
733
|
-
| Property
|
|
734
|
-
|
|
735
|
-
| `
|
|
736
|
-
| `
|
|
737
|
-
| `
|
|
738
|
-
| `
|
|
739
|
-
| `
|
|
740
|
-
| `onQrCodeExpired` | function | - | Handle QR code expiration |
|
|
663
|
+
| Property | Type | Default | Description |
|
|
664
|
+
|---------------------------| -------- |----------------|-------------------------------------------|
|
|
665
|
+
| `dcqlQuery` | object | - | DCQL query describing requested credentials (required) |
|
|
666
|
+
| `protocol` | string | "openid4vp://" | Protocol for QR codes (optional) |
|
|
667
|
+
| `onVPProcessed` | function | - | Get full results immediately |
|
|
668
|
+
| `onVPReceived` | function | - | Get transaction ID only |
|
|
669
|
+
| `onQrCodeExpired` | function | - | Handle QR code expiration |
|
|
741
670
|
| `isSameDeviceFlowEnabled` | boolean | true | Enable same-device flow (optional) |
|
|
742
|
-
| `qrCodeStyles`
|
|
743
|
-
| `vpVerificationRequest`
|
|
671
|
+
| `qrCodeStyles` | object | - | Customize QR code appearance |
|
|
672
|
+
| `vpVerificationRequest` | object | - | contains request body for VP Verification |
|
|
744
673
|
|
|
745
674
|
## ⚠️ Important Limitations
|
|
746
675
|
|