@blockcerts/blockcerts-verifier 1.72.1 → 1.72.2

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.
Files changed (73) hide show
  1. package/bundle-stats.html +33 -32
  2. package/coverage/lcov.info +154 -158
  3. package/dist/{DataIntegrityProof-CsicZNrL-BkSRjzkI.js → DataIntegrityProof-BhL7Kkhm-affsdujn.js} +2 -2
  4. package/dist/EcdsaSd2023-CUjrjGzC-Cx7ejHu-.js +30 -0
  5. package/dist/EcdsaSecp256k1Signature2019-D90cAynb-Bf5kILPF.js +1 -0
  6. package/dist/{Ed25519Signature2020-CglkQLKN-CQ6lMzyG.js → Ed25519Signature2020-fJGvlbIp-B6XhFwr4.js} +4 -4
  7. package/dist/EddsaRdfc2022-XufziFi3-D5IoKiRE.js +14 -0
  8. package/dist/HashlinkVerifier-udsj5z09-BTqOkVoD.js +8 -0
  9. package/dist/MerkleProof2017-C0RhRNNx-zjQMRSQY.js +1 -0
  10. package/dist/MerkleProof2017-C499XBV8-l50m9izr.js +74 -0
  11. package/dist/MerkleProof2019-B7f1hhem-CjLDyx6Q.js +5 -0
  12. package/dist/Suite-Bu3gszvt-Dmvbh142.js +33 -0
  13. package/dist/_polyfill-node.crypto-DGISCHrB-C5-OOGc0.js +1 -0
  14. package/dist/checkCredentialSchemaConformity-CgpOS3eC-AjSPoJub.js +1 -0
  15. package/dist/{checkRevocationStatusList2021-BDBFhnz6-BEBD8TO8.js → checkRevocationStatusList2021-D4VNDRlW-DgNfOAoI.js} +2 -2
  16. package/dist/controlVerificationMethod-CSwPoUL8-CvUADmjg.js +1 -0
  17. package/dist/downloadPDF-UAsY-nU_.js +297 -0
  18. package/dist/ed25519-key-pair.esm-DxoBwwVJ-D8j8wFfG.js +1 -0
  19. package/dist/ensureNotRevoked-ByWaYoog-BheL-ZKZ.js +1 -0
  20. package/dist/ensureNotRevoked-C1kT3A6R-oFUZltl3.js +1 -0
  21. package/dist/{ensureValidIssuingKey-wTUvNuDH-BdV46XBb.js → ensureValidIssuingKey-DEV9E0Ph-DY8BTObG.js} +1 -1
  22. package/dist/index-DZ7aUhT_-D0G2DVsh.js +29 -0
  23. package/dist/index-DjD0A6uJ-BdFUkPCF.js +33 -0
  24. package/dist/index-RfFwckcH.js +1 -0
  25. package/dist/index-tlZQQ_rg-CYTlxhyY.js +1 -0
  26. package/dist/index.es-CnYWLNZV.js +56 -0
  27. package/dist/jsonld-signatures-D4X_Irzi-D_wBqxSl.js +56 -0
  28. package/dist/main.js +142 -133
  29. package/dist/pako.esm-BGRKTPxS-Bodm4Eha.js +2 -0
  30. package/dist/purify.es-Om653OSQ.js +2 -0
  31. package/dist/retrieveVerificationMethodPublicKey-D_autuwE-DGbK-RPm.js +1 -0
  32. package/dist/sha2-JcCWfgvE-By1_saxP.js +2 -0
  33. package/dist/verifyIssuerProfile-2PhdMtQZ-CfqcAkBL.js +1 -0
  34. package/dist/webcrypto.es-BOyMRPOj-CAxP3jJR.js +40 -0
  35. package/package.json +10 -10
  36. package/dist/EcdsaSd2023-DN9HBdgh-Bc0hVwTd.js +0 -30
  37. package/dist/EcdsaSecp256k1Signature2019-C3F03t_M-DAJeMTpu.js +0 -1
  38. package/dist/EddsaRdfc2022-CfoLi-PP-l7ITLQQT.js +0 -14
  39. package/dist/HashlinkVerifier-CTG-OS14-B4Niv2-b.js +0 -8
  40. package/dist/MerkleProof2017-B_EJmYja-CYd4dJc1.js +0 -1
  41. package/dist/MerkleProof2017-k2qjvxCH-DrRpsLHG.js +0 -75
  42. package/dist/MerkleProof2019-B7t13hOo-D8n9YrUw.js +0 -13
  43. package/dist/Suite-BmP2Qu19-D1ucdMDB.js +0 -1
  44. package/dist/_commonjs-dynamic-modules-COweQ1RR-BHR_E30J.js +0 -1
  45. package/dist/base64url-Cy03LJLt-vkTPfQOh.js +0 -4
  46. package/dist/checkCredentialSchemaConformity-BiggGGMP-Dx992E4t.js +0 -1
  47. package/dist/controlVerificationMethod-Bh_-e0Fd-BUCC8ctY.js +0 -1
  48. package/dist/did-key-common.esm-BELyYVSE-Cqrpf7cy.js +0 -9
  49. package/dist/did-key-ed25519.esm-C3GUddDp-BJdBgNDg.js +0 -1
  50. package/dist/did-key-secp256k1.esm-D-R266jM-BTxlD5VW.js +0 -1
  51. package/dist/downloadPDF-D2qwT_DJ.js +0 -297
  52. package/dist/ed25519-key-pair.esm-DQF2kkXh-XX5BXBcl.js +0 -25
  53. package/dist/elliptic-6I21PEnR-CsYseRX1.js +0 -1
  54. package/dist/elliptic-mDX7fQQx-BpaNaVm0.js +0 -1
  55. package/dist/ensureNotRevoked-DGZuNktg-B4uNuqLX.js +0 -1
  56. package/dist/ensureNotRevoked-Dc6VA2bO-DvMIgM4L.js +0 -1
  57. package/dist/index-BrurC4Vt-C0eXpZGn.js +0 -1
  58. package/dist/index-CK9Z4pAC.js +0 -2
  59. package/dist/index-DXh-XAic-B2gT500V.js +0 -22
  60. package/dist/index-DZLKRa_V-D_IQzjvG.js +0 -5
  61. package/dist/index-fQcSLZgh-DpptYyN8.js +0 -1
  62. package/dist/index.es-BIiEi3w5.js +0 -56
  63. package/dist/jsonld-BAMY2WqE-BJ5uVeOU.js +0 -36
  64. package/dist/jsonld-signatures-BbHr1fSN-BSospRuX.js +0 -74
  65. package/dist/keyUtils-ue8EY3Op-DoHdKWgN.js +0 -1
  66. package/dist/pako.esm-BGRKTPxS-UdHShO7y.js +0 -2
  67. package/dist/purify.es-CkKsfeyH.js +0 -2
  68. package/dist/retrieveVerificationMethodPublicKey-CLBY4G8P-CagFGnNt.js +0 -1
  69. package/dist/sha256-Bwge_vjI-C1PUWFZm.js +0 -1
  70. package/dist/verifyIssuerProfile-BaiZaU2c-Zcu1X0PY.js +0 -1
  71. package/dist/webcrypto.es-DptGOl2T-BnVhHKeM.js +0 -40
  72. package/dist/x25519-hG3WOzPe-Dh8L0KYb.js +0 -1
  73. /package/dist/{index-Gr4i_Ned-Dgus2xdV.js → index-CyNtT_1q-Dgus2xdV.js} +0 -0
@@ -1597,24 +1597,24 @@ FN:21,stepVerified
1597
1597
  FN:22,(anonymous_3)
1598
1598
  FNF:4
1599
1599
  FNH:4
1600
- FNDA:679,dispatchActionsFactory
1601
- FNDA:48,dispatchActions
1602
- FNDA:679,stepVerified
1603
- FNDA:679,(anonymous_3)
1600
+ FNDA:681,dispatchActionsFactory
1601
+ FNDA:38,dispatchActions
1602
+ FNDA:681,stepVerified
1603
+ FNDA:681,(anonymous_3)
1604
1604
  DA:8,39
1605
- DA:11,679
1606
- DA:12,48
1607
- DA:17,48
1608
- DA:22,679
1609
- DA:23,679
1610
- DA:24,679
1605
+ DA:11,681
1606
+ DA:12,38
1607
+ DA:17,38
1608
+ DA:22,681
1609
+ DA:23,681
1610
+ DA:24,681
1611
1611
  DA:26,19
1612
- DA:28,679
1613
- DA:29,679
1612
+ DA:28,681
1613
+ DA:29,681
1614
1614
  LF:10
1615
1615
  LH:10
1616
1616
  BRDA:24,0,0,19
1617
- BRDA:24,0,1,660
1617
+ BRDA:24,0,1,662
1618
1618
  BRF:2
1619
1619
  BRH:2
1620
1620
  end_of_record
@@ -1687,12 +1687,12 @@ FNF:1
1687
1687
  FNH:1
1688
1688
  FNDA:83,updateFinalStep
1689
1689
  DA:10,83
1690
- DA:11,2
1690
+ DA:11,1
1691
1691
  DA:16,83
1692
1692
  LF:3
1693
1693
  LH:3
1694
- BRDA:10,0,0,2
1695
- BRDA:10,0,1,81
1694
+ BRDA:10,0,0,1
1695
+ BRDA:10,0,1,82
1696
1696
  BRF:2
1697
1697
  BRH:2
1698
1698
  end_of_record
@@ -1722,69 +1722,69 @@ FN:45,updateParentStepStatus
1722
1722
  FN:46,(anonymous_9)
1723
1723
  FNF:10
1724
1724
  FNH:10
1725
- FNDA:273,stepVerificationIsSuccessful
1726
- FNDA:392,stepVerificationIsFailure
1727
- FNDA:24,oneChildIsSuccess
1728
- FNDA:21,(anonymous_3)
1729
- FNDA:45,allChildrenAreSuccess
1730
- FNDA:38,(anonymous_5)
1731
- FNDA:56,oneChildIsFailure
1732
- FNDA:49,(anonymous_7)
1733
- FNDA:56,updateParentStepStatus
1734
- FNDA:56,(anonymous_9)
1735
- DA:9,273
1736
- DA:13,392
1737
- DA:17,24
1738
- DA:18,24
1739
- DA:19,21
1740
- DA:21,24
1741
- DA:25,45
1742
- DA:26,45
1743
- DA:27,38
1744
- DA:29,45
1745
- DA:33,56
1746
- DA:34,56
1747
- DA:35,49
1748
- DA:37,56
1749
- DA:46,56
1750
- DA:47,56
1725
+ FNDA:220,stepVerificationIsSuccessful
1726
+ FNDA:312,stepVerificationIsFailure
1727
+ FNDA:23,oneChildIsSuccess
1728
+ FNDA:20,(anonymous_3)
1729
+ FNDA:35,allChildrenAreSuccess
1730
+ FNDA:28,(anonymous_5)
1731
+ FNDA:46,oneChildIsFailure
1732
+ FNDA:39,(anonymous_7)
1733
+ FNDA:46,updateParentStepStatus
1734
+ FNDA:46,(anonymous_9)
1735
+ DA:9,220
1736
+ DA:13,312
1737
+ DA:17,23
1738
+ DA:18,23
1739
+ DA:19,20
1740
+ DA:21,23
1741
+ DA:25,35
1742
+ DA:26,35
1743
+ DA:27,28
1744
+ DA:29,35
1745
+ DA:33,46
1746
+ DA:34,46
1747
+ DA:35,39
1748
+ DA:37,46
1749
+ DA:46,46
1750
+ DA:47,46
1751
1751
  DA:48,0
1752
- DA:51,56
1753
- DA:53,56
1754
- DA:54,56
1755
- DA:56,56
1756
- DA:57,13
1757
- DA:60,56
1752
+ DA:51,46
1753
+ DA:53,46
1754
+ DA:54,46
1755
+ DA:56,46
1756
+ DA:57,12
1757
+ DA:60,46
1758
1758
  DA:61,7
1759
- DA:64,56
1759
+ DA:64,46
1760
1760
  DA:65,2
1761
- DA:68,56
1761
+ DA:68,46
1762
1762
  LF:27
1763
1763
  LH:26
1764
- BRDA:18,0,0,21
1764
+ BRDA:18,0,0,20
1765
1765
  BRDA:18,0,1,3
1766
- BRDA:21,1,0,24
1766
+ BRDA:21,1,0,23
1767
1767
  BRDA:21,1,1,11
1768
- BRDA:26,2,0,38
1768
+ BRDA:26,2,0,28
1769
1769
  BRDA:26,2,1,7
1770
- BRDA:29,3,0,45
1770
+ BRDA:29,3,0,35
1771
1771
  BRDA:29,3,1,11
1772
- BRDA:34,4,0,49
1772
+ BRDA:34,4,0,39
1773
1773
  BRDA:34,4,1,7
1774
- BRDA:37,5,0,56
1775
- BRDA:37,5,1,54
1774
+ BRDA:37,5,0,46
1775
+ BRDA:37,5,1,44
1776
1776
  BRDA:47,6,0,0
1777
- BRDA:47,6,1,56
1778
- BRDA:56,7,0,13
1779
- BRDA:56,7,1,43
1780
- BRDA:56,8,0,56
1781
- BRDA:56,8,1,24
1777
+ BRDA:47,6,1,46
1778
+ BRDA:56,7,0,12
1779
+ BRDA:56,7,1,34
1780
+ BRDA:56,8,0,46
1781
+ BRDA:56,8,1,23
1782
1782
  BRDA:60,9,0,7
1783
- BRDA:60,9,1,49
1784
- BRDA:60,10,0,56
1785
- BRDA:60,10,1,45
1783
+ BRDA:60,9,1,39
1784
+ BRDA:60,10,0,46
1785
+ BRDA:60,10,1,35
1786
1786
  BRDA:64,11,0,2
1787
- BRDA:64,11,1,54
1787
+ BRDA:64,11,1,44
1788
1788
  BRF:24
1789
1789
  BRH:23
1790
1790
  end_of_record
@@ -1845,7 +1845,7 @@ FNF:3
1845
1845
  FNH:3
1846
1846
  FNDA:157,verifyCertificate
1847
1847
  FNDA:157,(anonymous_1)
1848
- FNDA:668,(anonymous_2)
1848
+ FNDA:670,(anonymous_2)
1849
1849
  DA:18,157
1850
1850
  DA:19,157
1851
1851
  DA:21,157
@@ -1858,7 +1858,7 @@ DA:34,73
1858
1858
  DA:36,73
1859
1859
  DA:37,65
1860
1860
  DA:38,65
1861
- DA:40,668
1861
+ DA:40,670
1862
1862
  DA:43,65
1863
1863
  DA:44,65
1864
1864
  LF:15
@@ -3752,10 +3752,8 @@ DA:7,45
3752
3752
  DA:8,45
3753
3753
  LF:7
3754
3754
  LH:7
3755
- BRDA:5,0,0,45
3756
- BRDA:5,0,1,45
3757
- BRF:2
3758
- BRH:2
3755
+ BRF:0
3756
+ BRH:0
3759
3757
  end_of_record
3760
3758
  TN:
3761
3759
  SF:src/constants/downloadFlag.ts
@@ -3780,10 +3778,8 @@ DA:5,45
3780
3778
  DA:6,45
3781
3779
  LF:5
3782
3780
  LH:5
3783
- BRDA:4,0,0,45
3784
- BRDA:4,0,1,45
3785
- BRF:2
3786
- BRH:2
3781
+ BRF:0
3782
+ BRH:0
3787
3783
  end_of_record
3788
3784
  TN:
3789
3785
  SF:src/domain/compose.ts
@@ -3855,9 +3851,9 @@ FN:6,(anonymous_1)
3855
3851
  FNF:2
3856
3852
  FNH:2
3857
3853
  FNDA:223,initializeVerificationSteps
3858
- FNDA:459,(anonymous_1)
3854
+ FNDA:472,(anonymous_1)
3859
3855
  DA:5,223
3860
- DA:6,459
3856
+ DA:6,472
3861
3857
  LF:2
3862
3858
  LH:2
3863
3859
  BRF:0
@@ -3945,8 +3941,8 @@ FNF:4
3945
3941
  FNH:4
3946
3942
  FNDA:5,handleError
3947
3943
  FNDA:10,retrieve
3948
- FNDA:7,(anonymous_2)
3949
- FNDA:7,(anonymous_3)
3944
+ FNDA:8,(anonymous_2)
3945
+ FNDA:8,(anonymous_3)
3950
3946
  DA:11,5
3951
3947
  DA:12,5
3952
3948
  DA:19,10
@@ -3954,11 +3950,11 @@ DA:20,1
3954
3950
  DA:21,1
3955
3951
  DA:24,9
3956
3952
  DA:26,9
3957
- DA:27,7
3958
- DA:29,7
3959
- DA:30,7
3960
- DA:34,3
3961
- DA:35,3
3953
+ DA:27,8
3954
+ DA:29,8
3955
+ DA:30,8
3956
+ DA:34,4
3957
+ DA:35,4
3962
3958
  LF:12
3963
3959
  LH:12
3964
3960
  BRDA:19,0,0,1
@@ -4352,9 +4348,9 @@ FNF:6
4352
4348
  FNH:6
4353
4349
  FNDA:38,(anonymous_0)
4354
4350
  FNDA:19,(anonymous_1)
4355
- FNDA:679,(anonymous_2)
4356
- FNDA:50,(anonymous_3)
4357
- FNDA:679,(anonymous_4)
4351
+ FNDA:681,(anonymous_2)
4352
+ FNDA:40,(anonymous_3)
4353
+ FNDA:681,(anonymous_4)
4358
4354
  FNDA:38,(anonymous_5)
4359
4355
  DA:10,38
4360
4356
  DA:11,38
@@ -4362,30 +4358,30 @@ DA:12,38
4362
4358
  DA:13,38
4363
4359
  DA:14,38
4364
4360
  DA:18,19
4365
- DA:22,679
4366
- DA:23,679
4367
- DA:28,50
4368
- DA:29,50
4369
- DA:30,48
4361
+ DA:22,681
4362
+ DA:23,681
4363
+ DA:28,40
4364
+ DA:29,40
4365
+ DA:30,38
4370
4366
  DA:31,2
4371
4367
  DA:32,2
4372
4368
  DA:33,2
4373
- DA:38,679
4369
+ DA:38,681
4374
4370
  DA:39,19
4375
4371
  DA:40,19
4376
4372
  DA:45,39
4377
4373
  DA:46,38
4378
4374
  LF:19
4379
4375
  LH:19
4380
- BRDA:22,0,0,679
4376
+ BRDA:22,0,0,681
4381
4377
  BRDA:22,0,1,0
4382
- BRDA:29,1,0,48
4378
+ BRDA:29,1,0,38
4383
4379
  BRDA:29,1,1,2
4384
4380
  BRDA:31,2,0,2
4385
4381
  BRDA:31,2,1,0
4386
4382
  BRDA:38,3,0,19
4387
- BRDA:38,3,1,660
4388
- BRDA:38,4,0,679
4383
+ BRDA:38,3,1,662
4384
+ BRDA:38,4,0,681
4389
4385
  BRDA:38,4,1,19
4390
4386
  BRF:10
4391
4387
  BRH:8
@@ -4681,7 +4677,7 @@ FN:33,(anonymous_2)
4681
4677
  FN:42,(anonymous_3)
4682
4678
  FN:43,(anonymous_4)
4683
4679
  FN:44,(anonymous_5)
4684
- FN:73,ProxyPolyfill2
4680
+ FN:73,ProxyPolyfill
4685
4681
  FN:106,(anonymous_7)
4686
4682
  FN:110,(anonymous_8)
4687
4683
  FN:115,(anonymous_9)
@@ -4696,7 +4692,7 @@ FNDA:0,(anonymous_2)
4696
4692
  FNDA:0,(anonymous_3)
4697
4693
  FNDA:0,(anonymous_4)
4698
4694
  FNDA:0,(anonymous_5)
4699
- FNDA:0,ProxyPolyfill2
4695
+ FNDA:0,ProxyPolyfill
4700
4696
  FNDA:0,(anonymous_7)
4701
4697
  FNDA:0,(anonymous_8)
4702
4698
  FNDA:0,(anonymous_9)
@@ -4849,18 +4845,18 @@ SF:src/reducers/index.ts
4849
4845
  FN:18,app
4850
4846
  FNF:1
4851
4847
  FNH:1
4852
- FNDA:1394,app
4853
- DA:19,1394
4848
+ FNDA:1374,app
4849
+ DA:19,1374
4854
4850
  DA:21,86
4855
4851
  DA:24,22
4856
4852
  DA:27,149
4857
4853
  DA:30,11
4858
4854
  DA:33,6
4859
- DA:36,56
4855
+ DA:36,46
4860
4856
  DA:39,12
4861
4857
  DA:42,165
4862
4858
  DA:45,152
4863
- DA:48,48
4859
+ DA:48,38
4864
4860
  DA:51,156
4865
4861
  DA:54,83
4866
4862
  DA:57,0
@@ -4872,11 +4868,11 @@ BRDA:19,0,1,22
4872
4868
  BRDA:19,0,2,149
4873
4869
  BRDA:19,0,3,11
4874
4870
  BRDA:19,0,4,6
4875
- BRDA:19,0,5,56
4871
+ BRDA:19,0,5,46
4876
4872
  BRDA:19,0,6,12
4877
4873
  BRDA:19,0,7,165
4878
4874
  BRDA:19,0,8,152
4879
- BRDA:19,0,9,48
4875
+ BRDA:19,0,9,38
4880
4876
  BRDA:19,0,10,156
4881
4877
  BRDA:19,0,11,83
4882
4878
  BRDA:19,0,12,0
@@ -4942,31 +4938,31 @@ FN:14,(anonymous_3)
4942
4938
  FN:22,stepVerified
4943
4939
  FNF:5
4944
4940
  FNH:5
4945
- FNDA:48,updateSubstepIn
4941
+ FNDA:38,updateSubstepIn
4946
4942
  FNDA:6,(anonymous_1)
4947
- FNDA:44,(anonymous_2)
4948
- FNDA:144,(anonymous_3)
4949
- FNDA:48,stepVerified
4950
- DA:7,48
4951
- DA:8,48
4943
+ FNDA:34,(anonymous_2)
4944
+ FNDA:102,(anonymous_3)
4945
+ FNDA:38,stepVerified
4946
+ DA:7,38
4947
+ DA:8,38
4952
4948
  DA:9,4
4953
4949
  DA:10,4
4954
- DA:12,44
4955
- DA:13,44
4956
- DA:14,144
4957
- DA:15,44
4958
- DA:16,44
4959
- DA:23,48
4960
- DA:24,48
4961
- DA:25,48
4962
- DA:27,48
4950
+ DA:12,34
4951
+ DA:13,34
4952
+ DA:14,102
4953
+ DA:15,34
4954
+ DA:16,34
4955
+ DA:23,38
4956
+ DA:24,38
4957
+ DA:25,38
4958
+ DA:27,38
4963
4959
  LF:13
4964
4960
  LH:13
4965
4961
  BRDA:8,0,0,4
4966
- BRDA:8,0,1,44
4967
- BRDA:12,1,0,44
4962
+ BRDA:8,0,1,34
4963
+ BRDA:12,1,0,34
4968
4964
  BRDA:12,1,1,0
4969
- BRDA:15,2,0,44
4965
+ BRDA:15,2,0,34
4970
4966
  BRDA:15,2,1,0
4971
4967
  BRF:6
4972
4968
  BRH:4
@@ -5026,11 +5022,11 @@ SF:src/reducers/updateParentStepStatus.ts
5026
5022
  FN:6,updateParentStepStatus
5027
5023
  FNF:1
5028
5024
  FNH:1
5029
- FNDA:56,updateParentStepStatus
5030
- DA:7,56
5031
- DA:9,56
5032
- DA:11,56
5033
- DA:13,56
5025
+ FNDA:46,updateParentStepStatus
5026
+ DA:7,46
5027
+ DA:9,46
5028
+ DA:11,46
5029
+ DA:13,46
5034
5030
  LF:4
5035
5031
  LH:4
5036
5032
  BRF:0
@@ -5300,9 +5296,9 @@ FNDA:25,(anonymous_27)
5300
5296
  FNDA:15,isTestChain
5301
5297
  FNDA:11,(anonymous_29)
5302
5298
  FNDA:0,isTestChainAtIndex
5303
- FNDA:192,getVerifiedSteps
5304
- FNDA:164,getParentStep
5305
- FNDA:184,(anonymous_33)
5299
+ FNDA:162,getVerifiedSteps
5300
+ FNDA:134,getParentStep
5301
+ FNDA:154,(anonymous_33)
5306
5302
  FNDA:1,getStartedVerificationSteps
5307
5303
  FNDA:2,(anonymous_35)
5308
5304
  FNDA:5,getHasError
@@ -5454,8 +5450,8 @@ DA:321,0
5454
5450
  DA:322,0
5455
5451
  DA:323,0
5456
5452
  DA:325,0
5457
- DA:329,192
5458
- DA:334,184
5453
+ DA:329,162
5454
+ DA:334,154
5459
5455
  DA:338,1
5460
5456
  DA:340,2
5461
5457
  DA:344,9
@@ -5588,7 +5584,7 @@ BRDA:322,41,0,0
5588
5584
  BRDA:322,41,1,0
5589
5585
  BRDA:325,42,0,0
5590
5586
  BRDA:325,42,1,0
5591
- BRDA:329,43,0,192
5587
+ BRDA:329,43,0,162
5592
5588
  BRDA:329,43,1,0
5593
5589
  BRDA:379,44,0,0
5594
5590
  BRDA:379,44,1,12
@@ -6509,40 +6505,40 @@ FN:26,(anonymous_2)
6509
6505
  FN:29,(anonymous_3)
6510
6506
  FN:31,(anonymous_4)
6511
6507
  FNF:5
6512
- FNH:3
6513
- FNDA:76,(anonymous_0)
6514
- FNDA:76,(anonymous_1)
6508
+ FNH:0
6509
+ FNDA:0,(anonymous_0)
6510
+ FNDA:0,(anonymous_1)
6515
6511
  FNDA:0,(anonymous_2)
6516
6512
  FNDA:0,(anonymous_3)
6517
- FNDA:76,(anonymous_4)
6518
- DA:16,76
6519
- DA:20,76
6520
- DA:21,76
6521
- DA:22,76
6522
- DA:32,76
6523
- DA:34,13
6524
- DA:37,24
6513
+ FNDA:0,(anonymous_4)
6514
+ DA:16,0
6515
+ DA:20,0
6516
+ DA:21,0
6517
+ DA:22,0
6518
+ DA:32,0
6519
+ DA:34,0
6520
+ DA:37,0
6525
6521
  DA:40,0
6526
- DA:43,6
6527
- DA:46,2
6528
- DA:50,16
6529
- DA:53,15
6522
+ DA:43,0
6523
+ DA:46,0
6524
+ DA:50,0
6525
+ DA:53,0
6530
6526
  DA:57,0
6531
6527
  DA:80,0
6532
6528
  LF:14
6533
- LH:11
6534
- BRDA:32,0,0,13
6535
- BRDA:32,0,1,24
6529
+ LH:0
6530
+ BRDA:32,0,0,0
6531
+ BRDA:32,0,1,0
6536
6532
  BRDA:32,0,2,0
6537
- BRDA:32,0,3,6
6538
- BRDA:32,0,4,2
6533
+ BRDA:32,0,3,0
6534
+ BRDA:32,0,4,0
6539
6535
  BRDA:32,0,5,0
6540
- BRDA:32,0,6,16
6541
- BRDA:32,0,7,15
6536
+ BRDA:32,0,6,0
6537
+ BRDA:32,0,7,0
6542
6538
  BRDA:32,0,8,0
6543
6539
  BRDA:32,0,9,0
6544
6540
  BRF:10
6545
- BRH:6
6541
+ BRH:0
6546
6542
  end_of_record
6547
6543
  TN:
6548
6544
  SF:test/application/__helpers/stubCertificateVerify.ts
@@ -1,7 +1,7 @@
1
- import{r as t,j as e}from"./jsonld-signatures-BbHr1fSN-BSospRuX.js";import{e as r,d as o}from"./index-DZLKRa_V-D_IQzjvG.js";import{d as i}from"./base64url-Cy03LJLt-vkTPfQOh.js";var n=t();
1
+ import{r as t}from"./Suite-Bu3gszvt-Dmvbh142.js";import{u as e,f as r,s as o}from"./main.js";import{j as i}from"./jsonld-signatures-D4X_Irzi-D_wBqxSl.js";var n=t();
2
2
  /*!
3
3
  * Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
4
4
  */const a=new RegExp("-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](.[0-9]+)?|(24:00:00(.0+)?))(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?"),s=t=>a.test(t),c=self&&(self.crypto||self.msCrypto);async function u({string:t}){const e=(new TextEncoder).encode(t);return new Uint8Array(await c.subtle.digest("SHA-256",e))}
5
5
  /*!
6
6
  * Copyright (c) 2022-2024 Digital Bazaar, Inc. All rights reserved.
7
- */const{suites:{LinkedDataProof:d}}=e;class f extends d{constructor({signer:t,date:e,cryptosuite:r,legacyContext:o=!1}={}){super({type:"DataIntegrityProof"});const{canonize:i,createVerifier:n,name:a,requiredAlgorithm:s,derive:c,createProofValue:u,createVerifyData:d}=r;if(!n||"function"!=typeof n)throw new TypeError('"cryptosuite.createVerifier" must be a function.');if(c&&"function"!=typeof c)throw new TypeError('"cryptosuite.derive" must be a function.');if(u&&"function"!=typeof u)throw new TypeError('"cryptosuite.createProofValue" must be a function.');if(d&&"function"!=typeof d)throw new TypeError('"cryptosuite.createVerifyData" must be a function.');if(this.contextUrl="https://w3id.org/security/data-integrity/v2",o&&(this.contextUrl="https://w3id.org/security/data-integrity/v1"),this.canonize=i,this.createVerifier=n,this.cryptosuite=a,this._cryptosuite=r,this.requiredAlgorithm=s,e){if(this.date=new Date(e),isNaN(this.date))throw TypeError(`"date" "${e}" is not a valid date.`)}else null===e&&(this.date=null);const f=function({signer:t,requiredAlgorithm:e}){const r={verificationMethod:void 0,signer:void 0};if(!t)return r;if("function"!=typeof t.sign)throw new TypeError("A signer API has not been specified.");const o=Array.isArray(e)?e.includes(t.algorithm):e===t.algorithm;if(!o){const r=Array.isArray(e)?e.join(", "):e,o=Array.isArray(e)?`is not a supported algorithm for the cryptosuite. The supported algorithms are: "${r}".`:`does not match the required algorithm for the cryptosuite "${r}".`,i=`The signer's algorithm "${t.algorithm}" ${o}`;throw new Error(i)}return r.signer=t,r.verificationMethod=t.id,r}({signer:t,requiredAlgorithm:s});this.verificationMethod=f.verificationMethod,this.signer=f.signer}async sign({verifyData:t,proof:e}){if(!this.signer||"function"!=typeof this.signer.sign)throw new Error("A signer API has not been specified.");const o=await this.signer.sign({data:t});return e.proofValue="z"+r(o),e}async verifySignature({verifyData:t,verificationMethod:e,proof:r}){const n=await this.createVerifier({verificationMethod:e});if(!(Array.isArray(this.requiredAlgorithm)?this.requiredAlgorithm.includes(n.algorithm):this.requiredAlgorithm===n.algorithm)){const t=Array.isArray(this.requiredAlgorithm)?this.requiredAlgorithm.join(", "):this.requiredAlgorithm,e=Array.isArray(this.requiredAlgorithm)?`is not a supported algorithm for the cryptosuite. The supported algorithms are: "${t}".`:`does not match the required algorithm for the cryptosuite "${t}".`,r=`The verifier's algorithm "${n.algorithm}" ${e}`;throw new Error(r)}const{proofValue:a}=r;if(!a||"string"!=typeof a)throw new TypeError('The proof does not include a valid "proofValue" property.');const s=a[0];let c;if("z"===s)c=o(a.slice(1));else{if("u"!==s)throw new Error("Only base58btc or base64url multibase encoding is supported.");c=i(a.slice(1))}return n.verify({data:t,signature:c})}async createProof({document:t,purpose:e,proofSet:r,documentLoader:o}){let i;i=this.proof?{...this.proof}:{},i.type=this.type;let n,a=this.date;return void 0===i.created&&void 0===a&&(a=new Date),a&&"string"!=typeof a&&(a=(t=>(null==t?t=new Date:"number"!=typeof t&&"string"!=typeof t||(t=new Date(t)),t.toISOString().slice(0,-5)+"Z"))(a)),a&&(i.created=a),i.verificationMethod=this.verificationMethod,i.cryptosuite=this.cryptosuite,i=await this.updateProof({document:t,proof:i,purpose:e,proofSet:r,documentLoader:o}),i=await e.update(i,{document:t,suite:this,documentLoader:o}),n=this._cryptosuite.createVerifyData?await this._cryptosuite.createVerifyData({cryptosuite:this._cryptosuite,document:t,proof:i,proofSet:r,documentLoader:o,dataIntegrityProof:this}):await this.createVerifyData({document:t,proof:i,proofSet:r,documentLoader:o}),this._cryptosuite.createProofValue?i.proofValue=await this._cryptosuite.createProofValue({cryptosuite:this._cryptosuite,verifyData:n,document:t,proof:i,proofSet:r,documentLoader:o,dataIntegrityProof:this}):i=await this.sign({verifyData:n,document:t,proof:i,proofSet:r,documentLoader:o}),i}async derive({document:t,purpose:e,proofSet:r,documentLoader:o}){if(!this._cryptosuite.derive)throw new Error('"cryptosuite.derive" not provided.');return this._cryptosuite.derive({cryptosuite:this._cryptosuite,document:t,purpose:e,proofSet:r,documentLoader:o,dataIntegrityProof:this})}async updateProof({proof:t}){return t}async verifyProof({proof:t,proofSet:e,document:r,documentLoader:o}){try{const i=await this.getVerificationMethod({proof:t,documentLoader:o});let n;n=this._cryptosuite.createVerifyData?await this._cryptosuite.createVerifyData({cryptosuite:this._cryptosuite,document:r,proof:t,proofSet:e,documentLoader:o,dataIntegrityProof:this,verificationMethod:i}):await this.createVerifyData({document:r,proof:t,proofSet:e,documentLoader:o,verificationMethod:i});if(!await this.verifySignature({verifyData:n,verificationMethod:i,proof:t}))throw new Error("Invalid signature.");if(void 0!==t.created&&!s(t.created))throw new Error(`"proof.created" ("${t.created}") must be an XSD dateTimeStamp.`);if(void 0!==t.expires&&!s(t.expires))throw new Error(`"proof.expires" ("${t.expires}") must be an XSD dateTimeStamp.`);return{verified:!0,verificationMethod:i}}catch(t){return{verified:!1,error:t}}}async createVerifyData({document:t,proof:e,documentLoader:r}){let o;const{_hashCache:i}=this;i&&i.document===t?o=i.hash:this._hashCache={document:t,hash:o=this.canonize(t,{documentLoader:r,base:null,safe:!0}).then((t=>u({string:t})))};const[n,a]=await Promise.all([this.canonizeProof(e,{document:t,documentLoader:r}).then((t=>u({string:t}))),o]);return((t,e)=>{const r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r})(n,a)}async getVerificationMethod({proof:t,documentLoader:e}){let{verificationMethod:r}=t;if("object"==typeof r&&(r=r.id),!r)throw new Error('No "verificationMethod" found in proof.');const o=await e(r);if(!o)throw new Error(`Unable to load verification method "${r}".`);const{document:i}=o;return r="string"==typeof i?JSON.parse(i):i,r}async canonizeProof(t,{documentLoader:e,document:r}){return t={"@context":r["@context"],...t},this.ensureSuiteContext({document:t,addSuiteContext:!0}),delete t.proofValue,this.canonize(t,{documentLoader:e,safe:!0,base:null,skipExpansion:!1})}async matchProof({proof:t}){const{type:e,cryptosuite:r}=t;return e===this.type&&r===this.cryptosuite}ensureSuiteContext({document:t,addSuiteContext:e}){const{contextUrl:r}=this;if(h({document:t,contextUrl:r})||h({document:t,contextUrl:"https://www.w3.org/ns/credentials/v2"}))return;if(!e)throw new TypeError(`The document to be signed must contain this suite's @context, "${r}".`);const o=t["@context"]||[];t["@context"]=Array.isArray(o)?[...o,r]:[o,r]}}function h({document:t,contextUrl:e}){const r=t["@context"];return r===e||Array.isArray(r)&&r.includes(e)}export{f as D,n as r};
7
+ */const{suites:{LinkedDataProof:d}}=i;class f extends d{constructor({signer:t,date:e,cryptosuite:r,legacyContext:o=!1}={}){super({type:"DataIntegrityProof"});const{canonize:i,createVerifier:n,name:a,requiredAlgorithm:s,derive:c,createProofValue:u,createVerifyData:d}=r;if(!n||"function"!=typeof n)throw new TypeError('"cryptosuite.createVerifier" must be a function.');if(c&&"function"!=typeof c)throw new TypeError('"cryptosuite.derive" must be a function.');if(u&&"function"!=typeof u)throw new TypeError('"cryptosuite.createProofValue" must be a function.');if(d&&"function"!=typeof d)throw new TypeError('"cryptosuite.createVerifyData" must be a function.');if(this.contextUrl="https://w3id.org/security/data-integrity/v2",o&&(this.contextUrl="https://w3id.org/security/data-integrity/v1"),this.canonize=i,this.createVerifier=n,this.cryptosuite=a,this._cryptosuite=r,this.requiredAlgorithm=s,e){if(this.date=new Date(e),isNaN(this.date))throw TypeError(`"date" "${e}" is not a valid date.`)}else null===e&&(this.date=null);const f=function({signer:t,requiredAlgorithm:e}){const r={verificationMethod:void 0,signer:void 0};if(!t)return r;if("function"!=typeof t.sign)throw new TypeError("A signer API has not been specified.");const o=Array.isArray(e)?e.includes(t.algorithm):e===t.algorithm;if(!o){const r=Array.isArray(e)?e.join(", "):e,o=Array.isArray(e)?`is not a supported algorithm for the cryptosuite. The supported algorithms are: "${r}".`:`does not match the required algorithm for the cryptosuite "${r}".`,i=`The signer's algorithm "${t.algorithm}" ${o}`;throw new Error(i)}return r.signer=t,r.verificationMethod=t.id,r}({signer:t,requiredAlgorithm:s});this.verificationMethod=f.verificationMethod,this.signer=f.signer}async sign({verifyData:t,proof:r}){if(!this.signer||"function"!=typeof this.signer.sign)throw new Error("A signer API has not been specified.");const o=await this.signer.sign({data:t});return r.proofValue="z"+e(o),r}async verifySignature({verifyData:t,verificationMethod:e,proof:i}){const n=await this.createVerifier({verificationMethod:e});if(!(Array.isArray(this.requiredAlgorithm)?this.requiredAlgorithm.includes(n.algorithm):this.requiredAlgorithm===n.algorithm)){const t=Array.isArray(this.requiredAlgorithm)?this.requiredAlgorithm.join(", "):this.requiredAlgorithm,e=Array.isArray(this.requiredAlgorithm)?`is not a supported algorithm for the cryptosuite. The supported algorithms are: "${t}".`:`does not match the required algorithm for the cryptosuite "${t}".`,r=`The verifier's algorithm "${n.algorithm}" ${e}`;throw new Error(r)}const{proofValue:a}=i;if(!a||"string"!=typeof a)throw new TypeError('The proof does not include a valid "proofValue" property.');const s=a[0];let c;if("z"===s)c=r(a.slice(1));else{if("u"!==s)throw new Error("Only base58btc or base64url multibase encoding is supported.");c=o(a.slice(1))}return n.verify({data:t,signature:c})}async createProof({document:t,purpose:e,proofSet:r,documentLoader:o}){let i;i=this.proof?{...this.proof}:{},i.type=this.type;let n,a=this.date;return void 0===i.created&&void 0===a&&(a=new Date),a&&"string"!=typeof a&&(a=(t=>(null==t?t=new Date:"number"!=typeof t&&"string"!=typeof t||(t=new Date(t)),t.toISOString().slice(0,-5)+"Z"))(a)),a&&(i.created=a),i.verificationMethod=this.verificationMethod,i.cryptosuite=this.cryptosuite,i=await this.updateProof({document:t,proof:i,purpose:e,proofSet:r,documentLoader:o}),i=await e.update(i,{document:t,suite:this,documentLoader:o}),n=this._cryptosuite.createVerifyData?await this._cryptosuite.createVerifyData({cryptosuite:this._cryptosuite,document:t,proof:i,proofSet:r,documentLoader:o,dataIntegrityProof:this}):await this.createVerifyData({document:t,proof:i,proofSet:r,documentLoader:o}),this._cryptosuite.createProofValue?i.proofValue=await this._cryptosuite.createProofValue({cryptosuite:this._cryptosuite,verifyData:n,document:t,proof:i,proofSet:r,documentLoader:o,dataIntegrityProof:this}):i=await this.sign({verifyData:n,document:t,proof:i,proofSet:r,documentLoader:o}),i}async derive({document:t,purpose:e,proofSet:r,documentLoader:o}){if(!this._cryptosuite.derive)throw new Error('"cryptosuite.derive" not provided.');return this._cryptosuite.derive({cryptosuite:this._cryptosuite,document:t,purpose:e,proofSet:r,documentLoader:o,dataIntegrityProof:this})}async updateProof({proof:t}){return t}async verifyProof({proof:t,proofSet:e,document:r,documentLoader:o}){try{const i=await this.getVerificationMethod({proof:t,documentLoader:o});let n;n=this._cryptosuite.createVerifyData?await this._cryptosuite.createVerifyData({cryptosuite:this._cryptosuite,document:r,proof:t,proofSet:e,documentLoader:o,dataIntegrityProof:this,verificationMethod:i}):await this.createVerifyData({document:r,proof:t,proofSet:e,documentLoader:o,verificationMethod:i});if(!await this.verifySignature({verifyData:n,verificationMethod:i,proof:t}))throw new Error("Invalid signature.");if(void 0!==t.created&&!s(t.created))throw new Error(`"proof.created" ("${t.created}") must be an XSD dateTimeStamp.`);if(void 0!==t.expires&&!s(t.expires))throw new Error(`"proof.expires" ("${t.expires}") must be an XSD dateTimeStamp.`);return{verified:!0,verificationMethod:i}}catch(t){return{verified:!1,error:t}}}async createVerifyData({document:t,proof:e,documentLoader:r}){let o;const{_hashCache:i}=this;i&&i.document===t?o=i.hash:this._hashCache={document:t,hash:o=this.canonize(t,{documentLoader:r,base:null,safe:!0}).then(t=>u({string:t}))};const[n,a]=await Promise.all([this.canonizeProof(e,{document:t,documentLoader:r}).then(t=>u({string:t})),o]);return((t,e)=>{const r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r})(n,a)}async getVerificationMethod({proof:t,documentLoader:e}){let{verificationMethod:r}=t;if("object"==typeof r&&(r=r.id),!r)throw new Error('No "verificationMethod" found in proof.');const o=await e(r);if(!o)throw new Error(`Unable to load verification method "${r}".`);const{document:i}=o;return r="string"==typeof i?JSON.parse(i):i,r}async canonizeProof(t,{documentLoader:e,document:r}){return t={"@context":r["@context"],...t},this.ensureSuiteContext({document:t,addSuiteContext:!0}),delete t.proofValue,this.canonize(t,{documentLoader:e,safe:!0,base:null,skipExpansion:!1})}async matchProof({proof:t}){const{type:e,cryptosuite:r}=t;return e===this.type&&r===this.cryptosuite}ensureSuiteContext({document:t,addSuiteContext:e}){const{contextUrl:r}=this;if(h({document:t,contextUrl:r})||h({document:t,contextUrl:"https://www.w3.org/ns/credentials/v2"}))return;if(!e)throw new TypeError(`The document to be signed must contain this suite's @context, "${r}".`);const o=t["@context"]||[];t["@context"]=Array.isArray(o)?[...o,r]:[o,r]}}function h({document:t,contextUrl:e}){const r=t["@context"];return r===e||Array.isArray(r)&&r.includes(e)}export{f as D,n as r};
@@ -0,0 +1,30 @@
1
+ import{d as e,p as t,V as n,s as r,u as o,t as i}from"./main.js";import{j as a}from"./jsonld-signatures-D4X_Irzi-D_wBqxSl.js";import{S as s,j as u}from"./Suite-Bu3gszvt-Dmvbh142.js";import{D as c,r as f}from"./DataIntegrityProof-BhL7Kkhm-affsdujn.js";import{f as l}from"./index-DZ7aUhT_-D0G2DVsh.js";import"./pako.esm-BGRKTPxS-Bodm4Eha.js";import"./index-CyNtT_1q-Dgus2xdV.js";import{r as d}from"./retrieveVerificationMethodPublicKey-D_autuwE-DGbK-RPm.js";import"./sha2-JcCWfgvE-By1_saxP.js";
2
+ /*!
3
+ * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
4
+ */
5
+ const h=globalThis.crypto;
6
+ /*!
7
+ * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
8
+ */function p({algorithm:e="sha256"}={}){if("sha256"!==e)throw new Error(`Unsupported algorithm "${e}".`);return{hash:async e=>new Uint8Array(await h.subtle.digest("SHA-256",e))}}
9
+ /*!
10
+ * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
11
+ */const y=new TextEncoder;function w(e){return y.encode(e)}
12
+ /*!
13
+ * Copyright (c) 2023-2024 Digital Bazaar, Inc. All rights reserved.
14
+ */async function g({document:e,labelMapFactoryFunction:t,options:n}={}){const{nquads:r}=await async function({document:e,nquads:t,labelMapFactoryFunction:n,options:r}={}){let o,i=new Map;o=e?await m(e,{...r,canonicalIdMap:i}):await m(t.join(""),{...r,inputFormat:"application/n-quads",canonicalIdMap:i});i=function(e){let t=!1,n=!1,r=!1;const o=new Map;for(const[i,a]of e){if(!t&&(t=!0,n=i.startsWith("_:"),r=a.startsWith("_:"),!n&&!r))return e;o.set(n?i.slice(2):i,r?a.slice(2):a)}return o}(i);const a=await n({canonicalIdMap:i}),s=new Map;for(const[e,t]of a)s.set(i.get(e),t);const u=(e,t,n)=>"_:"+s.get(n);return{nquads:o.split("\n").slice(0,-1).map(e=>e.replace(/(_:([^\s]+))/g,u)+"\n").sort(),labelMap:a}}
15
+ /*!
16
+ * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
17
+ */({document:e,labelMapFactoryFunction:t,options:n});return r}async function m(e,t){if(!t||"object"!=typeof t)throw new TypeError('"options" must be an object.');if(t={algorithm:"RDFC-1.0",format:"application/n-quads",base:null,safe:!0,...t},"string"!=typeof e){const n={rdfDirection:"i18n-datatype",...t,produceGeneralizedRdf:!1};delete n.format,e=await u.toRDF(e,n)}return f.canonize(e,t)}async function b({document:e,proof:t,options:n,hasher:r}={}){r||(r=p());const o=await async function({document:e,proof:t,options:n}={}){return delete(t={"@context":e["@context"],...t}).proofValue,m(t,n)}({document:e,proof:t,options:n});return r.hash(w(o))}const v=["string","number","bigint","symbol"],E=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function M(e){if(null===e)return"null";if(void 0===e)return"undefined";if(!0===e||!1===e)return"boolean";const t=typeof e;if(v.includes(t))return t;if("function"===t)return"Function";if(Array.isArray(e))return"Array";if(function(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}(e))return"Buffer";const n=function(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(E.includes(t))return t;return}(e);return n||"Object"}class ${constructor(e,t,n){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}}$.uint=new $(0,"uint",!0),$.negint=new $(1,"negint",!0),$.bytes=new $(2,"bytes",!0),$.string=new $(3,"string",!0),$.array=new $(4,"array",!1),$.map=new $(5,"map",!1),$.tag=new $(6,"tag",!1),$.float=new $(7,"float",!0),$.false=new $(7,"false",!0),$.true=new $(7,"true",!0),$.null=new $(7,"null",!0),$.undefined=new $(7,"undefined",!0),$.break=new $(7,"break",!0);class A{constructor(e,t,n){this.type=e,this.value=t,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}}const T=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&"function"==typeof globalThis.Buffer.isBuffer,S=new TextDecoder,k=new TextEncoder;function I(e){return T&&globalThis.Buffer.isBuffer(e)}const j=T?(e,t,n)=>n-t>64?globalThis.Buffer.from(e.subarray(t,n)).toString("utf8"):N(e,t,n):(e,t,n)=>n-t>64?S.decode(e.subarray(t,n)):N(e,t,n),V=T?e=>e.length>64?globalThis.Buffer.from(e):B(e):e=>e.length>64?k.encode(e):B(e),U=T?(e,t,n)=>I(e)?new Uint8Array(e.subarray(t,n)):e.slice(t,n):(e,t,n)=>e.slice(t,n);function B(e){const t=[];let n=0;for(let r=0;r<e.length;r++){let o=e.charCodeAt(r);o<128?t[n++]=o:o<2048?(t[n++]=o>>6|192,t[n++]=63&o|128):55296==(64512&o)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++r)),t[n++]=o>>18|240,t[n++]=o>>12&63|128,t[n++]=o>>6&63|128,t[n++]=63&o|128):(t[n++]=o>>12|224,t[n++]=o>>6&63|128,t[n++]=63&o|128)}return t}function N(e,t,n){const r=[];for(;t<n;){const o=e[t];let i=null,a=o>239?4:o>223?3:o>191?2:1;if(t+a<=n){let n,r,s,u;switch(a){case 1:o<128&&(i=o);break;case 2:n=e[t+1],128==(192&n)&&(u=(31&o)<<6|63&n,u>127&&(i=u));break;case 3:n=e[t+1],r=e[t+2],128==(192&n)&&128==(192&r)&&(u=(15&o)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(i=u));break;case 4:n=e[t+1],r=e[t+2],s=e[t+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(u=(15&o)<<18|(63&n)<<12|(63&r)<<6|63&s,u>65535&&u<1114112&&(i=u))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),t+=a}return function(e){const t=e.length;if(t<=D)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=D));return n}(r)}const D=4096;const x="CBOR decode error:",P="CBOR encode error:";function K(e,t,n){if(e.length-t<n)throw new Error(`${x} not enough data for type`)}const F=[24,256,65536,4294967296,BigInt("18446744073709551616")];function C(e,t,n){K(e,t,1);const r=e[t];if(!0===n.strict&&r<F[0])throw new Error(`${x} integer encoded in more bytes than necessary (strict decode)`);return r}function z(e,t,n){K(e,t,2);const r=e[t]<<8|e[t+1];if(!0===n.strict&&r<F[1])throw new Error(`${x} integer encoded in more bytes than necessary (strict decode)`);return r}function H(e,t,n){K(e,t,4);const r=16777216*e[t]+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(!0===n.strict&&r<F[2])throw new Error(`${x} integer encoded in more bytes than necessary (strict decode)`);return r}function _(e,t,n){K(e,t,8);const r=16777216*e[t]+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],o=16777216*e[t+4]+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],i=(BigInt(r)<<BigInt(32))+BigInt(o);if(!0===n.strict&&i<F[3])throw new Error(`${x} integer encoded in more bytes than necessary (strict decode)`);if(i<=Number.MAX_SAFE_INTEGER)return Number(i);if(!0===n.allowBigInt)return i;throw new Error(`${x} integers outside of the safe integer range are not supported`)}function O(e,t){return L(e,0,t.value)}function L(e,t,n){if(n<F[0]){const r=Number(n);e.push([t|r])}else if(n<F[1]){const r=Number(n);e.push([24|t,r])}else if(n<F[2]){const r=Number(n);e.push([25|t,r>>>8,255&r])}else if(n<F[3]){const r=Number(n);e.push([26|t,r>>>24&255,r>>>16&255,r>>>8&255,255&r])}else{const r=BigInt(n);if(!(r<F[4]))throw new Error(`${x} encountered BigInt larger than allowable range`);{const n=[27|t,0,0,0,0,0,0,0];let o=Number(r&BigInt(4294967295)),i=Number(r>>BigInt(32)&BigInt(4294967295));n[8]=255&o,o>>=8,n[7]=255&o,o>>=8,n[6]=255&o,o>>=8,n[5]=255&o,n[4]=255&i,i>>=8,n[3]=255&i,i>>=8,n[2]=255&i,i>>=8,n[1]=255&i,e.push(n)}}}O.encodedSize=function(e){return L.encodedSize(e.value)},L.encodedSize=function(e){return e<F[0]?1:e<F[1]?2:e<F[2]?3:e<F[3]?5:9},O.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};const R=BigInt(-1),G=BigInt(1);function q(e,t){const n=t.value,r="bigint"==typeof n?n*R-G:-1*n-1;L(e,t.type.majorEncoded,r)}function W(e,t,n,r){K(e,t,n+r);const o=U(e,t+n,t+n+r);return new A($.bytes,o,n+r)}function J(e,t,n,r){return W(e,t,1,n)}function X(e){return void 0===e.encodedBytes&&(e.encodedBytes=e.type===$.string?V(e.value):e.value),e.encodedBytes}function Z(e,t){const n=X(t);L(e,t.type.majorEncoded,n.length),e.push(n)}function Q(e,t,n,r,o){const i=n+r;K(e,t,i);const a=new A($.string,j(e,t+n,t+i),i);return!0===o.retainStringBytes&&(a.byteValue=U(e,t+n,t+i)),a}function Y(e,t,n,r){return Q(e,t,1,n,r)}q.encodedSize=function(e){const t=e.value,n="bigint"==typeof t?t*R-G:-1*t-1;return n<F[0]?1:n<F[1]?2:n<F[2]?3:n<F[3]?5:9},q.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0},Z.encodedSize=function(e){const t=X(e);return L.encodedSize(t.length)+t.length},Z.compareTokens=function(e,t){return n=X(e),r=X(t),n.length<r.length?-1:n.length>r.length?1:function(e,t){if(I(e)&&I(t))return e.compare(t);for(let n=0;n<e.length;n++)if(e[n]!==t[n])return e[n]<t[n]?-1:1;return 0}(n,r);var n,r};const ee=Z;function te(e,t,n,r){return new A($.array,r,n)}function ne(e,t,n,r){return te(0,0,1,n)}function re(e,t){L(e,$.array.majorEncoded,t.value)}function oe(e,t,n,r){return new A($.map,r,n)}function ie(e,t,n,r){return oe(0,0,1,n)}function ae(e,t){L(e,$.map.majorEncoded,t.value)}function se(e,t,n,r){return new A($.tag,n,1)}function ue(e,t){L(e,$.tag.majorEncoded,t.value)}re.compareTokens=O.compareTokens,re.encodedSize=function(e){return L.encodedSize(e.value)},ae.compareTokens=O.compareTokens,ae.encodedSize=function(e){return L.encodedSize(e.value)},ue.compareTokens=O.compareTokens,ue.encodedSize=function(e){return L.encodedSize(e.value)};function ce(e,t,n){if(n){if(!1===n.allowNaN&&Number.isNaN(e))throw new Error(`${x} NaN values are not supported`);if(!1===n.allowInfinity&&(e===1/0||e===-1/0))throw new Error(`${x} Infinity values are not supported`)}return new A($.float,e,t)}function fe(e,t,n){const r=t.value;if(!1===r)e.push([20|$.float.majorEncoded]);else if(!0===r)e.push([21|$.float.majorEncoded]);else if(null===r)e.push([22|$.float.majorEncoded]);else if(void 0===r)e.push([23|$.float.majorEncoded]);else{let t,i=!1;n&&!0===n.float64||(pe(r),t=ye(he,1),r===t||Number.isNaN(r)?(he[0]=249,e.push(he.slice(0,3)),i=!0):(we(r),t=ge(he,1),r===t&&(he[0]=250,e.push(he.slice(0,5)),i=!0))),i||(o=r,de.setFloat64(0,o,!1),t=me(he,1),he[0]=251,e.push(he.slice(0,9)))}var o}fe.encodedSize=function(e,t){const n=e.value;if(!1===n||!0===n||null==n)return 1;if(!t||!0!==t.float64){pe(n);let e=ye(he,1);if(n===e||Number.isNaN(n))return 3;if(we(n),e=ge(he,1),n===e)return 5}return 9};const le=new ArrayBuffer(9),de=new DataView(le,1),he=new Uint8Array(le,0);function pe(e){if(e===1/0)de.setUint16(0,31744,!1);else if(e===-1/0)de.setUint16(0,64512,!1);else if(Number.isNaN(e))de.setUint16(0,32256,!1);else{de.setFloat32(0,e);const t=de.getUint32(0),n=(2139095040&t)>>23,r=8388607&t;if(255===n)de.setUint16(0,31744,!1);else if(0===n)de.setUint16(0,(2147483648&e)>>16|r>>13,!1);else{const e=n-127;e<-24?de.setUint16(0,0):e<-14?de.setUint16(0,(2147483648&t)>>16|1<<24+e,!1):de.setUint16(0,(2147483648&t)>>16|e+15<<10|r>>13,!1)}}}function ye(e,t){if(e.length-t<2)throw new Error(`${x} not enough data for float16`);const n=(e[t]<<8)+e[t+1];if(31744===n)return 1/0;if(64512===n)return-1/0;if(32256===n)return NaN;const r=n>>10&31,o=1023&n;let i;return i=0===r?o*2**-24:31!==r?(o+1024)*2**(r-25):0===o?1/0:NaN,32768&n?-i:i}function we(e){de.setFloat32(0,e,!1)}function ge(e,t){if(e.length-t<4)throw new Error(`${x} not enough data for float32`);const n=(e.byteOffset||0)+t;return new DataView(e.buffer,n,4).getFloat32(0,!1)}function me(e,t){if(e.length-t<8)throw new Error(`${x} not enough data for float64`);const n=(e.byteOffset||0)+t;return new DataView(e.buffer,n,8).getFloat64(0,!1)}function be(e,t,n){throw new Error(`${x} encountered invalid minor (${n}) for major ${e[t]>>>5}`)}function ve(e){return()=>{throw new Error(`${x} ${e}`)}}fe.compareTokens=O.compareTokens;const Ee=[];for(let e=0;e<=23;e++)Ee[e]=be;Ee[24]=function(e,t,n,r){return new A($.uint,C(e,t+1,r),2)},Ee[25]=function(e,t,n,r){return new A($.uint,z(e,t+1,r),3)},Ee[26]=function(e,t,n,r){return new A($.uint,H(e,t+1,r),5)},Ee[27]=function(e,t,n,r){return new A($.uint,_(e,t+1,r),9)},Ee[28]=be,Ee[29]=be,Ee[30]=be,Ee[31]=be;for(let e=32;e<=55;e++)Ee[e]=be;Ee[56]=function(e,t,n,r){return new A($.negint,-1-C(e,t+1,r),2)},Ee[57]=function(e,t,n,r){return new A($.negint,-1-z(e,t+1,r),3)},Ee[58]=function(e,t,n,r){return new A($.negint,-1-H(e,t+1,r),5)},Ee[59]=function(e,t,n,r){const o=_(e,t+1,r);if("bigint"!=typeof o){const e=-1-o;if(e>=Number.MIN_SAFE_INTEGER)return new A($.negint,e,9)}if(!0!==r.allowBigInt)throw new Error(`${x} integers outside of the safe integer range are not supported`);return new A($.negint,R-BigInt(o),9)},Ee[60]=be,Ee[61]=be,Ee[62]=be,Ee[63]=be;for(let e=64;e<=87;e++)Ee[e]=J;Ee[88]=function(e,t,n,r){return W(e,t,2,C(e,t+1,r))},Ee[89]=function(e,t,n,r){return W(e,t,3,z(e,t+1,r))},Ee[90]=function(e,t,n,r){return W(e,t,5,H(e,t+1,r))},Ee[91]=function(e,t,n,r){const o=_(e,t+1,r);if("bigint"==typeof o)throw new Error(`${x} 64-bit integer bytes lengths not supported`);return W(e,t,9,o)},Ee[92]=be,Ee[93]=be,Ee[94]=be,Ee[95]=ve("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)Ee[e]=Y;Ee[120]=function(e,t,n,r){return Q(e,t,2,C(e,t+1,r),r)},Ee[121]=function(e,t,n,r){return Q(e,t,3,z(e,t+1,r),r)},Ee[122]=function(e,t,n,r){return Q(e,t,5,H(e,t+1,r),r)},Ee[123]=function(e,t,n,r){const o=_(e,t+1,r);if("bigint"==typeof o)throw new Error(`${x} 64-bit integer string lengths not supported`);return Q(e,t,9,o,r)},Ee[124]=be,Ee[125]=be,Ee[126]=be,Ee[127]=ve("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)Ee[e]=ne;Ee[152]=function(e,t,n,r){return te(0,0,2,C(e,t+1,r))},Ee[153]=function(e,t,n,r){return te(0,0,3,z(e,t+1,r))},Ee[154]=function(e,t,n,r){return te(0,0,5,H(e,t+1,r))},Ee[155]=function(e,t,n,r){const o=_(e,t+1,r);if("bigint"==typeof o)throw new Error(`${x} 64-bit integer array lengths not supported`);return te(0,0,9,o)},Ee[156]=be,Ee[157]=be,Ee[158]=be,Ee[159]=function(e,t,n,r){if(!1===r.allowIndefinite)throw new Error(`${x} indefinite length items not allowed`);return te(0,0,1,1/0)};for(let e=160;e<=183;e++)Ee[e]=ie;Ee[184]=function(e,t,n,r){return oe(0,0,2,C(e,t+1,r))},Ee[185]=function(e,t,n,r){return oe(0,0,3,z(e,t+1,r))},Ee[186]=function(e,t,n,r){return oe(0,0,5,H(e,t+1,r))},Ee[187]=function(e,t,n,r){const o=_(e,t+1,r);if("bigint"==typeof o)throw new Error(`${x} 64-bit integer map lengths not supported`);return oe(0,0,9,o)},Ee[188]=be,Ee[189]=be,Ee[190]=be,Ee[191]=function(e,t,n,r){if(!1===r.allowIndefinite)throw new Error(`${x} indefinite length items not allowed`);return oe(0,0,1,1/0)};for(let e=192;e<=215;e++)Ee[e]=se;Ee[216]=function(e,t,n,r){return new A($.tag,C(e,t+1,r),2)},Ee[217]=function(e,t,n,r){return new A($.tag,z(e,t+1,r),3)},Ee[218]=function(e,t,n,r){return new A($.tag,H(e,t+1,r),5)},Ee[219]=function(e,t,n,r){return new A($.tag,_(e,t+1,r),9)},Ee[220]=be,Ee[221]=be,Ee[222]=be,Ee[223]=be;for(let e=224;e<=243;e++)Ee[e]=ve("simple values are not supported");Ee[244]=be,Ee[245]=be,Ee[246]=be,Ee[247]=function(e,t,n,r){if(!1===r.allowUndefined)throw new Error(`${x} undefined values are not supported`);return!0===r.coerceUndefinedToNull?new A($.null,null,1):new A($.undefined,void 0,1)},Ee[248]=ve("simple values are not supported"),Ee[249]=function(e,t,n,r){return ce(ye(e,t+1),3,r)},Ee[250]=function(e,t,n,r){return ce(ge(e,t+1),5,r)},Ee[251]=function(e,t,n,r){return ce(me(e,t+1),9,r)},Ee[252]=be,Ee[253]=be,Ee[254]=be,Ee[255]=function(e,t,n,r){if(!1===r.allowIndefinite)throw new Error(`${x} indefinite length items not allowed`);return new A($.break,void 0,1)};const Me=[];for(let e=0;e<24;e++)Me[e]=new A($.uint,e,1);for(let e=-1;e>=-24;e--)Me[31-e]=new A($.negint,e,1);Me[64]=new A($.bytes,new Uint8Array(0),1),Me[96]=new A($.string,"",1),Me[128]=new A($.array,0,1),Me[160]=new A($.map,0,1),Me[244]=new A($.false,!1,1),Me[245]=new A($.true,!0,1),Me[246]=new A($.null,null,1),function(){const e=[];e[$.uint.major]=O,e[$.negint.major]=q,e[$.bytes.major]=Z,e[$.string.major]=ee,e[$.array.major]=re,e[$.map.major]=ae,e[$.tag.major]=ue,e[$.float.major]=fe}();class $e{constructor(e,t){this.obj=e,this.parent=t}includes(e){let t=this;do{if(t.obj===e)return!0}while(t=t.parent);return!1}static createCheck(e,t){if(e&&e.includes(t))throw new Error(`${P} object contains circular references`);return new $e(t,e)}}const Ae={null:new A($.null,null),undefined:new A($.undefined,void 0),true:new A($.true,!0),false:new A($.false,!1),emptyArray:new A($.array,0),emptyMap:new A($.map,0)},Te={number:(e,t,n,r)=>Number.isInteger(e)&&Number.isSafeInteger(e)?new A(e>=0?$.uint:$.negint,e):new A($.float,e),bigint:(e,t,n,r)=>e>=BigInt(0)?new A($.uint,e):new A($.negint,e),Uint8Array:(e,t,n,r)=>new A($.bytes,e),string:(e,t,n,r)=>new A($.string,e),boolean:(e,t,n,r)=>e?Ae.true:Ae.false,null:(e,t,n,r)=>Ae.null,undefined:(e,t,n,r)=>Ae.undefined,ArrayBuffer:(e,t,n,r)=>new A($.bytes,new Uint8Array(e)),DataView:(e,t,n,r)=>new A($.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),Array(e,t,n,r){if(!e.length)return!0===n.addBreakTokens?[Ae.emptyArray,new A($.break)]:Ae.emptyArray;r=$e.createCheck(r,e);const o=[];let i=0;for(const t of e)o[i++]=Se(t,n,r);return n.addBreakTokens?[new A($.array,e.length),o,new A($.break)]:[new A($.array,e.length),o]},Object(e,t,n,r){const o="Object"!==t,i=o?e.keys():Object.keys(e),a=o?e.size:i.length;if(!a)return!0===n.addBreakTokens?[Ae.emptyMap,new A($.break)]:Ae.emptyMap;r=$e.createCheck(r,e);const s=[];let u=0;for(const t of i)s[u++]=[Se(t,n,r),Se(o?e.get(t):e[t],n,r)];return function(e,t){t.mapSorter&&e.sort(t.mapSorter)}(s,n),n.addBreakTokens?[new A($.map,a),s,new A($.break)]:[new A($.map,a),s]}};Te.Map=Te.Object,Te.Buffer=Te.Uint8Array;for(const e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Te[`${e}Array`]=Te.DataView;function Se(e,t={},n){const r=M(e),o=t&&t.typeEncoders&&t.typeEncoders[r]||Te[r];if("function"==typeof o){const i=o(e,r,t,n);if(null!=i)return i}const i=Te[r];if(!i)throw new Error(`${P} unsupported type: ${r}`);return i(e,r,t,n)}const ke={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0};class Ie{constructor(e,t={}){this._pos=0,this.data=e,this.options=t}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){const e=this.data[this._pos];let t=Me[e];if(void 0===t){const n=Ee[e];if(!n)throw new Error(`${x} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);const r=31&e;t=n(this.data,this._pos,r,this.options)}return this._pos+=t.encodedLength,t}}const je=Symbol.for("DONE"),Ve=Symbol.for("BREAK");function Ue(e,t){if(e.done())return je;const n=e.next();if(n.type===$.break)return Ve;if(n.type.terminal)return n.value;if(n.type===$.array)return function(e,t,n){const r=[];for(let o=0;o<e.value;o++){const i=Ue(t,n);if(i===Ve){if(e.value===1/0)break;throw new Error(`${x} got unexpected break to lengthed array`)}if(i===je)throw new Error(`${x} found array but not enough entries (got ${o}, expected ${e.value})`);r[o]=i}return r}(n,e,t);if(n.type===$.map)return function(e,t,n){const r=!0===n.useMaps,o=r?void 0:{},i=r?new Map:void 0;for(let a=0;a<e.value;a++){const s=Ue(t,n);if(s===Ve){if(e.value===1/0)break;throw new Error(`${x} got unexpected break to lengthed map`)}if(s===je)throw new Error(`${x} found map but not enough entries (got ${a} [no key], expected ${e.value})`);if(!0!==r&&"string"!=typeof s)throw new Error(`${x} non-string keys not supported (got ${typeof s})`);if(!0===n.rejectDuplicateMapKeys&&(r&&i.has(s)||!r&&s in o))throw new Error(`${x} found repeat map key "${s}"`);const u=Ue(t,n);if(u===je)throw new Error(`${x} found map but not enough entries (got ${a} [no value], expected ${e.value})`);r?i.set(s,u):o[s]=u}return r?i:o}(n,e,t);if(n.type===$.tag){if(t.tags&&"function"==typeof t.tags[n.value]){const r=Ue(e,t);return t.tags[n.value](r)}throw new Error(`${x} tag not supported (${n.value})`)}throw new Error("unsupported")}function Be(e,t){const[n,r]=function(e,t){if(!(e instanceof Uint8Array))throw new Error(`${x} data to decode must be a Uint8Array`);const n=(t=Object.assign({},ke,t)).tokenizer||new Ie(e,t),r=Ue(n,t);if(r===je)throw new Error(`${x} did not find any content to decode`);if(r===Ve)throw new Error(`${x} got unexpected break`);return[r,e.subarray(n.pos())]}(e,t);if(r.length>0)throw new Error(`${x} too many terminals, data makes no sense`);return n}
18
+ /*!
19
+ * Copyright (c) 2023-2024 Digital Bazaar, Inc. All rights reserved.
20
+ */const Ne=new Uint8Array([217,93,1]),De=[];function xe({proof:e}={}){try{if("string"!=typeof e?.proofValue)throw new TypeError('"proof.proofValue" must be a string.');if("u"!==e.proofValue[0])throw new Error("Only base64url multibase encoding is supported.");const t=r(e.proofValue.slice(1));if(!function(e,t){for(let n=0;n<t.length;++n)if(e[n]!==t[n])return!1;return!0}(t,Ne))throw new TypeError('"proof.proofValue" must be a derived proof.');const n=t.subarray(Ne.length),[o,a,s,u,c]=Be(n,{useMaps:!0,tags:De}),f=function(e){const t=new Map;for(const[n,r]of e.entries())t.set(`c14n${n}`,`u${i(r)}`);return t}(u),l={baseSignature:o,publicKey:a,signatures:s,labelMap:f,mandatoryIndexes:c};return function({baseSignature:e,publicKey:t,signatures:n,labelMap:r,mandatoryIndexes:o}){if(!(e instanceof Uint8Array&&64===e.length))throw new TypeError('"baseSignature" must be a Uint8Array of length 64.');if(!(t instanceof Uint8Array&&35===t.length))throw new TypeError('"publicKey" must be a Uint8Array of length 35.');if(!Array.isArray(n)||!n.every(e=>e instanceof Uint8Array))throw new TypeError('"signatures" must be an array of Uint8Arrays.');if(!(r instanceof Map&&[...r.entries()].every(([e,t])=>"string"==typeof e&&"string"==typeof t)))throw new TypeError('"labelMap" must be a Map of strings to strings.');if(!Array.isArray(o)||!o.every(Number.isInteger))throw new TypeError('"mandatoryIndexes" must be an array of integers.')}(l),l}catch(e){const t=new TypeError('The proof does not include a valid "proofValue" property.');throw t.cause=e,t}}function Pe({proofHash:e,publicKey:t,mandatoryHash:n}={}){!function({proofHash:e,publicKey:t,mandatoryHash:n}){if(!(e instanceof Uint8Array&&32===e.length))throw new TypeError('"proofHash" must be a Uint8Array of length 32.');if(!(t instanceof Uint8Array&&35===t.length))throw new TypeError('"publicKey" must be a Uint8Array of length 35.');if(!(n instanceof Uint8Array&&32===n.length))throw new TypeError('"mandatoryHash" must be a Uint8Array of length 32.')}({proofHash:e,publicKey:t,mandatoryHash:n});return function(e){const t=new Uint8Array(e.reduce((e,t)=>e+t.length,0));let n=0;for(const r of e)t.set(r,n),n+=r.length;return t}([e,t,n])}De[64]=function(e){return e}
21
+ /*!
22
+ * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
23
+ */;const Ke="ecdsa-sd-2023";
24
+ /*!
25
+ * Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
26
+ */
27
+ /*!
28
+ * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
29
+ */
30
+ function Fe({requiredAlgorithm:e="P-256"}={}){return{name:Ke,requiredAlgorithm:e,createVerifier:Ce,createVerifyData:ze}}async function Ce({verificationMethod:e}){const t=(await l(e)).verifier();return{algorithm:t.algorithm,id:t.id,verify:async({data:e})=>async function({verifier:e,data:t}={}){const{baseSignature:n,proofHash:r,publicKey:i,signatures:a,nonMandatory:s,mandatoryHash:u}=t,c="z"+o(i),f=await l({publicKeyMultibase:c});if(a.length!==s.length)throw new Error(`Signature count (${a.length}) does not match non-mandatory message count (${s.length}).`);const{verify:d}=f.verifier();if((await Promise.all(a.map((e,t)=>d({data:w(s[t]),signature:e})))).some(e=>!e))return!1;const h=await Pe({proofHash:r,publicKey:i,mandatoryHash:u});return e.verify({data:h,signature:n})}({verifier:t,data:e})}}async function ze({cryptosuite:e,document:t,proof:n,documentLoader:r}){if(e?.name!==Ke)throw new TypeError(`"cryptosuite.name" must be "${Ke}".`);const o={documentLoader:r},i=b({document:t,proof:n,options:o}).catch(e=>e),{baseSignature:a,publicKey:s,signatures:u,labelMap:c,mandatoryIndexes:f}=await xe({proof:n}),l=await function({labelMap:e}={}){return async({canonicalIdMap:t})=>{const n=new Map;for(const[r,o]of t)n.set(r,e.get(o));return n}}({labelMap:c}),d=await g({document:t,labelMapFactoryFunction:l,options:o}),h=[],y=[];for(const[e,t]of d.entries())f.includes(e)?h.push(t):y.push(t);const{mandatoryHash:m}=await async function({mandatory:e,hasher:t}={}){return t||(t=p()),{mandatoryHash:await t.hash(w(e.join("")))}}({mandatory:h}),v=await i;if(v instanceof Error)throw v;return{baseSignature:a,proofHash:v,publicKey:s,signatures:u,nonMandatory:y,mandatoryHash:m}}const{purposes:{AssertionProofPurpose:He,AuthenticationProofPurpose:_e}}=a;var Oe;!function(e){e.retrieveVerificationMethodPublicKey="retrieveVerificationMethodPublicKey",e.ensureVerificationMethodValidity="ensureVerificationMethodValidity",e.checkDocumentSignature="checkDocumentSignature"}(Oe||(Oe={}));class Le extends s{verificationProcess=[Oe.retrieveVerificationMethodPublicKey,Oe.ensureVerificationMethodValidity,Oe.checkDocumentSignature];documentToVerify;issuer;proof;type="EcdsaSd2023";cryptosuite="ecdsa-sd-2023";publicKey;verificationKey;verificationMethod;proofPurpose;challenge;domain;proofPurposeMap;constructor(e){super(e),e.executeStep&&(this.executeStep=e.executeStep),this.documentToVerify=e.document,this.issuer=e.issuer,this.proof=e.proof,this.proofPurpose=e.proofPurpose??"assertionMethod",this.challenge=e.proofChallenge??"",this.domain=e.proofDomain,this.proofPurposeMap={authentication:_e,assertionMethod:He},this.validateProofType()}async init(){}async verifyProof(){for(const e of this.verificationProcess){if(!this[e])return void console.error("verification logic for",e,"not implemented");await this[e]()}}async verifyIdentity(){}getProofVerificationSteps(t){return this.verificationProcess.map(n=>e.verifier.convertToVerificationSubsteps(t,n))}getIdentityVerificationSteps(){return[]}getIssuerPublicKey(){return this.publicKey}getIssuerName(){return this.issuer.name??""}getIssuerProfileDomain(){try{return new URL(this.getIssuerProfileUrl()).hostname??""}catch(e){return""}}getIssuerProfileUrl(){return this.issuer.id??""}getSigningDate(){return this.proof.created}async executeStep(e,t,n){throw new Error("doAction method needs to be overwritten by injecting from CVJS")}validateProofType(){const e=this.proof.type;if("DataIntegrityProof"===e){const e=this.proof.cryptosuite;if(!e)throw new Error(`Malformed proof passed. With DataIntegrityProof a cryptosuite must be defined. Expected: ${this.cryptosuite}`);if(e!==this.cryptosuite)throw new Error(`Incompatible proof cryptosuite passed. Expected: ${this.cryptosuite}, Got: ${e}`);return}if(e!==this.type)throw new Error(`Incompatible proof type passed. Expected: ${this.type}, Got: ${e}`)}generateDocumentLoader(e=[]){e.forEach(e=>{t[e.url]=e.value}),t[this.documentToVerify.issuer]=this.getTargetVerificationMethodContainer();return function(e){return e in t?{contextUrl:null,document:t[e],documentUrl:e}:u.documentLoader(e)}}getErrorMessage(e){return e.error.errors[0].message}getTargetVerificationMethodContainer(){if(this.issuer.didDocument){if(this.findVerificationMethod(this.issuer.didDocument.verificationMethod,this.issuer.didDocument.id))return this.issuer.didDocument}const e={...this.issuer};return delete e.didDocument,e}findVerificationMethod(e,t){return e.find(e=>e.id===this.proof.verificationMethod||t+e.id===this.proof.verificationMethod)??null}async retrieveVerificationMethodPublicKey(){this.verificationKey=await this.executeStep(Oe.retrieveVerificationMethodPublicKey,async()=>{if(this.verificationMethod=d(this.getTargetVerificationMethodContainer(),this.proof.verificationMethod),!this.verificationMethod)throw new n(Oe.retrieveVerificationMethodPublicKey,"Could not derive the verification key");if(this.verificationMethod.revoked)throw new n(Oe.retrieveVerificationMethodPublicKey,"The verification key has been revoked");return this.verificationMethod},this.type)}async ensureVerificationMethodValidity(){await this.executeStep(Oe.ensureVerificationMethodValidity,async()=>{if(this.verificationMethod.expires){if(new Date(this.verificationMethod.expires).getTime()<Date.now())throw new n(Oe.ensureVerificationMethodValidity,"The verification key has expired")}if(this.verificationMethod.revoked)throw new n(Oe.ensureVerificationMethodValidity,"The verification key has been revoked")},this.type)}async checkDocumentSignature(){await this.executeStep(Oe.checkDocumentSignature,async()=>{const e=new c({cryptosuite:Fe({requiredAlgorithm:"K-256"})}),t=this.documentToVerify.proof.verificationMethod;"authentication"!==this.proofPurpose||this.proof.challenge||(this.proof.challenge="");const r=await a.verify(this.documentToVerify,{suite:e,purpose:new this.proofPurposeMap[this.proofPurpose]({controller:this.getTargetVerificationMethodContainer(),challenge:this.challenge,domain:this.domain}),documentLoader:this.generateDocumentLoader([{url:t,value:this.verificationKey}])});if(!r.verified)throw console.error(JSON.stringify(r,null,2)),new n(Oe.checkDocumentSignature,`The document's ${this.type} signature could not be confirmed: ${this.getErrorMessage(r)}`);console.log(`Credential ${this.type} signature successfully verified`)},this.type)}}export{Le as default};