{"_id":"@sphereon/pe-js","_rev":"34-0d555582e220a7586ee99c75bfa39e0f","name":"@sphereon/pe-js","dist-tags":{"latest":"0.5.1","unstable":"0.5.0-unstable.2"},"versions":{"0.0.1":{"name":"@sphereon/pe-js","version":"0.0.1","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"build/main/index.js","typings":"build/main/index.d.ts","module":"build/module/index.js","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":[],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.json","build:module":"tsc -p tsconfig.module.json","fix":"run-s fix:*","fix:prettier":"prettier \"{lib, test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib, test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --coverage"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.4","ajv":"^8.1.0","ajv-formats":"^2.1.0","jsonpath":"^1.1.1","nanoid":"^3.1.23"},"devDependencies":{"@types/jest":"^26.0.22","@typescript-eslint/eslint-plugin":"^4.0.1","@typescript-eslint/parser":"^4.0.1","codecov":"^3.5.0","cspell":"^4.1.0","eslint":"^7.8.0","eslint-config-prettier":"^6.11.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.22.0","jest":"^26.6.3","npm-run-all":"^4.1.5","open-cli":"^6.0.1","prettier":"^2.1.1","ts-jest":"^26.5.5","ts-node":"^9.1.1","typescript":"^4.2.4"},"prettier":{"singleQuote":true,"printWidth":120},"licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.0.1","dist":{"shasum":"f56ca97398b5742ef756cdf79591337d53451bb4","integrity":"sha512-m7W77VMkQRpL2fiQ/Q+iizfBaxltVb2faYC5TLjbWpjH4FUTeawaabgQfEfufD9i2bg+9bN55crmP+pqP5FHJg==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.0.1.tgz","fileCount":550,"unpackedSize":2965726,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhHCcECRA9TVsSAnZWagAA1CMP/RfM1vUCEMaPePesvN7i\nS84Ho8Bng+/4tNzhXiKP0qqLvf1F/3vdkFlA6usgc3H685rRzBnVt0zChplQ\nmMlUO9cXwXV3lNU1XNBeEo2Elfv4qGGpodS4tzWzIoP08dlGZZsfiDUZ/wzs\n9fQNx/HF0XK28GGQqTGtFypMJKTVZDZQIzTELzpahkwpSgNdOUJVH2H+Xk64\nOzu9C1+KvccEc3rkHMBKPMlV02xADoxUEufZc6PIJ9suQGrrAyeT9pT2DkoH\n/6nQbRAoRLsJwdKrjCoh4IoaxYs/pJYGXVYMIKl7qjtOsOJC+Dtz8V2R9QtV\nSfPzOLidiia1WWgS0mPqbdhBo56v5Qs2oM4uQGFfo8nSvJr3RjRcRe9+bI41\nfLSybQ6Lrm3mGbX2t9X0LCQ6ybbACxyVEQyAWP7AnnW4kcabGrtuy0t/aOV+\njnicMuRxzBQo0zv/yoqJlETBJZnDSdhcwGO9fEFagAyjcz53gc6ewM283bp6\nIEbfQyOXsGb2LOZuwmBZZwxcQXWJqnSyTW3F2+JaxvXTZngE8cGBAedHQ7RG\nh/LVTwoOKe8P7ZubYjIZ8ZFRupT/EmWGjy/3ndmBe1bCHAY1EfwrZRejUYY4\nc8Q0KfN3tmUgXa/94o29bi7WCjrUklSwCavPdXjb8rdKzq/8cka2jLoFdUul\nHank\r\n=ePW0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCr+g8GKnruJkr6/YkVo5WLrqSRWsOCnN0MZ0G2rHDcCwIhAKD309fz+Z1nlesqYd4A1Q2quS+3qesBZbmxY9tmDCX5"}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.0.1_1629234948181_0.27642636617855376"},"_hasShrinkwrap":false,"deprecated":"WARNING: Project was renamed to @sphereon/pex. Please use the new package name"},"0.1.0":{"name":"@sphereon/pe-js","version":"0.1.0","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"build/main/index.js","typings":"build/main/index.d.ts","module":"build/module/index.js","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":[],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.json","build:module":"tsc -p tsconfig.module.json","fix":"run-s fix:*","fix:prettier":"prettier \"{lib, test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib, test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.1.0","ajv-formats":"^2.1.0","jsonpath":"^1.1.1","nanoid":"^3.1.23"},"devDependencies":{"@types/jest":"^26.0.22","@typescript-eslint/eslint-plugin":"^4.0.1","@typescript-eslint/parser":"^4.0.1","codecov":"^3.5.0","cspell":"^4.1.0","eslint":"^7.8.0","eslint-config-prettier":"^6.11.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.22.0","jest":"^26.6.3","npm-run-all":"^4.1.5","open-cli":"^6.0.1","prettier":"^2.1.1","ts-jest":"^26.5.5","ts-node":"^9.1.1","typescript":"^4.2.4"},"prettier":{"singleQuote":true,"printWidth":120},"licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.1.0","dist":{"shasum":"e330f6ccf80e42423151e4c6edc342b3f58bcc87","integrity":"sha512-uSt8v/Fb3mG0M5dpE0dqedhWfqf98O1+ivatLEDC3Fx5YM0sTS88dRw5ajSsVgbqrVm/daFOkeI4F+eS5d6XHg==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.1.0.tgz","fileCount":578,"unpackedSize":4748339,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhMmh+CRA9TVsSAnZWagAAcVgP/jmxX0VBQPj50kVxJ/hy\nE5itjhCxcTBYHG5FVFl8KmQmKrpRIy6VdZxSsf1Oj6dwKEQurp+1PyCGtFCy\n77m7+Cbt686DsLwzTOP3mYyCqbndOG6jLn+abam2JSA4KOW94fNxVBm4jdVj\nFKC7YUIZ2XguOcUy3O+v2QtmPk9NOoWPCP35L1nr4zKefkInd0S2TkU51cV3\nBVWOtVhWkCmnepOh2xpxIbbAa1ZPKL8CncaPUBnIgLmux8BMRaYiWR7CJ7Tg\nNBxCX3k+j49A7lrcAdQS2O4ibtCpH+ItAIBWZVzxRm7Ax9i7YGv64lTjBWb2\nKwAziPDwRCnizR96R/axs3BMRBnWyUmJ8K9cS+fP722WgXj1Yy2fj7u+UNVk\niZpNguzM1V2FyF1OFUNKLacUxYqoqTx04X88Ygzw8f2oOOkY7tbW+6ZtlI3U\ntviUmlv3MrV5lu5qOADJtCgWOd1uyN+9Jgo6bigzDozFHu/AfffwmzZ6uGHw\nnGmv7PFTxck40G1aFPrCVXOHV8sUIev5rTOTsrciD/6RetlaXpuyrp8JYS7f\nbFfITFUvffzO4VIWq7LYAGUYXvo5c+2ts76HUpKHMmdO6x2Sp9Bdi4nQMAsr\nIjozyfusDdBKZ/VPesQGldoLEyc3CC5FLJnUtffmAfUnUxH6AwrHAqUmXvW2\n4vrQ\r\n=o57B\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBltwdxTB5ekVksMN1ahAzpfw/eQUfZ7hD+9mVUg1DNlAiEAsvFcfQ892axgUJgw9dO59+95NkPb8YkfSk4gBSw3wt4="}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.1.0_1630693502632_0.8045410618835771"},"_hasShrinkwrap":false,"deprecated":"WARNING: Project was renamed to @sphereon/pex. Please use the new package name"},"0.1.1":{"name":"@sphereon/pe-js","version":"0.1.1","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"build/main/index.js","typings":"build/main/index.d.ts","module":"build/module/index.js","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":[],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.json","build:module":"tsc -p tsconfig.module.json","fix":"run-s fix:*","fix:prettier":"prettier \"{lib, test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib, test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.1.0","ajv-formats":"^2.1.0","jsonpath":"^1.1.1","nanoid":"^3.1.23"},"devDependencies":{"@types/jest":"^26.0.22","@typescript-eslint/eslint-plugin":"^4.0.1","@typescript-eslint/parser":"^4.0.1","codecov":"^3.5.0","cspell":"^4.1.0","eslint":"^7.8.0","eslint-config-prettier":"^6.11.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.22.0","jest":"^26.6.3","npm-run-all":"^4.1.5","open-cli":"^6.0.1","prettier":"^2.1.1","ts-jest":"^26.5.5","ts-node":"^9.1.1","typescript":"^4.2.4"},"prettier":{"singleQuote":true,"printWidth":120},"licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.1.1","dist":{"shasum":"e0ba4089917e47086315da06f2431c9ed59bec8d","integrity":"sha512-xFc31kZuwlwx775TodiBZiJsscVIti81VZO8Q2VP4m2OXVXpSEUxDycjjRxtBrdHxHRRFrmrbxmd0VwugHFSJQ==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.1.1.tgz","fileCount":579,"unpackedSize":6611204,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhOkhnCRA9TVsSAnZWagAALksP/0+H6sw+pabBpS0S42y9\nHdx59FREXDgY0ouo8O0qxLeBsVyGSy1BGLwW8P2bW90KgLti4lN64fkQ9Crj\nkcVkl2kovYzAdX/8YqnitoLuFwaKproKqY18LRQb7paKEyrC+rcsGO23LesI\ngMEpm9ZZRA76WTaOgo2bb215hTRD1mL2D4dAhaz86U/dhPLP36+JIBjSL04N\naUo0PqMMR9xju3Ad1hnXhJTBcyMAOaLENWU++3EpYJXvnjBCUWZQbWeg7frr\n/HgxRQggbREKceKNYnd/CJ/HFWAgX3MB+BWKBevsRcyWQgvu9vs6ZR4t0foW\n8ENqQ6VXMPT6Vupgy3JDK8tyle384dkM1WBu5OqB1Jrqjfc2uY20+9naJNmC\nk657Rxl0aSaW9NUKU17EI1XZ5zokIZBch+kJPaLPl9JIeAdw1Qc71dvY1c/Z\nSvj+HkcSKQho7x+x0HomZVSvYxBJ05Cy9RaLpBl4Ce9OQ2CzREoYmA17NRKU\nvyW2rjYHrrBZmQ3xwruAL+SPjK8ZMKbvWxMrBGnriKp+UIRrBiMiaQKV8/K1\nuKP+h4nxZHa4uxDYaSiXxWHlHzD3W+8QCPGajETTH+g1xcy2FEtSgrc0jFEN\nPYGiD2d1RUUogogrAZJIASUqIXZ31x00II3zSiwRESTaoTZX0JhSpaCQeFPb\nvMbJ\r\n=GAP7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBu0kud/3ii203otmLSvsbcFgeftGZ0Yd006uyKbEaOWAiEA4K1jRTwZHoR3xvb0Pr3cog5AUnzCNIFGSQHqzHHLrxw="}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.1.1_1631209575567_0.34215903841829176"},"_hasShrinkwrap":false,"deprecated":"WARNING: Project was renamed to @sphereon/pex. Please use the new package name"},"0.2.0":{"name":"@sphereon/pe-js","version":"0.2.0","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"build/main/index.js","typings":"build/main/index.d.ts","module":"build/module/index.js","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":[],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.json","build:module":"tsc -p tsconfig.module.json","fix":"run-s fix:*","fix:prettier":"prettier \"{lib, test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib, test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.1.0","ajv-formats":"^2.1.0","jsonpath":"^1.1.1","nanoid":"^3.1.23"},"devDependencies":{"@types/jest":"^26.0.22","@typescript-eslint/eslint-plugin":"^4.0.1","@typescript-eslint/parser":"^4.0.1","codecov":"^3.5.0","cspell":"^4.1.0","eslint":"^7.8.0","eslint-config-prettier":"^6.11.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.22.0","jest":"^26.6.3","npm-run-all":"^4.1.5","open-cli":"^6.0.1","prettier":"^2.1.1","ts-jest":"^26.5.5","ts-node":"^9.1.1","typescript":"^4.2.4"},"prettier":{"singleQuote":true,"printWidth":120},"licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.2.0","dist":{"shasum":"38b2bc622e01714d0e3beb2d461123b2ed9088cc","integrity":"sha512-vwN4snc8HJ90lfCMR0n5F0CM2yT6aNJTfpkH/3TTivCks9n7QDWP3McHmtnvS6XKaQnHQGaPy8u++fyJo0BOvg==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.2.0.tgz","fileCount":620,"unpackedSize":10574453,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhQdZ9CRA9TVsSAnZWagAAlAcP/1VYXPtlEzQX5Yy6vUNI\nOnWQfceyrdpk2wK6zjeqNYj99Ojs0NlY7zgFGBCoqujsti0gDCDQ5rQaVJ3a\nuYumYniRcbWVtiMigNm+hd2nJqqx6nlN0CaTdrxk8FF15ZAg7h7fljOT1ICJ\nrb8fQHwoNSJMGkR96AxaJLGx8U7STOK60p0b0PnMViP5e1VSAMyxafxJ1MYD\ne0thW1zxzzI/sJvO7GiWPnL6IxDHdTGDGp6sbeYyYoamjObrkvf4WdbDLW/l\nprGlkdPOdlGAK/l7Gd+1D9jOCXJbpEFiZA9cBi65haFsgvnvd58vaco4Uau/\nOYHKYezN1gzRAm2KMF8/xlF2N7l9Qc9KGH9JxUYDERuipmdXfdC0f3AXhDA3\n5CfHS0YWE8tUGYiOXraiOwaJqHKvUv51n5Aq4X7VrUeTSEOk0VSuNUgvFfip\n8lcgCiSNg9vk5wlEDqZeS7DsITIq/DFHlnDxRcUAf+ZuRgm26VC9mFt9unPM\nTQPB3JH3REplrocWiaHSBOjwD7xgRVEa3az6N3G8O8zzF78hXz9IURl+lnU9\nNFGOTAW/1ZWNz6UpWWIRpa3a3UbHwN8dO3kj8zAT30Rfb7w78X7qw3QIxgTc\nCTsGMzwomcN9n9Coi5FPvqqQ2s9DGPkEv2t68jj9RPHxEnOpyNV/mQGqe51X\nfrVc\r\n=q7cX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGp8COvMSwzTP1P0XEROxY8k6n2+OKidaiDkPrLaaCN9AiBUq1t6DjbYRSP6Svv28DDIaeorerPAzgvPz+qgckIX2A=="}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.2.0_1631704701009_0.2279173688321836"},"_hasShrinkwrap":false,"deprecated":"WARNING: Project was renamed to @sphereon/pex. Please use the new package name"},"0.2.1":{"name":"@sphereon/pe-js","version":"0.2.1","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"build/main/index.js","typings":"build/main/index.d.ts","module":"build/module/index.js","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":[],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.json","build:module":"tsc -p tsconfig.module.json","fix":"run-s fix:*","fix:prettier":"prettier \"{lib, test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib, test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":120},"licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.2.1","dist":{"shasum":"822ea532cb43f388c4a65ff530c7896e98f3c7db","integrity":"sha512-v2sXCVMV5gAQPoBiknn2/8ixemaPaSvK2agcnXVxzYUw0noXK75qkUtOgPrh4h+4JkOjRhzIShx7H13iE2MmjA==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.2.1.tgz","fileCount":616,"unpackedSize":3346964,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhQfNvCRA9TVsSAnZWagAA+EMP+QEZgJcc9wsYEzgjr9iI\nqrvXnjWlwg4pbsLF0xcs75YA22MV40uTlEwKHq2bCaPjfpMMdjaoW3Ay9XPu\n/WGXryTx/x1KAMxGCL4Vl4qKLPoe9UzbdK2vutatRBuXJTtNfv4jU46IqKpO\n3pui+ssLcS+uJxhaUXgqAc4iovqGaA9gPal3277IyMG0vEYsreMVaissy8Cj\ngpFBAQW1YSvD6iMgA1ckp+GN8SlYCs6lr+Yjbloj9f5Mt9zNOwQxCegY3uo6\n5rRLUlP0ji65IPF6UPBphqhP7apSCbUPmQTiAUX7PJX9lJ8dHBIqD4eU6h77\nQ8bdvXPfKXXgmDoHCZEn6NWY8qwR2F5I+3qeoRPEowN0Gu2o9o2UL9q1w8su\nkBBl/DcqSM9CsdVgSt4ouGOQRQMOI9BLRIopTISYDyw0Q5yCf41mDKgRl+Lo\nsITAxZKswc0ZE0Izygc6NjousqU9Z1hTdw4oSb0u/QesOdq4dd6RS3A+1GP8\nSGjwwTYRg197g6JgUn/J8hL7plwudAUf42sPWvBAVErA0WIGKCnUttW48RhK\nmUfnbXel4wSeH6WeeptbYI0B1LX5HyjojAhfowPF61SW7Vi9HIfGRpyVH88U\ngfik9k3wQ6vPUZ2NcnylR3pZkedfi3PgzfHgdii4fCPNPvo8LBr8r1PhlRQf\nDMqA\r\n=3JQv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDSlgoXoRSLibtbToWDMgmmBNCqdlKzjoB9TSEpiJttLAiAirWyJ0l5YXvCnd4BjsPZUiSqyE5z18IDQdaUfu2gGaQ=="}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.2.1_1631712111760_0.7284684329692424"},"_hasShrinkwrap":false,"deprecated":"WARNING: Project was renamed to @sphereon/pex. Please use the new package name"},"0.2.2":{"name":"@sphereon/pe-js","version":"0.2.2","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","typings":"dist/main/index.d.ts","browser":"dist/browser/index.js","module":"dist/module/index.js","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.json","build:browser":"tsc -p tsconfig.browser.json","build:module":"tsc -p tsconfig.module.json","fix":"run-s fix:*","fix:prettier":"prettier \"{lib, test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib, test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":120},"licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.2.2","dist":{"shasum":"df223746b5622440ea50a7018370da235fe06498","integrity":"sha512-dH5num2uk7zAbNKxz+f3wfn9scP580n++uo9Y8gWTYkzS4tu2H/Uyp3odCRt6yf6Bu/Ic3FZpiUw1lnTG/Oa5g==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.2.2.tgz","fileCount":779,"unpackedSize":4023457,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhQhCzCRA9TVsSAnZWagAA7nUP/AtvJrAPApcry37c8NWB\n5xT7sbP9gWya4DfIPWw7kIDvXNZi4LV7RagDiczipdkDhWaWcCR11hbZXlfe\nXZLsAv8J/OpxzRbYl4yWj3Iy0pXobwhQRhBc4aQ8T+wwKLzy8Fk2HW8cBvnx\nKvhZcUGfloHenT1vLqRWPJuLdBtUQBatRQU5giPc+roGYagDTxTE9vBqoHa5\nqTKb/0ELuknZyI0ndVopQNvlQ7A6Ayjhk4gbhMxG2rML/h6PNwwP/iHUenEN\nOWNX/0rTnzv02DM7f0Ji6bjRlXOAvcj5rpdh1I8cZ+0Kps3480rJbO2b0P6T\nxzktbqJIbxJZYxNXCRXmxHmtpaX+sf3fKOgzPc4fAIUisVqA52FvOI9xxh9X\nkl1nlJQhN3t9/Dt6qQqAJ0UGvwQY/T00JxNryD8XC1e0YehZusxujMu4M5NZ\ns7Vd7ntPZe+3/fdws+W+oEyQCsM3gbHxZH2lzuOnuL69DNr4XPmwPnUHTuVr\nsr5wNLHkV7D5CfpO0Z4g+xG0b1WqWF3MVwJ7MU68/MRIPY/vKBHGVwNckEHr\nq4MPNMSNaepAgp1gJ2nmxbC56hmadVk7QL4IBS1CdpdZEZxICS3NUMYxa0MQ\nemjT2Rtl2Es7uRHoxmZ26JM3vIOlgXOmVhyOWt5AzuOV/K0eROTtMT32u8lK\nQK+H\r\n=bl0p\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDoZBj9pAw/HqOErPxQZGND6mHbBMjZeOhSK7cK5jPbfwIhAKO+nCJ0kYVJieJuYHOQBIcIZv3GaoN9xvm70Ia5qfuM"}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.2.2_1631719603370_0.4096863048405184"},"_hasShrinkwrap":false,"deprecated":"WARNING: Project was renamed to @sphereon/pex. Please use the new package name"},"0.2.3":{"name":"@sphereon/pe-js","version":"0.2.3","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","typings":"dist/main/index.d.ts","browser":"dist/browser/index.js","module":"dist/module/index.js","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.json","build:browser":"tsc -p tsconfig.browser.json","build:module":"tsc -p tsconfig.module.json","fix":"run-s fix:*","fix:prettier":"prettier \"{lib, test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib, test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":120},"licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.2.3","dist":{"shasum":"8c87c955f8d45b3ec51f89c60f2465607a186a29","integrity":"sha512-4qetvB8/7bhQej2tPXfLDTbXxdoyTN/lTnnXepnUe+CD/Jpvi6i+JRAv3WZ2WU9tJc/Ev1x4+bJ4/iscDTxpsw==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.2.3.tgz","fileCount":783,"unpackedSize":5892706,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEmAMIOzpO1DTWIAXmZeE809pCCxpsSuSlx0yIJfL+lnAiBo0EHJHz0LALL/ItbSy2BZHnqJk7PaYlgCrYz+spujyA=="}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.2.3_1632412688016_0.18435848989528036"},"_hasShrinkwrap":false,"deprecated":"WARNING: Project was renamed to @sphereon/pex. Please use the new package name"},"0.2.4":{"name":"@sphereon/pe-js","version":"0.2.4","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","typings":"dist/main/index.d.ts","browser":"dist/browser/index.js","module":"dist/module/index.js","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build:browser":"tsc -p tsconfig.browser.json","build:module":"tsc -p tsconfig.module.json","fix":"run-s fix:*","fix:prettier":"prettier \"{lib, test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib, test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":120},"licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.2.4","dist":{"shasum":"1b496326cdbbea10d811ac9ddd60cdb61d431476","integrity":"sha512-dvh+Gla0UtcpdhHEd6N3XlNTtpYXdOVQlpLSOm//UeCsmHunuBS9DHXxJ+sg75Peo/x+qtnUUr85gsKZl7bg3w==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.2.4.tgz","fileCount":674,"unpackedSize":3293432,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCHhwmIkjaw5jouSgLfXC63D30HwJQhgkk/5Gl0SO1y8QIgEeFlbPL9UBAeYVAl81cB0/Fm3NUG8LtZOaT1bZUesdY="}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.2.4_1633543116351_0.358816093391769"},"_hasShrinkwrap":false,"deprecated":"WARNING: Project was renamed to @sphereon/pex. Please use the new package name"},"0.3.0":{"name":"@sphereon/pe-js","version":"0.3.0","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","typings":"dist/main/index.d.ts","browser":"dist/browser/index.js","module":"dist/module/index.js","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosyre","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build:browser":"tsc -p tsconfig.browser.json","build:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3","rimraf":"^2.6.2"},"prettier":{"singleQuote":true,"printWidth":120},"licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.3.0","dist":{"shasum":"96c2efceb660ec3f391386addf6cd67d84e3de76","integrity":"sha512-LswhXZL+jtbMgvG+wpiOlhof4hbbQxPUm1HK5JdB0e8zD4x83eVlFxRvIjCgaoOcOY3pF7xqD3LNeb2H+aHFlA==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.3.0.tgz","fileCount":855,"unpackedSize":4365070,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEIEgzP2BONbgXdIJ3nMlcP57xSCySE3N3wa38TU4VVuAiBQnwbRax4V2HniYIX8OiCeamHrJyJbCQM5cYVsxljgUw=="}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.3.0_1636504538386_0.2281416063043502"},"_hasShrinkwrap":false,"deprecated":"WARNING: Project was renamed to @sphereon/pex. Please use the new package name"},"0.4.0":{"name":"@sphereon/pe-js","version":"0.4.0","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","typings":"dist/main/index.d.ts","browser":"dist/browser/index.js","module":"dist/module/index.js","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosyre","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build:browser":"tsc -p tsconfig.browser.json","build:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3","rimraf":"^2.6.2"},"prettier":{"singleQuote":true,"printWidth":120},"licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.4.0","dist":{"shasum":"b76e9beed006a7800e9f26ae41ba4b70dae2ce39","integrity":"sha512-6j0iOz+slVDbaZQ2I420FpD4B6/wRSrVJVhmBdZ1KhSkGHVhzE8FvIkkTArsOmM1sqQjBG6TiM4jPQcqsB3l3w==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.4.0.tgz","fileCount":641,"unpackedSize":3472164,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhoPJ6CRA9TVsSAnZWagAAhggP/RyiJSSDn2B4RnaX5Cav\neg/MLvaDWbN4igPB/Ve+/KoIxffdgYyY1JH2jtJmnHoEFtkyHuW4EbzqTz1L\nR8H5Sg2f9SYvT4y+cmgzZklbNdEU3pLqmB2nyoAIw77tw2YdpSBOlT795/a0\nWmoyVvJ4bQ+AX/FHLBlNgBV9GGi/CQA9/pHSx6cldkhDNoPlLLYRyMEamVYc\n+hVNh/3v4vCsSgSIbFJMSEESmodBXB2QgXJGur7Olb5mMvjzTlCQrrgcZO1P\n+MkP1ZTRravqpabpMtP8o5wm1Be10O+d7UEUby8x0sCuGLfgkjrOXrJXvfz/\nQqqEJVyxxDrqlTbJMQhUlzTsAulHqJ4iseHQOCxDO9puEaEpXpR+d7TK/Y1B\nKMkAHlQH3MPGs6huzuN30O596B5650qrC2eRbjeRo7u3fOF2Iv/6fc69XVbw\nVVla1txb6WTdkD9ozgyxLRL+CgeyOCyrrJ5EggGzKdKwYkfNOZZDrKMAnib6\nkMaUmQWmOWmr1A3XJoUH10taI3Rvr0OorDYwa5c0nanQyxfNRumCwTU5SLBl\n10VZTyyxCH2iFYjSPuYVbnLKpFsrbYzDLPJJAt4lMbeuc3uLu2vNSGnoGAyu\nr+X1zk3r3zCWYcvyaVfDzBlvYudMM+I9GRT9gsy0T6Gq5gORPNUAvGMMo5Sn\nzC3n\r\n=c8cu\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGF8Xv2KthnXjgq9N0SLtPUbVhV7RyJibt2hbkq/y23vAiAWTA54BqrjWbiCsQt1P8BL3GJdg5k7apMBFT7Ur80t3A=="}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.4.0_1637937786503_0.37191617109239616"},"_hasShrinkwrap":false,"deprecated":"WARNING: Project was renamed to @sphereon/pex. Please use the new package name"},"0.4.1":{"name":"@sphereon/pe-js","version":"0.4.1","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","typings":"dist/main/index.d.ts","browser":"dist/browser/index.js","module":"dist/module/index.js","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosure","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build:browser":"tsc -p tsconfig.browser.json","build:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","rimraf":"^2.6.2","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":120},"licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.4.1","dist":{"shasum":"5879279cdcacf56482d7e5be606b2479700bd3b5","integrity":"sha512-YYSYMDO1gUJARMp4A+6GkMif+c8CELF//ITiDc4dFvcsjVJNIIaFwi77b3iZxDsFtgTjk+k287ld3yGHZ9vgUA==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.4.1.tgz","fileCount":510,"unpackedSize":1896863,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhoQhkCRA9TVsSAnZWagAAwakP/1LPSUUNndzB2lWQ0cUR\nb1U3TuVr2aWpB/oTj6/fRUOz3+wTB9qaRTMIRml6uyoV+W/xRWD/UOeOzXe0\nwN6+J51YO41IFwoImLxKxcf7MuxbyQGMobhiyqQDXo5ljkD3n1WpzBLWtUZQ\nNWe3hnZfc0hYjuVENUWRC2vnx72XJbd5SiKcdse7n3bwCnhqOAxIjmr0aDcj\nD5tk6oH5RVeMK9wEhdWhvRoVAzJrStBmse59gVzNmRCXnXldNgJi/jyhE9Uv\nCAjpW72/la21hdd9tUhacQFMwmNSsvvSXMGzNGcc3UmsuYusO0bftnIwETP3\nXq9mEvCPzTdf1mbXluiU+i5o2TN/KJS3GeOASzXd0mtkncS3DnMUR0OzK2PP\n3qA/HiS5Izi1zSwyq+E8AKxHxuJWG39ZTgBxB2QJjxh2c5heZemdh7Ayowgf\nVFNRLbYEVvTSrLZNcdRY/vMCgImgKGxcIxBzvzgxB13dge3K853wDZsm2vmg\nXv498C+U4KWWHUXdJeKcHYQeu/xTak8IUg5ZVlhb9KUYvUuAgh1ObakLb/Wz\nTZMD5dbnM0fmuBHsGXogQcS7yZaQE73obLLcXCKdReOKu4nBq9HZhSFE2afi\nWRrbQejrffu9EsR+RP0v6vozAFpXm+jo9oSB06Oi022GDanaufb1Tbf2kDMi\nL+sh\r\n=Bdq4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCbMNKsI2ayiQkQKyLO/NVcLsD1MXx55B/oUpM/coGS0AIhAKNx3jSKiRABsfP8BnE2wDbtwjxPxPOnpKyBcb6OiG+c"}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.4.1_1637943396077_0.6128177106442443"},"_hasShrinkwrap":false,"deprecated":"WARNING: Project was renamed to @sphereon/pex. Please use the new package name"},"0.4.2-unstable.1":{"name":"@sphereon/pe-js","version":"0.4.2-unstable.1","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","typings":"dist/main/index.d.ts","browser":"dist/browser/index.js","module":"dist/module/index.js","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosure","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build:browser":"tsc -p tsconfig.browser.json","build:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","rimraf":"^2.6.2","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":120},"readmeFilename":"README.md","readme":"<h1 align=\"center\">\n  <br>\n  <a href=\"https://www.sphereon.com\"><img src=\"https://sphereon.com/content/themes/sphereon/assets/img/logo.svg\" alt=\"Sphereon\" width=\"400\"></a>\n  <br>PE-JS   DIF Presentation Exchange JavaScript Library \n  <br>\n</h1>\n\n[![CI](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml/badge.svg)](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/Sphereon-Opensource/pe-js/branch/develop/graph/badge.svg?token=9P1JGUYA35)](https://codecov.io/gh/Sphereon-Opensource/pe-js) [![NPM Version](https://img.shields.io/npm/v/@sphereon/pe-js.svg)](https://npm.im/@sphereon/pe-js)\n\n## Active Development\n_IMPORTANT: This software still is in early development stage. As such you should expect breaking changes in APIs, we expect to keep that to a minimum though._\n\n## Background\n\nThe PE-JS Library is a general use presentation exchange library that implements the functionality described in the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/). It is written in Typescript and can be compiled to any target JavaScript version.\n\nSphereon's PE Library is useful for both verifier systems and holders (e.g. wallets) and can be used in client side browsers and mobile applications as well as on server side technology such as REST APIs (e.g. built with NodeJS). It allows anyone to add DIF Presentation Exchange logic to their existing wallets, or verifiers, without making any further assumptions about the technologies used in their products.\n\nThe presentation exchange operates generally as follows; The verifier creates a Presentation Definition asking for credentials from the holder. The definition for the credentials is sent to the holder, who returns a presentation as a response. Now the verifier will verify the presentation by checking the signature and other accompanying proofs. \n\nThe presentation exchange will ensure that the model used by the verifier, can be interpreted by the holder. It then ensures that the correct parts from the holders credentials are used to create the presentation. The PE contains all the logic to interpret the models, therefore removing the need for the verifier and holder to align their specific models.\n\nThe data objects (models) used in PE-JS are generated from Sphereon's DIF PE OpenAPI Spec component. The code for the component can be seen at [PE-OpenAPI github repository](https://github.com/Sphereon-Opensource/pe-openapi). This allows the generation of the objects in many languages and frameworks consistently by configuring the maven plugin.\n\n\n### The PE Library supports the following actions:\n\n * Creating a presentation definition / request\n * Validating a presentation definition / request to be as per specification\n * Creating a presentation submission\n * Validating a presentation submission when received\n * Input evaluations: Verification of presentation submissions to be as per presentation definition\n * Utilities: to build and use different models compliant with the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/).\n\nStateful storage or credential management should be implemented in separate libraries/ modules that make use of the underlying DIF Presentation Exchange implementation. By keeping these separate, the library will stay platform agnostic. \n\n## For PE-JS developers\n\nThis project has been created using:\n* `yarn` version 1.22.5\n* `node` version 12.22.1\n\n### Install\n```shell\nyarn install\n```\n### Build\n```shell\nyarn build\n```\n### Test\nThe test command runs:\n* `eslint`\n* `prettier`\n* `unit`\n\nYou can also run only a single section of these tests, using for example `yarn test:unit`.\n```shell\nyarn test\n```\n\n### Utility scripts\nThere are several other utility scripts that help with development.\n\n* `yarn fix` - runs `eslint --fix` as well as `prettier` to fix code style\n* `yarn cov` - generates code coverage report\n\n\n## For PE-JS Users\n\nThe library can be installed direction from npmjs via:\n\n```shell\n# install via yarn\nyarn add @sphereon/pe-js\n\n# install via npm\nnpm install @sphereon/pe-js\n```\n\nThe core functionality of the DIF Presentation Exchange can be outlined as follows:\n\n* Input Evaluation\n* Credential Query\n* Utilities\n\n#### Input Evaluation\nInput evaluation is the primary mechanism by which a verifier determines whether a presentation submission from a holder matches the requested presentation definition from the request.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  \"id\": \"32f54163-7166-48f1-93d8-ff217bdb0653\",\n  \"input_descriptors\": [\n    {\n      \"id\": \"wa_driver_license\",\n      \"name\": \"Washington State Business License\",\n      \"purpose\": \"We can only allow licensed Washington State business representatives into the WA Business Conference\",\n      \"schema\": [{\n        \"uri\": \"https://licenses.example.com/business-license.json\"\n      }]\n    }\n  ]\n};\n\nconst verifiablePresentation = {\n  '@context': [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  type: [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: {...},\n  verifiableCredential: [...],\n  proof: {...}\n}\n\nconst {value, warnings, errors} = pejs.evaluate(presentationDefinition, verifiablePresentation);\n```\n\n#### Credential Query\nA credential query allows holders to filter their set of credentials for matches to a given presentation definition.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\n// Definition from verifier request\nconst presentationDefinition = {\n  ...\n};\n\n// Example for loading credentials\nconst credentials = await secureStore.getCredentials();\n\n// Find matching credentials\nconst srMatches = pejs.selectFrom(presentationDefinition, credentials, holderDid);\n\n// An example that selects the first 'count' credentials from\n// the matches. in a real scenario, the user has to select what \n// to disclose\nconst selectedCredentials = srMatches.map(\n  ({matches, count}) => matches.slice(0, count)\n).flat();\n\n// Construct presentation submission from selected credentials\nconst presentationSubmission = pejs.presentationFrom(presentationDefinition, selectedCredentials, holderDID);\n\nconst presentation = {\n  \"@context\": [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  \"type\": [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: presentationSubmission,\n  verifiableCredential: selectedCredentials\n};\n\n// Presentation would be signed and sent to verifier\n```\n\n#### Utilities\nIn addition to the core functionality above, the underlying validation methods are exposed as low-level helper functions.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  ...\n};\n\nconst {warnings: pdWarnings, errors: pdErrors} = pejs.validateDefinition(presentationDefinition);\n\nconst presentationSubmission = {\n  ...\n};\n\nconst {warnings: psWarnings, errors: psErrors} = pejs.validateSubmission(presentationSubmission);\n```\n\n## API\n\n### Evaluate\n```typescript\nevaluate(presentationDefinition, verifiablePresentation)\n```\n##### Description\nEvaluates whether a presentation submission meets the requested presentation definition\nSince this method will be used both **before** and **after** creating a VerifiablePresentation, we accept both _signed_ and _unsigned_ version of a presentation here. \n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `presentation` | `Presentation` | the Presentation object containing the required credentials and a `presentation_submission` object mapping back to the presentation definition |\n\n#### Return value\nIf evaluation is successful, `value` will be a non-null `PresentationSubmission` mapping the submitted credentials to the requested inputs.\n```typescript\ninterface EvaluationResults {\n  value?: PresentationSubmission;\n  warnings?: string[];\n  errors?: Error[];\n}\n```\n\n### SelectFrom\n```typescript\nselectFrom(presentationDefinition, credentials, holderDids)\n```\n##### Description\nGathers the matching credentials that fit a given presentation definition\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `credentials` | `VerifiableCredential[]` | the array of verifiable credentials to select from |\n| `holderDids` | `string[]` | the holder's dids. this can be found in VerifiablePresentation's holder property note that a wallet can have many holderDids retrieved from different places|\n\n#### Return value\n- If the selection was successful or partially successful, the `matches` array will consist of `SubmissionRequirementMatch` object(s), representing the matching credentials for each `SubmissionRequirement` in the `presentationDefinition` input parameter.\n- If the selection was not successful, the `errors` array will consist of `Checked` object(s), representing what has failed in your selection process.\n\n```typescript\nimport { Status } from './ConstraintUtils';\n\ninterface SelectResults {\n  errors?: Checked[];\n  matches?: SubmissionRequirementMatch[];\n  /**\n   * This is the parameter that pejs library user should look into to determine what to do next\n   * Status can have three values:\n   *  1. INFO: everything is fine, you can call `presentationFrom` after this method\n   *  2. WARN: method was called with more credentials than required. \n   *       To enhance credential holder's privacy it is recommended to select credentials which are absolutely required.\n   *  3. Error: the credentials you've sent didn't satisfy the requirement defined presentationDefinition object\n   */\n  areRequiredCredentialsPresent: Status;\n  /**\n   * All matched/selectable credentials\n   */\n  selectableVerifiableCredentials?: VerifiableCredential[];\n  /**\n   * Following are indexes of the verifiableCredentials passed to the selectFrom method that have been selected.\n   */\n  vcIndexes?: number[];\n  warnings?: Checked[];\n}\n\ninterface SubmissionRequirementMatch {\n  name?: string;\n  rule: Rules;\n  min?: number;\n  count?: number;\n  max?: number;\n  matches: string[];\n  from?: string[];\n  from_nested?: SubmissionRequirementMatch[]; // VerifiableCredential Address\n}\n```\n\n### PresentationFrom\n```typescript\npresentationFrom(presentationDefinition, selectedCredentials, holderDID)\n```\n##### Description\nCreates the corresponding Presentation Submission object to be included in the Verifiable Presentation response, which maps the submitted credentials to the requested inputs in the `presentationDefinition` input parameter.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `selectedCredentials` | `VerifiableCredential[]` | the array of verifiable credentials that meet the submission requirements in the presentation definition |\n| `holderDid` | `string` | the holder's DID. This can be found in VerifiablePresentation's holder property note that a wallet can have many holderDIDs retrieved from different places|\n\n#### Return value\nIf the selected credentials successfully match the submission requirements in the presentation definition, the return value will be a non-null `PresentationSubmission`\n```typescript\ninterface PresentationSubmission {\n  id?: string;\n  definition_id: string;\n  descriptor_map: Descriptor[]\n}\n```\n\n### Validation\n```typescript\nvalidateDefinition(objToValidate)\n```\n```typescript\nvalidateSubmission(objToValidate)\n```\n#### Description\nA validation utility function for `PresentationDefinition` and `PresentationSubmission` objects.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `objToValidate` | <code>PresentationDefinition &#124; PresentationSubmission</code> | the presentation definition or presentation definition to be validated |\n\n#### Return value\nThe `validate` method returns a validated results array `NonEmptyArray<Checked>` , with structure:\n```typescript\ninterface Checked {\n  tag: string;\n  status: Status;\n  message?: string;\n}\n```\nstatus can have following values `'info' | 'warn' | 'error'`\n\n\n## Workflow Diagram\n![Flow diagram](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/Sphereon-Opensource/pe-js/develop/docs/simple-scenario.puml)\n# Glossary\n\nTerm | Definition |\n---- | ---------- |\nCredential | A set of one or more claims made by an issuer. |\nVerifiable Credential |  Is a tamper-evident credential that has authorship that can be cryptographically verified. Verifiable credentials can be used to build verifiable presentations, which can also be cryptographically verified. The claims in a credential can be about different subjects. |\nPresentation Definition | Presentation Definitions are objects that articulate what proofs a Verifier requires. |\nHolder | Holders are entities that have one or more verifiable credentials in their possession. Holders are also the entities that submit proofs to Verifiers to satisfy the requirements described in a Presentation Definition.\nHolder's Did | Unique ID URI string and PKI metadata document format for describing the cryptographic keys and other fundamental PKI values linked to a unique, user-controlled, self-sovereign identifier in holder's wallet|\nVerifier | Verifiers are entities that define what proofs they require from a Holder (via a Presentation Definition) in order to proceed with an interaction. |\nIssuer | A role an entity can perform by asserting claims about one or more subjects, creating a verifiable credential from these claims, and transmitting the verifiable credential to a holder. |\nPresentation | Data derived from one or more verifiable credentials, issued by one or more issuers |\nVerifiable Presentation | Is a tamper-evident presentation encoded in such a way that authorship of the data can be trusted after a process of cryptographic verification.\n\n## Further work:\n1. Implementation of presentation-exchange v2\n2. In the [DIF documentation](https://identity.foundation/presentation-exchange/#input-evaluation) some entries are addressing `nested credentials` and `nested paths` these are currently not fully support yet.\n","licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.4.2-unstable.1","dist":{"shasum":"2c2db526cc879e064b69508ba4ad476cea8b929a","integrity":"sha512-b0ed9rG6AKFIQHTOzM+ONr1PMUqdO/RyN56xeYIVnzmK37ogg97fbglf1NYNs9z1rjmszDkh0AgJiFA/0UAO3g==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.4.2-unstable.1.tgz","fileCount":609,"unpackedSize":3217708,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhoUtjCRA9TVsSAnZWagAAco8P+QAWieI2H5pCjrVeAbEp\n3406dWHUk+E/0At8JI0dLNY7YCX389IdIpOPHMH/T9PcEd0XY++W2M0qRApI\n/58eQ18eH4ot5tEFg3iu+O2u1qQ1sR6k9U9tFJNF4oPIkD9+mBjYBU9iG2dP\ngjnP4lltvcTJbJzT0W9heMul236gL+uvwXahR5DYpKSZbyBj8H/5d6mKIhFU\n+wCc/FLMJAB4ktUFcw9aoMHNhsdC622P66KP1iCiaZoIh4Fwuvhtx/fkcoYr\npgs05lzjeJE9wSlB9OfA5LA3i7b9Ew/EiFHTw0TAThI1ARTH8hVz8dbGl6Xz\nhiI9gRbP2zhcQAAV8QgkSmqRVDDWcODRFsouSB2pTgV/gctEF3Ccz+2dM5ky\ny4m0+P++L7Wk9CIs8eEHjbTYlPkOI9GMTCPKh3V3ITwGI6awGBD9DkGu/Dc8\nn/MvrFNEheOdASr37zddvBItmeGK09ag5t/EraSvJ5C/YMG9G8Z0VAEeIE3W\nEv0vmbr2Xe0HNUkXW5M2gcpe5poNizFVzIsytyubuHKL1+LAqU1dh5kqWsL8\nRzhDYSzlqAk0LEqO7HQ+K1v1K1xZwYsupwNxRv4J2AnkGCky7ylT7MFj3I4G\nsjq45CZkEBrTNQkRPSQjA/qdgo0dkDIhiQrgCn8CfJF0thd6nc/bJox+cUMx\nSYDI\r\n=wb2m\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDkD0c1kOcbVRIyW8+OHYoCC1ECM0YOekC25MEfymR3TAIhAJFVYZSkWI9+TEjjXB/YErLlyuuOTaF2UoPNzvjWgnr+"}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.4.2-unstable.1_1637960547394_0.5711639567519147"},"_hasShrinkwrap":false},"0.4.2-unstable.2":{"name":"@sphereon/pe-js","version":"0.4.2-unstable.2","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","typings":"dist/main/index.d.ts","browser":"dist/browser/index.js","module":"dist/module/index.js","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosure","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build:browser":"tsc -p tsconfig.browser.json","build:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","rimraf":"^2.6.2","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":120},"readmeFilename":"README.md","readme":"<h1 align=\"center\">\n  <br>\n  <a href=\"https://www.sphereon.com\"><img src=\"https://sphereon.com/content/themes/sphereon/assets/img/logo.svg\" alt=\"Sphereon\" width=\"400\"></a>\n  <br>PE-JS   DIF Presentation Exchange JavaScript Library \n  <br>\n</h1>\n\n[![CI](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml/badge.svg)](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/Sphereon-Opensource/pe-js/branch/develop/graph/badge.svg?token=9P1JGUYA35)](https://codecov.io/gh/Sphereon-Opensource/pe-js) [![NPM Version](https://img.shields.io/npm/v/@sphereon/pe-js.svg)](https://npm.im/@sphereon/pe-js)\n\n## Active Development\n_IMPORTANT: This software still is in early development stage. As such you should expect breaking changes in APIs, we expect to keep that to a minimum though._\n\n## Background\n\nThe PE-JS Library is a general use presentation exchange library that implements the functionality described in the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/). It is written in Typescript and can be compiled to any target JavaScript version.\n\nSphereon's PE Library is useful for both verifier systems and holders (e.g. wallets) and can be used in client side browsers and mobile applications as well as on server side technology such as REST APIs (e.g. built with NodeJS). It allows anyone to add DIF Presentation Exchange logic to their existing wallets, or verifiers, without making any further assumptions about the technologies used in their products.\n\nThe presentation exchange operates generally as follows; The verifier creates a Presentation Definition asking for credentials from the holder. The definition for the credentials is sent to the holder, who returns a presentation as a response. Now the verifier will verify the presentation by checking the signature and other accompanying proofs. \n\nThe presentation exchange will ensure that the model used by the verifier, can be interpreted by the holder. It then ensures that the correct parts from the holders credentials are used to create the presentation. The PE contains all the logic to interpret the models, therefore removing the need for the verifier and holder to align their specific models.\n\nThe data objects (models) used in PE-JS are generated from Sphereon's DIF PE OpenAPI Spec component. The code for the component can be seen at [PE-OpenAPI github repository](https://github.com/Sphereon-Opensource/pe-openapi). This allows the generation of the objects in many languages and frameworks consistently by configuring the maven plugin.\n\n\n### The PE Library supports the following actions:\n\n * Creating a presentation definition / request\n * Validating a presentation definition / request to be as per specification\n * Creating a presentation submission\n * Validating a presentation submission when received\n * Input evaluations: Verification of presentation submissions to be as per presentation definition\n * Utilities: to build and use different models compliant with the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/).\n\nStateful storage or credential management should be implemented in separate libraries/ modules that make use of the underlying DIF Presentation Exchange implementation. By keeping these separate, the library will stay platform agnostic. \n\n## For PE-JS developers\n\nThis project has been created using:\n* `yarn` version 1.22.5\n* `node` version 12.22.1\n\n### Install\n```shell\nyarn install\n```\n### Build\n```shell\nyarn build\n```\n### Test\nThe test command runs:\n* `eslint`\n* `prettier`\n* `unit`\n\nYou can also run only a single section of these tests, using for example `yarn test:unit`.\n```shell\nyarn test\n```\n\n### Utility scripts\nThere are several other utility scripts that help with development.\n\n* `yarn fix` - runs `eslint --fix` as well as `prettier` to fix code style\n* `yarn cov` - generates code coverage report\n\n\n## For PE-JS Users\n\nThe library can be installed direction from npmjs via:\n\n```shell\n# install via yarn\nyarn add @sphereon/pe-js\n\n# install via npm\nnpm install @sphereon/pe-js\n```\n\nThe core functionality of the DIF Presentation Exchange can be outlined as follows:\n\n* Input Evaluation\n* Credential Query\n* Utilities\n\n#### Input Evaluation\nInput evaluation is the primary mechanism by which a verifier determines whether a presentation submission from a holder matches the requested presentation definition from the request.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  \"id\": \"32f54163-7166-48f1-93d8-ff217bdb0653\",\n  \"input_descriptors\": [\n    {\n      \"id\": \"wa_driver_license\",\n      \"name\": \"Washington State Business License\",\n      \"purpose\": \"We can only allow licensed Washington State business representatives into the WA Business Conference\",\n      \"schema\": [{\n        \"uri\": \"https://licenses.example.com/business-license.json\"\n      }]\n    }\n  ]\n};\n\nconst verifiablePresentation = {\n  '@context': [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  type: [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: {...},\n  verifiableCredential: [...],\n  proof: {...}\n}\n\nconst {value, warnings, errors} = pejs.evaluate(presentationDefinition, verifiablePresentation);\n```\n\n#### Credential Query\nA credential query allows holders to filter their set of credentials for matches to a given presentation definition.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\n// Definition from verifier request\nconst presentationDefinition = {\n  ...\n};\n\n// Example for loading credentials\nconst credentials = await secureStore.getCredentials();\n\n// Find matching credentials\nconst srMatches = pejs.selectFrom(presentationDefinition, credentials, holderDid);\n\n// An example that selects the first 'count' credentials from\n// the matches. in a real scenario, the user has to select what \n// to disclose\nconst selectedCredentials = srMatches.map(\n  ({matches, count}) => matches.slice(0, count)\n).flat();\n\n// Construct presentation submission from selected credentials\nconst presentationSubmission = pejs.presentationFrom(presentationDefinition, selectedCredentials, holderDID);\n\nconst presentation = {\n  \"@context\": [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  \"type\": [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: presentationSubmission,\n  verifiableCredential: selectedCredentials\n};\n\n// Presentation would be signed and sent to verifier\n```\n\n#### Utilities\nIn addition to the core functionality above, the underlying validation methods are exposed as low-level helper functions.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  ...\n};\n\nconst {warnings: pdWarnings, errors: pdErrors} = pejs.validateDefinition(presentationDefinition);\n\nconst presentationSubmission = {\n  ...\n};\n\nconst {warnings: psWarnings, errors: psErrors} = pejs.validateSubmission(presentationSubmission);\n```\n\n## API\n\n### Evaluate\n```typescript\nevaluate(presentationDefinition, verifiablePresentation)\n```\n##### Description\nEvaluates whether a presentation submission meets the requested presentation definition\nSince this method will be used both **before** and **after** creating a VerifiablePresentation, we accept both _signed_ and _unsigned_ version of a presentation here. \n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `presentation` | `Presentation` | the Presentation object containing the required credentials and a `presentation_submission` object mapping back to the presentation definition |\n\n#### Return value\nIf evaluation is successful, `value` will be a non-null `PresentationSubmission` mapping the submitted credentials to the requested inputs.\n```typescript\ninterface EvaluationResults {\n  value?: PresentationSubmission;\n  warnings?: string[];\n  errors?: Error[];\n}\n```\n\n### SelectFrom\n```typescript\nselectFrom(presentationDefinition, credentials, holderDids)\n```\n##### Description\nGathers the matching credentials that fit a given presentation definition\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `credentials` | `VerifiableCredential[]` | the array of verifiable credentials to select from |\n| `holderDids` | `string[]` | the holder's dids. this can be found in VerifiablePresentation's holder property note that a wallet can have many holderDids retrieved from different places|\n\n#### Return value\n- If the selection was successful or partially successful, the `matches` array will consist of `SubmissionRequirementMatch` object(s), representing the matching credentials for each `SubmissionRequirement` in the `presentationDefinition` input parameter.\n- If the selection was not successful, the `errors` array will consist of `Checked` object(s), representing what has failed in your selection process.\n\n```typescript\nimport { Status } from './ConstraintUtils';\n\ninterface SelectResults {\n  errors?: Checked[];\n  matches?: SubmissionRequirementMatch[];\n  /**\n   * This is the parameter that pejs library user should look into to determine what to do next\n   * Status can have three values:\n   *  1. INFO: everything is fine, you can call `presentationFrom` after this method\n   *  2. WARN: method was called with more credentials than required. \n   *       To enhance credential holder's privacy it is recommended to select credentials which are absolutely required.\n   *  3. Error: the credentials you've sent didn't satisfy the requirement defined presentationDefinition object\n   */\n  areRequiredCredentialsPresent: Status;\n  /**\n   * All matched/selectable credentials\n   */\n  selectableVerifiableCredentials?: VerifiableCredential[];\n  /**\n   * Following are indexes of the verifiableCredentials passed to the selectFrom method that have been selected.\n   */\n  vcIndexes?: number[];\n  warnings?: Checked[];\n}\n\ninterface SubmissionRequirementMatch {\n  name?: string;\n  rule: Rules;\n  min?: number;\n  count?: number;\n  max?: number;\n  matches: string[];\n  from?: string[];\n  from_nested?: SubmissionRequirementMatch[]; // VerifiableCredential Address\n}\n```\n\n### PresentationFrom\n```typescript\npresentationFrom(presentationDefinition, selectedCredentials, holderDID)\n```\n##### Description\nCreates the corresponding Presentation Submission object to be included in the Verifiable Presentation response, which maps the submitted credentials to the requested inputs in the `presentationDefinition` input parameter.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `selectedCredentials` | `VerifiableCredential[]` | the array of verifiable credentials that meet the submission requirements in the presentation definition |\n| `holderDid` | `string` | the holder's DID. This can be found in VerifiablePresentation's holder property note that a wallet can have many holderDIDs retrieved from different places|\n\n#### Return value\nIf the selected credentials successfully match the submission requirements in the presentation definition, the return value will be a non-null `PresentationSubmission`\n```typescript\ninterface PresentationSubmission {\n  id?: string;\n  definition_id: string;\n  descriptor_map: Descriptor[]\n}\n```\n\n### Validation\n```typescript\nvalidateDefinition(objToValidate)\n```\n```typescript\nvalidateSubmission(objToValidate)\n```\n#### Description\nA validation utility function for `PresentationDefinition` and `PresentationSubmission` objects.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `objToValidate` | <code>PresentationDefinition &#124; PresentationSubmission</code> | the presentation definition or presentation definition to be validated |\n\n#### Return value\nThe `validate` method returns a validated results array `NonEmptyArray<Checked>` , with structure:\n```typescript\ninterface Checked {\n  tag: string;\n  status: Status;\n  message?: string;\n}\n```\nstatus can have following values `'info' | 'warn' | 'error'`\n\n\n## Workflow Diagram\n![Flow diagram](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/Sphereon-Opensource/pe-js/develop/docs/simple-scenario.puml)\n# Glossary\n\nTerm | Definition |\n---- | ---------- |\nCredential | A set of one or more claims made by an issuer. |\nVerifiable Credential |  Is a tamper-evident credential that has authorship that can be cryptographically verified. Verifiable credentials can be used to build verifiable presentations, which can also be cryptographically verified. The claims in a credential can be about different subjects. |\nPresentation Definition | Presentation Definitions are objects that articulate what proofs a Verifier requires. |\nHolder | Holders are entities that have one or more verifiable credentials in their possession. Holders are also the entities that submit proofs to Verifiers to satisfy the requirements described in a Presentation Definition.\nHolder's Did | Unique ID URI string and PKI metadata document format for describing the cryptographic keys and other fundamental PKI values linked to a unique, user-controlled, self-sovereign identifier in holder's wallet|\nVerifier | Verifiers are entities that define what proofs they require from a Holder (via a Presentation Definition) in order to proceed with an interaction. |\nIssuer | A role an entity can perform by asserting claims about one or more subjects, creating a verifiable credential from these claims, and transmitting the verifiable credential to a holder. |\nPresentation | Data derived from one or more verifiable credentials, issued by one or more issuers |\nVerifiable Presentation | Is a tamper-evident presentation encoded in such a way that authorship of the data can be trusted after a process of cryptographic verification.\n\n## Further work:\n1. Implementation of presentation-exchange v2\n2. In the [DIF documentation](https://identity.foundation/presentation-exchange/#input-evaluation) some entries are addressing `nested credentials` and `nested paths` these are currently not fully support yet.\n","licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.4.2-unstable.2","dist":{"shasum":"b904ad8a3baae6410952bee127934e4ed4dcb482","integrity":"sha512-hjUkdFAymh7DSVd3igAqwVHiJtV/PfNW+Oe+XkBTUWguDWo6yLZLsGZwk9g8/n3dD0uF9oEQN5qZCufIvjYQJA==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.4.2-unstable.2.tgz","fileCount":609,"unpackedSize":3218166,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhoU8eCRA9TVsSAnZWagAARWgP/jFH/x2AmjJUGx0tl2yO\nfYtrN3ydOgoWOSfdMhvo15Tdavf5xxxQG7U9E7zLTfxnN8qy7jyWB9EH/N34\nl+/GTBkZifXv0bYSjb0W6AbZaIhEF6hUUs9yKElXIVOLUJTH4NT/vzcQpA2g\naYxiCFwiIci/eYY2WVt62ps6a4hM2j5HkKX5Wm9g+KUw67qC9os6nWLt5d43\nyPAjbyCEmptMOyACpVB475xPzofVQ22/iFtpER7RublHsu/J2eNlo4W3LXaC\nG4YzcAqldy2WAtCJqSJXvnOMkc9d6mGC7frVL4DXoC2/yErTX1gPdrMJl6EF\nOvXjuNxjBUxvLWndirK963ICIDPOyhBhF7SzX3OdtWRFWZqKYJzT/vhKVZZL\nmC/82ab2mUgbWZcI/Pld1ZDMcujoCWPNy5aHW15z05Etps4o85MIRWMmm7wV\nCRNYVel89Mch/m0NDtWnwSlXBHBDU04TSUOFav7j0/1uGMeWIpiyxxKH0bdr\nJi+yURZiL/X8ncDcHKnCxe46XZH4Lf/ah+CizN00AXKqnQw8CHQKBnAygkZm\nRXxqYVezMuiKoz4rwDz/lBVh9282zp3XUTL6OgxhwiVdz+3ZlXvMYxjoFaff\n7CMPYxb9MiWwnm95AgNdSjmswCaNFNT77lFTjYjsN3BoR5gqneRxmTD3tnvC\n1Eki\r\n=Ewm7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCcxcYikiCs24M3MZQa8cghDkADRx9grkHX2RiQh5a4ogIgOa8KNBzkxAY8FPjR/ErJJxGnjcDiPpir4iXqqGEVL7U="}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.4.2-unstable.2_1637961501981_0.9229848621455239"},"_hasShrinkwrap":false},"0.4.2-unstable.3":{"name":"@sphereon/pe-js","version":"0.4.2-unstable.3","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","typings":"dist/main/index.d.ts","browser":"dist/browser/index.js","module":"dist/module/index.js","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosure","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build:browser":"tsc -p tsconfig.browser.json","build:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","rimraf":"^2.6.2","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":150},"readmeFilename":"README.md","readme":"<h1 align=\"center\">\n  <br>\n  <a href=\"https://www.sphereon.com\"><img src=\"https://sphereon.com/content/themes/sphereon/assets/img/logo.svg\" alt=\"Sphereon\" width=\"400\"></a>\n  <br>PE-JS   DIF Presentation Exchange JavaScript Library \n  <br>\n</h1>\n\n[![CI](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml/badge.svg)](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/Sphereon-Opensource/pe-js/branch/develop/graph/badge.svg?token=9P1JGUYA35)](https://codecov.io/gh/Sphereon-Opensource/pe-js) [![NPM Version](https://img.shields.io/npm/v/@sphereon/pe-js.svg)](https://npm.im/@sphereon/pe-js)\n\n## Active Development\n_IMPORTANT: This software still is in early development stage. As such you should expect breaking changes in APIs, we expect to keep that to a minimum though._\n\n## Background\n\nThe PE-JS Library is a general use presentation exchange library that implements the functionality described in the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/). It is written in Typescript and can be compiled to any target JavaScript version.\n\nSphereon's PE Library is useful for both verifier systems and holders (e.g. wallets) and can be used in client side browsers and mobile applications as well as on server side technology such as REST APIs (e.g. built with NodeJS). It allows anyone to add DIF Presentation Exchange logic to their existing wallets, or verifiers, without making any further assumptions about the technologies used in their products.\n\nThe presentation exchange operates generally as follows; The verifier creates a Presentation Definition asking for credentials from the holder. The definition for the credentials is sent to the holder, who returns a presentation as a response. Now the verifier will verify the presentation by checking the signature and other accompanying proofs. \n\nThe presentation exchange will ensure that the model used by the verifier, can be interpreted by the holder. It then ensures that the correct parts from the holders credentials are used to create the presentation. The PE contains all the logic to interpret the models, therefore removing the need for the verifier and holder to align their specific models.\n\nThe data objects (models) used in PE-JS are generated from Sphereon's DIF PE OpenAPI Spec component. The code for the component can be seen at [PE-OpenAPI github repository](https://github.com/Sphereon-Opensource/pe-openapi). This allows the generation of the objects in many languages and frameworks consistently by configuring the maven plugin.\n\n\n### The PE Library supports the following actions:\n\n * Creating a presentation definition / request\n * Validating a presentation definition / request to be as per specification\n * Creating a presentation submission\n * Validating a presentation submission when received\n * Input evaluations: Verification of presentation submissions to be as per presentation definition\n * Utilities: to build and use different models compliant with the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/).\n\nStateful storage or credential management should be implemented in separate libraries/ modules that make use of the underlying DIF Presentation Exchange implementation. By keeping these separate, the library will stay platform agnostic. \n\n## For PE-JS developers\n\nThis project has been created using:\n* `yarn` version 1.22.5\n* `node` version 12.22.1\n\n### Install\n```shell\nyarn install\n```\n### Build\n```shell\nyarn build\n```\n### Test\nThe test command runs:\n* `eslint`\n* `prettier`\n* `unit`\n\nYou can also run only a single section of these tests, using for example `yarn test:unit`.\n```shell\nyarn test\n```\n\n### Utility scripts\nThere are several other utility scripts that help with development.\n\n* `yarn fix` - runs `eslint --fix` as well as `prettier` to fix code style\n* `yarn cov` - generates code coverage report\n\n\n## For PE-JS Users\n\nThe library can be installed direction from npmjs via:\n\n```shell\n# install via yarn\nyarn add @sphereon/pe-js\n\n# install via npm\nnpm install @sphereon/pe-js\n```\n\nThe core functionality of the DIF Presentation Exchange can be outlined as follows:\n\n* Input Evaluation\n* Credential Query\n* Utilities\n\n#### Input Evaluation\nInput evaluation is the primary mechanism by which a verifier determines whether a presentation submission from a holder matches the requested presentation definition from the request.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  \"id\": \"32f54163-7166-48f1-93d8-ff217bdb0653\",\n  \"input_descriptors\": [\n    {\n      \"id\": \"wa_driver_license\",\n      \"name\": \"Washington State Business License\",\n      \"purpose\": \"We can only allow licensed Washington State business representatives into the WA Business Conference\",\n      \"schema\": [{\n        \"uri\": \"https://licenses.example.com/business-license.json\"\n      }]\n    }\n  ]\n};\n\nconst verifiablePresentation = {\n  '@context': [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  type: [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: {...},\n  verifiableCredential: [...],\n  proof: {...}\n}\n\nconst {value, warnings, errors} = pejs.evaluate(presentationDefinition, verifiablePresentation);\n```\n\n#### Credential Query\nA credential query allows holders to filter their set of credentials for matches to a given presentation definition.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\n// Definition from verifier request\nconst presentationDefinition = {\n  ...\n};\n\n// Example for loading credentials\nconst credentials = await secureStore.getCredentials();\n\n// Find matching credentials\nconst srMatches = pejs.selectFrom(presentationDefinition, credentials, holderDid);\n\n// An example that selects the first 'count' credentials from\n// the matches. in a real scenario, the user has to select what \n// to disclose\nconst selectedCredentials = srMatches.map(\n  ({matches, count}) => matches.slice(0, count)\n).flat();\n\n// Construct presentation submission from selected credentials\nconst presentationSubmission = pejs.presentationFrom(presentationDefinition, selectedCredentials, holderDID);\n\nconst presentation = {\n  \"@context\": [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  \"type\": [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: presentationSubmission,\n  verifiableCredential: selectedCredentials\n};\n\n// Presentation would be signed and sent to verifier\n```\n\n#### Utilities\nIn addition to the core functionality above, the underlying validation methods are exposed as low-level helper functions.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  ...\n};\n\nconst {warnings: pdWarnings, errors: pdErrors} = pejs.validateDefinition(presentationDefinition);\n\nconst presentationSubmission = {\n  ...\n};\n\nconst {warnings: psWarnings, errors: psErrors} = pejs.validateSubmission(presentationSubmission);\n```\n\n## API\n\n### Evaluate\n```typescript\nevaluate(presentationDefinition, verifiablePresentation)\n```\n##### Description\nEvaluates whether a presentation submission meets the requested presentation definition\nSince this method will be used both **before** and **after** creating a VerifiablePresentation, we accept both _signed_ and _unsigned_ version of a presentation here. \n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `presentation` | `Presentation` | the Presentation object containing the required credentials and a `presentation_submission` object mapping back to the presentation definition |\n\n#### Return value\nIf evaluation is successful, `value` will be a non-null `PresentationSubmission` mapping the submitted credentials to the requested inputs.\n```typescript\ninterface EvaluationResults {\n  value?: PresentationSubmission;\n  warnings?: string[];\n  errors?: Error[];\n}\n```\n\n### SelectFrom\n```typescript\nselectFrom(presentationDefinition, credentials, holderDids)\n```\n##### Description\nGathers the matching credentials that fit a given presentation definition\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `credentials` | `VerifiableCredential[]` | the array of verifiable credentials to select from |\n| `holderDids` | `string[]` | the holder's dids. this can be found in VerifiablePresentation's holder property note that a wallet can have many holderDids retrieved from different places|\n\n#### Return value\n- If the selection was successful or partially successful, the `matches` array will consist of `SubmissionRequirementMatch` object(s), representing the matching credentials for each `SubmissionRequirement` in the `presentationDefinition` input parameter.\n- If the selection was not successful, the `errors` array will consist of `Checked` object(s), representing what has failed in your selection process.\n\n```typescript\nimport { Status } from './ConstraintUtils';\n\ninterface SelectResults {\n  errors?: Checked[];\n  matches?: SubmissionRequirementMatch[];\n  /**\n   * This is the parameter that pejs library user should look into to determine what to do next\n   * Status can have three values:\n   *  1. INFO: everything is fine, you can call `presentationFrom` after this method\n   *  2. WARN: method was called with more credentials than required. \n   *       To enhance credential holder's privacy it is recommended to select credentials which are absolutely required.\n   *  3. Error: the credentials you've sent didn't satisfy the requirement defined presentationDefinition object\n   */\n  areRequiredCredentialsPresent: Status;\n  /**\n   * All matched/selectable credentials\n   */\n  selectableVerifiableCredentials?: VerifiableCredential[];\n  /**\n   * Following are indexes of the verifiableCredentials passed to the selectFrom method that have been selected.\n   */\n  vcIndexes?: number[];\n  warnings?: Checked[];\n}\n\ninterface SubmissionRequirementMatch {\n  name?: string;\n  rule: Rules;\n  min?: number;\n  count?: number;\n  max?: number;\n  matches: string[];\n  from?: string[];\n  from_nested?: SubmissionRequirementMatch[]; // VerifiableCredential Address\n}\n```\n\n### PresentationFrom\n```typescript\npresentationFrom(presentationDefinition, selectedCredentials, holderDID)\n```\n##### Description\nCreates the corresponding Presentation Submission object to be included in the Verifiable Presentation response, which maps the submitted credentials to the requested inputs in the `presentationDefinition` input parameter.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `selectedCredentials` | `VerifiableCredential[]` | the array of verifiable credentials that meet the submission requirements in the presentation definition |\n| `holderDid` | `string` | the holder's DID. This can be found in VerifiablePresentation's holder property note that a wallet can have many holderDIDs retrieved from different places|\n\n#### Return value\nIf the selected credentials successfully match the submission requirements in the presentation definition, the return value will be a non-null `PresentationSubmission`\n```typescript\ninterface PresentationSubmission {\n  id?: string;\n  definition_id: string;\n  descriptor_map: Descriptor[]\n}\n```\n\n### Validation\n```typescript\nvalidateDefinition(objToValidate)\n```\n```typescript\nvalidateSubmission(objToValidate)\n```\n#### Description\nA validation utility function for `PresentationDefinition` and `PresentationSubmission` objects.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `objToValidate` | <code>PresentationDefinition &#124; PresentationSubmission</code> | the presentation definition or presentation definition to be validated |\n\n#### Return value\nThe `validate` method returns a validated results array `NonEmptyArray<Checked>` , with structure:\n```typescript\ninterface Checked {\n  tag: string;\n  status: Status;\n  message?: string;\n}\n```\nstatus can have following values `'info' | 'warn' | 'error'`\n\n\n## Workflow Diagram\n![Flow diagram](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/Sphereon-Opensource/pe-js/develop/docs/simple-scenario.puml)\n# Glossary\n\nTerm | Definition |\n---- | ---------- |\nCredential | A set of one or more claims made by an issuer. |\nVerifiable Credential |  Is a tamper-evident credential that has authorship that can be cryptographically verified. Verifiable credentials can be used to build verifiable presentations, which can also be cryptographically verified. The claims in a credential can be about different subjects. |\nPresentation Definition | Presentation Definitions are objects that articulate what proofs a Verifier requires. |\nHolder | Holders are entities that have one or more verifiable credentials in their possession. Holders are also the entities that submit proofs to Verifiers to satisfy the requirements described in a Presentation Definition.\nHolder's Did | Unique ID URI string and PKI metadata document format for describing the cryptographic keys and other fundamental PKI values linked to a unique, user-controlled, self-sovereign identifier in holder's wallet|\nVerifier | Verifiers are entities that define what proofs they require from a Holder (via a Presentation Definition) in order to proceed with an interaction. |\nIssuer | A role an entity can perform by asserting claims about one or more subjects, creating a verifiable credential from these claims, and transmitting the verifiable credential to a holder. |\nPresentation | Data derived from one or more verifiable credentials, issued by one or more issuers |\nVerifiable Presentation | Is a tamper-evident presentation encoded in such a way that authorship of the data can be trusted after a process of cryptographic verification.\n\n## Further work:\n1. Implementation of presentation-exchange v2\n2. In the [DIF documentation](https://identity.foundation/presentation-exchange/#input-evaluation) some entries are addressing `nested credentials` and `nested paths` these are currently not fully support yet.\n","licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.4.2-unstable.3","dist":{"shasum":"15f5743a1e5201a391f9ba960a762934bca73fcc","integrity":"sha512-hfFkaTCFNJ4I50JJSvSSTWcNvL1VHw4ryeZdboPZ5m8sMMqiANR4B0xyGkZFlHpRWfxPfys48W0YBNJ89JCM2w==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.4.2-unstable.3.tgz","fileCount":597,"unpackedSize":3197446,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhoWFiCRA9TVsSAnZWagAAU/gP/148y6AUvR6qKH1LTjy6\n8hyscx/NRG89XNybOIQw5AKWAEq2AWhe2FOlHMZHnRrzZ+rDilggQmQSLQL+\nUGvRGKz7ptbgR8E9QlyYQcvPTKpesHuTm7TyJZCI9VoHRl7q2MCqwJ2rm4MB\nxjBCtYb+4x3s+Z0V9NakgClJY23swURtwesUeM0e4/DrbUoojhnnfWa26RQ4\ng10tSqpACr0pgnKChzQsVhHEDWXV9xDeavwQC5Y6l6k5FGkcGB+Uhdew4LBJ\njD1IQs++Vz+FJmMv4GU3saG37FhxhZ5B+2Zd3AqNGfqSQHqs53iXnB5fK9dx\n4f9MU1/u1S6CJlS56eqZ97EqZlQCri9BmVxF+vIKqMcx83fA8BbOBzABS02d\nYl6BKOxR71s+BAuqafPzXpxkqOeJy4EojpsP1odPa00+/NyHKo4LFhzpr0Wz\nAtBdd0W9ScOEpmHONWsEX3GitcEyr+/ImbTUGp5NM/qvlppiP4fWwDikDKoy\nU5kOc5fgtDU43iBSOsSMs8FD/gmsW2ZEK06nAp6qNGV3vQEJwJaHqJSQ760O\n5cZic1KjRWfg5y+2mPnrI470hLQ2+ROUBqYZHPU1HpMTMatNpoBzkFC/etx3\nTQT8gs9gaatYcbcrFnZFh7ywXzIEYRFmxgxim/SMY9lvGM6tCJtIq9aZfsk6\neshf\r\n=Wdbm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD0unsSvyViL5MpYcsmdW0Ohp5KTnVtwNGYYFlps4abcwIhAJc0hjtHpf01qQPfiSAL2b2xeiCOdf+V6ayQotjNz/ag"}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.4.2-unstable.3_1637966178621_0.4819823479683609"},"_hasShrinkwrap":false},"0.4.2-unstable.4":{"name":"@sphereon/pe-js","version":"0.4.2-unstable.4","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","typings":"dist/main/index.d.ts","browser":"dist/browser/index.js","module":"dist/module/index.js","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosure","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build:browser":"tsc -p tsconfig.browser.json","build:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","rimraf":"^2.6.2","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":150},"readmeFilename":"README.md","readme":"<h1 align=\"center\">\n  <br>\n  <a href=\"https://www.sphereon.com\"><img src=\"https://sphereon.com/content/themes/sphereon/assets/img/logo.svg\" alt=\"Sphereon\" width=\"400\"></a>\n  <br>PE-JS   DIF Presentation Exchange JavaScript Library \n  <br>\n</h1>\n\n[![CI](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml/badge.svg)](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/Sphereon-Opensource/pe-js/branch/develop/graph/badge.svg?token=9P1JGUYA35)](https://codecov.io/gh/Sphereon-Opensource/pe-js) [![NPM Version](https://img.shields.io/npm/v/@sphereon/pe-js.svg)](https://npm.im/@sphereon/pe-js)\n\n## Active Development\n_IMPORTANT: This software still is in early development stage. As such you should expect breaking changes in APIs, we expect to keep that to a minimum though._\n\n## Background\n\nThe PE-JS Library is a general use presentation exchange library that implements the functionality described in the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/). It is written in Typescript and can be compiled to any target JavaScript version.\n\nSphereon's PE Library is useful for both verifier systems and holders (e.g. wallets) and can be used in client side browsers and mobile applications as well as on server side technology such as REST APIs (e.g. built with NodeJS). It allows anyone to add DIF Presentation Exchange logic to their existing wallets, or verifiers, without making any further assumptions about the technologies used in their products.\n\nThe presentation exchange operates generally as follows; The verifier creates a Presentation Definition asking for credentials from the holder. The definition for the credentials is sent to the holder, who returns a presentation as a response. Now the verifier will verify the presentation by checking the signature and other accompanying proofs. \n\nThe presentation exchange will ensure that the model used by the verifier, can be interpreted by the holder. It then ensures that the correct parts from the holders credentials are used to create the presentation. The PE contains all the logic to interpret the models, therefore removing the need for the verifier and holder to align their specific models.\n\nThe data objects (models) used in PE-JS are generated from Sphereon's DIF PE OpenAPI Spec component. The code for the component can be seen at [PE-OpenAPI github repository](https://github.com/Sphereon-Opensource/pe-openapi). This allows the generation of the objects in many languages and frameworks consistently by configuring the maven plugin.\n\n\n### The PE Library supports the following actions:\n\n * Creating a presentation definition / request\n * Validating a presentation definition / request to be as per specification\n * Creating a presentation submission\n * Validating a presentation submission when received\n * Input evaluations: Verification of presentation submissions to be as per presentation definition\n * Utilities: to build and use different models compliant with the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/).\n\nStateful storage or credential management should be implemented in separate libraries/ modules that make use of the underlying DIF Presentation Exchange implementation. By keeping these separate, the library will stay platform agnostic. \n\n## For PE-JS developers\n\nThis project has been created using:\n* `yarn` version 1.22.5\n* `node` version 12.22.1\n\n### Install\n```shell\nyarn install\n```\n### Build\n```shell\nyarn build\n```\n### Test\nThe test command runs:\n* `eslint`\n* `prettier`\n* `unit`\n\nYou can also run only a single section of these tests, using for example `yarn test:unit`.\n```shell\nyarn test\n```\n\n### Utility scripts\nThere are several other utility scripts that help with development.\n\n* `yarn fix` - runs `eslint --fix` as well as `prettier` to fix code style\n* `yarn cov` - generates code coverage report\n\n\n## For PE-JS Users\n\nThe library can be installed direction from npmjs via:\n\n```shell\n# install via yarn\nyarn add @sphereon/pe-js\n\n# install via npm\nnpm install @sphereon/pe-js\n```\n\nThe core functionality of the DIF Presentation Exchange can be outlined as follows:\n\n* Input Evaluation\n* Credential Query\n* Utilities\n\n#### Input Evaluation\nInput evaluation is the primary mechanism by which a verifier determines whether a presentation submission from a holder matches the requested presentation definition from the request.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  \"id\": \"32f54163-7166-48f1-93d8-ff217bdb0653\",\n  \"input_descriptors\": [\n    {\n      \"id\": \"wa_driver_license\",\n      \"name\": \"Washington State Business License\",\n      \"purpose\": \"We can only allow licensed Washington State business representatives into the WA Business Conference\",\n      \"schema\": [{\n        \"uri\": \"https://licenses.example.com/business-license.json\"\n      }]\n    }\n  ]\n};\n\nconst verifiablePresentation = {\n  '@context': [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  type: [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: {...},\n  verifiableCredential: [...],\n  proof: {...}\n}\n\nconst {value, warnings, errors} = pejs.evaluate(presentationDefinition, verifiablePresentation);\n```\n\n#### Credential Query\nA credential query allows holders to filter their set of credentials for matches to a given presentation definition.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\n// Definition from verifier request\nconst presentationDefinition = {\n  ...\n};\n\n// Example for loading credentials\nconst credentials = await secureStore.getCredentials();\n\n// Find matching credentials\nconst srMatches = pejs.selectFrom(presentationDefinition, credentials, holderDid);\n\n// An example that selects the first 'count' credentials from\n// the matches. in a real scenario, the user has to select what \n// to disclose\nconst selectedCredentials = srMatches.map(\n  ({matches, count}) => matches.slice(0, count)\n).flat();\n\n// Construct presentation submission from selected credentials\nconst presentationSubmission = pejs.presentationFrom(presentationDefinition, selectedCredentials, holderDID);\n\nconst presentation = {\n  \"@context\": [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  \"type\": [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: presentationSubmission,\n  verifiableCredential: selectedCredentials\n};\n\n// Presentation would be signed and sent to verifier\n```\n\n#### Utilities\nIn addition to the core functionality above, the underlying validation methods are exposed as low-level helper functions.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  ...\n};\n\nconst {warnings: pdWarnings, errors: pdErrors} = pejs.validateDefinition(presentationDefinition);\n\nconst presentationSubmission = {\n  ...\n};\n\nconst {warnings: psWarnings, errors: psErrors} = pejs.validateSubmission(presentationSubmission);\n```\n\n## API\n\n### Evaluate\n```typescript\nevaluate(presentationDefinition, verifiablePresentation)\n```\n##### Description\nEvaluates whether a presentation submission meets the requested presentation definition\nSince this method will be used both **before** and **after** creating a VerifiablePresentation, we accept both _signed_ and _unsigned_ version of a presentation here. \n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `presentation` | `Presentation` | the Presentation object containing the required credentials and a `presentation_submission` object mapping back to the presentation definition |\n\n#### Return value\nIf evaluation is successful, `value` will be a non-null `PresentationSubmission` mapping the submitted credentials to the requested inputs.\n```typescript\ninterface EvaluationResults {\n  value?: PresentationSubmission;\n  warnings?: string[];\n  errors?: Error[];\n}\n```\n\n### SelectFrom\n```typescript\nselectFrom(presentationDefinition, credentials, holderDids)\n```\n##### Description\nGathers the matching credentials that fit a given presentation definition\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `credentials` | `VerifiableCredential[]` | the array of verifiable credentials to select from |\n| `holderDids` | `string[]` | the holder's dids. this can be found in VerifiablePresentation's holder property note that a wallet can have many holderDids retrieved from different places|\n\n#### Return value\n- If the selection was successful or partially successful, the `matches` array will consist of `SubmissionRequirementMatch` object(s), representing the matching credentials for each `SubmissionRequirement` in the `presentationDefinition` input parameter.\n- If the selection was not successful, the `errors` array will consist of `Checked` object(s), representing what has failed in your selection process.\n\n```typescript\nimport { Status } from './ConstraintUtils';\n\ninterface SelectResults {\n  errors?: Checked[];\n  matches?: SubmissionRequirementMatch[];\n  /**\n   * This is the parameter that pejs library user should look into to determine what to do next\n   * Status can have three values:\n   *  1. INFO: everything is fine, you can call `presentationFrom` after this method\n   *  2. WARN: method was called with more credentials than required. \n   *       To enhance credential holder's privacy it is recommended to select credentials which are absolutely required.\n   *  3. Error: the credentials you've sent didn't satisfy the requirement defined presentationDefinition object\n   */\n  areRequiredCredentialsPresent: Status;\n  /**\n   * All matched/selectable credentials\n   */\n  selectableVerifiableCredentials?: VerifiableCredential[];\n  /**\n   * Following are indexes of the verifiableCredentials passed to the selectFrom method that have been selected.\n   */\n  vcIndexes?: number[];\n  warnings?: Checked[];\n}\n\ninterface SubmissionRequirementMatch {\n  name?: string;\n  rule: Rules;\n  min?: number;\n  count?: number;\n  max?: number;\n  matches: string[];\n  from?: string[];\n  from_nested?: SubmissionRequirementMatch[]; // VerifiableCredential Address\n}\n```\n\n### PresentationFrom\n```typescript\npresentationFrom(presentationDefinition, selectedCredentials, holderDID)\n```\n##### Description\nCreates the corresponding Presentation Submission object to be included in the Verifiable Presentation response, which maps the submitted credentials to the requested inputs in the `presentationDefinition` input parameter.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `selectedCredentials` | `VerifiableCredential[]` | the array of verifiable credentials that meet the submission requirements in the presentation definition |\n| `holderDid` | `string` | the holder's DID. This can be found in VerifiablePresentation's holder property note that a wallet can have many holderDIDs retrieved from different places|\n\n#### Return value\nIf the selected credentials successfully match the submission requirements in the presentation definition, the return value will be a non-null `PresentationSubmission`\n```typescript\ninterface PresentationSubmission {\n  id?: string;\n  definition_id: string;\n  descriptor_map: Descriptor[]\n}\n```\n\n### Validation\n```typescript\nvalidateDefinition(objToValidate)\n```\n```typescript\nvalidateSubmission(objToValidate)\n```\n#### Description\nA validation utility function for `PresentationDefinition` and `PresentationSubmission` objects.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `objToValidate` | <code>PresentationDefinition &#124; PresentationSubmission</code> | the presentation definition or presentation definition to be validated |\n\n#### Return value\nThe `validate` method returns a validated results array `NonEmptyArray<Checked>` , with structure:\n```typescript\ninterface Checked {\n  tag: string;\n  status: Status;\n  message?: string;\n}\n```\nstatus can have following values `'info' | 'warn' | 'error'`\n\n\n## Workflow Diagram\n![Flow diagram](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/Sphereon-Opensource/pe-js/develop/docs/simple-scenario.puml)\n# Glossary\n\nTerm | Definition |\n---- | ---------- |\nCredential | A set of one or more claims made by an issuer. |\nVerifiable Credential |  Is a tamper-evident credential that has authorship that can be cryptographically verified. Verifiable credentials can be used to build verifiable presentations, which can also be cryptographically verified. The claims in a credential can be about different subjects. |\nPresentation Definition | Presentation Definitions are objects that articulate what proofs a Verifier requires. |\nHolder | Holders are entities that have one or more verifiable credentials in their possession. Holders are also the entities that submit proofs to Verifiers to satisfy the requirements described in a Presentation Definition.\nHolder's Did | Unique ID URI string and PKI metadata document format for describing the cryptographic keys and other fundamental PKI values linked to a unique, user-controlled, self-sovereign identifier in holder's wallet|\nVerifier | Verifiers are entities that define what proofs they require from a Holder (via a Presentation Definition) in order to proceed with an interaction. |\nIssuer | A role an entity can perform by asserting claims about one or more subjects, creating a verifiable credential from these claims, and transmitting the verifiable credential to a holder. |\nPresentation | Data derived from one or more verifiable credentials, issued by one or more issuers |\nVerifiable Presentation | Is a tamper-evident presentation encoded in such a way that authorship of the data can be trusted after a process of cryptographic verification.\n\n## Further work:\n1. Implementation of presentation-exchange v2\n2. In the [DIF documentation](https://identity.foundation/presentation-exchange/#input-evaluation) some entries are addressing `nested credentials` and `nested paths` these are currently not fully support yet.\n","licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.4.2-unstable.4","dist":{"shasum":"5322f9c1570a1468485df8c0088acaff936fb2b3","integrity":"sha512-W1NN8NhDOOVryPlXJf6P9QqXDzeH9QdJew/Uafs772V/6C+CldrEdoVI6ZBeiY2zopANcdyZon3S55wF2s/h5w==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.4.2-unstable.4.tgz","fileCount":597,"unpackedSize":3189371,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhoWLiCRA9TVsSAnZWagAA7fAP/10nKDAHboWjh2RPBkmC\npcDCskDk+OmbaIdgnXm30AJLjZX/m0CaWLXpztUTG13wQsHHJO417z/GH/FS\nIMgszu3PBeqLdA7UTDktBQHFnAlw+VDj1Tk2EeE7m7fYNQeWW2aMdKhblqbK\n9bCJHwi5mUmsTPy6EHEgYtJiuaE5nbyBfqe78xFiSVX65Sd+WzGSnbFrd72d\nGs1iCNswiZCj+tcB2dB99PefV8sZoSJoF5PJF69uJnOFdNg+JH5NWWgOHO63\nO4daRcrsTyRvr2jBPRsKvj7BD0xOi8XbPAZT6xXjrY27YUttviojahdrJtpJ\nLpKUC0DMLE26ZlI0JTKYX5XesI3iFnovxBpuQygUYpxB+kxExpKArx/MwmwK\nqQzAxGvket5DwcJblRy349jaWR25Io7K7sx8nvVnb4opV2+auC/1ruvpkCDo\n7HCVF7FFmYHr9cxByXJzTQ3xBGh1H3m+Kn3TV2ZN46i4NPYEj7Lsdmddek0C\nLGoBQhuOP5vgQ1k3sczYUbK0zTpqa9djxWMjvDDWeeN9f5Y+y/FldJ/mWa/j\nVUXDrZ5sn1LctXhjwHAr5UVoSrb6L2un091043oGnusXsm7eQySx0SAah7rz\ncz0H0HXtS0Fk54LVQRcZtXNJ0j1pExgJoXLOdkh9j8PdokHDKMAFzPaf/714\n04l7\r\n=YrfY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFn8wKz7DCg6ytuqm/XoL8AOi5ECyaUV/1lcJiqqPuxoAiASg8NiIUtS0czOkBRM3lScCx+0p3MdMlO7C+ej+xUbeA=="}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.4.2-unstable.4_1637966562494_0.5566555452512401"},"_hasShrinkwrap":false},"0.4.2-unstable.5":{"name":"@sphereon/pe-js","version":"0.4.2-unstable.5","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","typings":"dist/main/index.d.ts","browser":"dist/browser/index.js","module":"dist/module/index.js","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosure","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build:browser":"tsc -p tsconfig.browser.json","build:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","rimraf":"^2.6.2","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":150},"readmeFilename":"README.md","readme":"<h1 align=\"center\">\n  <br>\n  <a href=\"https://www.sphereon.com\"><img src=\"https://sphereon.com/content/themes/sphereon/assets/img/logo.svg\" alt=\"Sphereon\" width=\"400\"></a>\n  <br>PE-JS   DIF Presentation Exchange JavaScript Library \n  <br>\n</h1>\n\n[![CI](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml/badge.svg)](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/Sphereon-Opensource/pe-js/branch/develop/graph/badge.svg?token=9P1JGUYA35)](https://codecov.io/gh/Sphereon-Opensource/pe-js) [![NPM Version](https://img.shields.io/npm/v/@sphereon/pe-js.svg)](https://npm.im/@sphereon/pe-js)\n\n## Active Development\n_IMPORTANT: This software still is in early development stage. As such you should expect breaking changes in APIs, we expect to keep that to a minimum though._\n\n## Background\n\nThe PE-JS Library is a general use presentation exchange library that implements the functionality described in the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/). It is written in Typescript and can be compiled to any target JavaScript version.\n\nSphereon's PE Library is useful for both verifier systems and holders (e.g. wallets) and can be used in client side browsers and mobile applications as well as on server side technology such as REST APIs (e.g. built with NodeJS). It allows anyone to add DIF Presentation Exchange logic to their existing wallets, or verifiers, without making any further assumptions about the technologies used in their products.\n\nThe presentation exchange operates generally as follows; The verifier creates a Presentation Definition asking for credentials from the holder. The definition for the credentials is sent to the holder, who returns a presentation as a response. Now the verifier will verify the presentation by checking the signature and other accompanying proofs. \n\nThe presentation exchange will ensure that the model used by the verifier, can be interpreted by the holder. It then ensures that the correct parts from the holders credentials are used to create the presentation. The PE contains all the logic to interpret the models, therefore removing the need for the verifier and holder to align their specific models.\n\nThe data objects (models) used in PE-JS are generated from Sphereon's DIF PE OpenAPI Spec component. The code for the component can be seen at [PE-OpenAPI github repository](https://github.com/Sphereon-Opensource/pe-openapi). This allows the generation of the objects in many languages and frameworks consistently by configuring the maven plugin.\n\n\n### The PE Library supports the following actions:\n\n * Creating a presentation definition / request\n * Validating a presentation definition / request to be as per specification\n * Creating a presentation submission\n * Validating a presentation submission when received\n * Input evaluations: Verification of presentation submissions to be as per presentation definition\n * Utilities: to build and use different models compliant with the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/).\n\nStateful storage or credential management should be implemented in separate libraries/ modules that make use of the underlying DIF Presentation Exchange implementation. By keeping these separate, the library will stay platform agnostic. \n\n## For PE-JS developers\n\nThis project has been created using:\n* `yarn` version 1.22.5\n* `node` version 12.22.1\n\n### Install\n```shell\nyarn install\n```\n### Build\n```shell\nyarn build\n```\n### Test\nThe test command runs:\n* `eslint`\n* `prettier`\n* `unit`\n\nYou can also run only a single section of these tests, using for example `yarn test:unit`.\n```shell\nyarn test\n```\n\n### Utility scripts\nThere are several other utility scripts that help with development.\n\n* `yarn fix` - runs `eslint --fix` as well as `prettier` to fix code style\n* `yarn cov` - generates code coverage report\n\n\n## For PE-JS Users\n\nThe library can be installed direction from npmjs via:\n\n```shell\n# install via yarn\nyarn add @sphereon/pe-js\n\n# install via npm\nnpm install @sphereon/pe-js\n```\n\nThe core functionality of the DIF Presentation Exchange can be outlined as follows:\n\n* Input Evaluation\n* Credential Query\n* Utilities\n\n#### Input Evaluation\nInput evaluation is the primary mechanism by which a verifier determines whether a presentation submission from a holder matches the requested presentation definition from the request.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  \"id\": \"32f54163-7166-48f1-93d8-ff217bdb0653\",\n  \"input_descriptors\": [\n    {\n      \"id\": \"wa_driver_license\",\n      \"name\": \"Washington State Business License\",\n      \"purpose\": \"We can only allow licensed Washington State business representatives into the WA Business Conference\",\n      \"schema\": [{\n        \"uri\": \"https://licenses.example.com/business-license.json\"\n      }]\n    }\n  ]\n};\n\nconst verifiablePresentation = {\n  '@context': [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  type: [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: {...},\n  verifiableCredential: [...],\n  proof: {...}\n}\n\nconst {value, warnings, errors} = pejs.evaluate(presentationDefinition, verifiablePresentation);\n```\n\n#### Credential Query\nA credential query allows holders to filter their set of credentials for matches to a given presentation definition.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\n// Definition from verifier request\nconst presentationDefinition = {\n  ...\n};\n\n// Example for loading credentials\nconst credentials = await secureStore.getCredentials();\n\n// Find matching credentials\nconst srMatches = pejs.selectFrom(presentationDefinition, credentials, holderDid);\n\n// An example that selects the first 'count' credentials from\n// the matches. in a real scenario, the user has to select what \n// to disclose\nconst selectedCredentials = srMatches.map(\n  ({matches, count}) => matches.slice(0, count)\n).flat();\n\n// Construct presentation submission from selected credentials\nconst presentationSubmission = pejs.presentationFrom(presentationDefinition, selectedCredentials, holderDID);\n\nconst presentation = {\n  \"@context\": [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  \"type\": [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: presentationSubmission,\n  verifiableCredential: selectedCredentials\n};\n\n// Presentation would be signed and sent to verifier\n```\n\n#### Utilities\nIn addition to the core functionality above, the underlying validation methods are exposed as low-level helper functions.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  ...\n};\n\nconst {warnings: pdWarnings, errors: pdErrors} = pejs.validateDefinition(presentationDefinition);\n\nconst presentationSubmission = {\n  ...\n};\n\nconst {warnings: psWarnings, errors: psErrors} = pejs.validateSubmission(presentationSubmission);\n```\n\n## API\n\n### Evaluate\n```typescript\nevaluate(presentationDefinition, verifiablePresentation)\n```\n##### Description\nEvaluates whether a presentation submission meets the requested presentation definition\nSince this method will be used both **before** and **after** creating a VerifiablePresentation, we accept both _signed_ and _unsigned_ version of a presentation here. \n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `presentation` | `Presentation` | the Presentation object containing the required credentials and a `presentation_submission` object mapping back to the presentation definition |\n\n#### Return value\nIf evaluation is successful, `value` will be a non-null `PresentationSubmission` mapping the submitted credentials to the requested inputs.\n```typescript\ninterface EvaluationResults {\n  value?: PresentationSubmission;\n  warnings?: string[];\n  errors?: Error[];\n}\n```\n\n### SelectFrom\n```typescript\nselectFrom(presentationDefinition, credentials, holderDids)\n```\n##### Description\nGathers the matching credentials that fit a given presentation definition\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `credentials` | `VerifiableCredential[]` | the array of verifiable credentials to select from |\n| `holderDids` | `string[]` | the holder's dids. this can be found in VerifiablePresentation's holder property note that a wallet can have many holderDids retrieved from different places|\n\n#### Return value\n- If the selection was successful or partially successful, the `matches` array will consist of `SubmissionRequirementMatch` object(s), representing the matching credentials for each `SubmissionRequirement` in the `presentationDefinition` input parameter.\n- If the selection was not successful, the `errors` array will consist of `Checked` object(s), representing what has failed in your selection process.\n\n```typescript\nimport { Status } from './ConstraintUtils';\n\ninterface SelectResults {\n  errors?: Checked[];\n  matches?: SubmissionRequirementMatch[];\n  /**\n   * This is the parameter that pejs library user should look into to determine what to do next\n   * Status can have three values:\n   *  1. INFO: everything is fine, you can call `presentationFrom` after this method\n   *  2. WARN: method was called with more credentials than required. \n   *       To enhance credential holder's privacy it is recommended to select credentials which are absolutely required.\n   *  3. Error: the credentials you've sent didn't satisfy the requirement defined presentationDefinition object\n   */\n  areRequiredCredentialsPresent: Status;\n  /**\n   * All matched/selectable credentials\n   */\n  selectableVerifiableCredentials?: VerifiableCredential[];\n  /**\n   * Following are indexes of the verifiableCredentials passed to the selectFrom method that have been selected.\n   */\n  vcIndexes?: number[];\n  warnings?: Checked[];\n}\n\ninterface SubmissionRequirementMatch {\n  name?: string;\n  rule: Rules;\n  min?: number;\n  count?: number;\n  max?: number;\n  matches: string[];\n  from?: string[];\n  from_nested?: SubmissionRequirementMatch[]; // VerifiableCredential Address\n}\n```\n\n### PresentationFrom\n```typescript\npresentationFrom(presentationDefinition, selectedCredentials, holderDID)\n```\n##### Description\nCreates the corresponding Presentation Submission object to be included in the Verifiable Presentation response, which maps the submitted credentials to the requested inputs in the `presentationDefinition` input parameter.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `selectedCredentials` | `VerifiableCredential[]` | the array of verifiable credentials that meet the submission requirements in the presentation definition |\n| `holderDid` | `string` | the holder's DID. This can be found in VerifiablePresentation's holder property note that a wallet can have many holderDIDs retrieved from different places|\n\n#### Return value\nIf the selected credentials successfully match the submission requirements in the presentation definition, the return value will be a non-null `PresentationSubmission`\n```typescript\ninterface PresentationSubmission {\n  id?: string;\n  definition_id: string;\n  descriptor_map: Descriptor[]\n}\n```\n\n### Validation\n```typescript\nvalidateDefinition(objToValidate)\n```\n```typescript\nvalidateSubmission(objToValidate)\n```\n#### Description\nA validation utility function for `PresentationDefinition` and `PresentationSubmission` objects.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `objToValidate` | <code>PresentationDefinition &#124; PresentationSubmission</code> | the presentation definition or presentation definition to be validated |\n\n#### Return value\nThe `validate` method returns a validated results array `NonEmptyArray<Checked>` , with structure:\n```typescript\ninterface Checked {\n  tag: string;\n  status: Status;\n  message?: string;\n}\n```\nstatus can have following values `'info' | 'warn' | 'error'`\n\n\n## Workflow Diagram\n![Flow diagram](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/Sphereon-Opensource/pe-js/develop/docs/simple-scenario.puml)\n# Glossary\n\nTerm | Definition |\n---- | ---------- |\nCredential | A set of one or more claims made by an issuer. |\nVerifiable Credential |  Is a tamper-evident credential that has authorship that can be cryptographically verified. Verifiable credentials can be used to build verifiable presentations, which can also be cryptographically verified. The claims in a credential can be about different subjects. |\nPresentation Definition | Presentation Definitions are objects that articulate what proofs a Verifier requires. |\nHolder | Holders are entities that have one or more verifiable credentials in their possession. Holders are also the entities that submit proofs to Verifiers to satisfy the requirements described in a Presentation Definition.\nHolder's Did | Unique ID URI string and PKI metadata document format for describing the cryptographic keys and other fundamental PKI values linked to a unique, user-controlled, self-sovereign identifier in holder's wallet|\nVerifier | Verifiers are entities that define what proofs they require from a Holder (via a Presentation Definition) in order to proceed with an interaction. |\nIssuer | A role an entity can perform by asserting claims about one or more subjects, creating a verifiable credential from these claims, and transmitting the verifiable credential to a holder. |\nPresentation | Data derived from one or more verifiable credentials, issued by one or more issuers |\nVerifiable Presentation | Is a tamper-evident presentation encoded in such a way that authorship of the data can be trusted after a process of cryptographic verification.\n\n## Further work:\n1. Implementation of presentation-exchange v2\n2. In the [DIF documentation](https://identity.foundation/presentation-exchange/#input-evaluation) some entries are addressing `nested credentials` and `nested paths` these are currently not fully support yet.\n","licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.4.2-unstable.5","dist":{"shasum":"36a3a62615e3e160db5c60b9472a45a501ed771d","integrity":"sha512-eoYVItHDd08vfHLB961UJbkK9Zw4nj/vvidbyEdVbLP6PvGLTWzZAvFz5InvwNBwGwyrrRdPrIjVZpQ03/KtdA==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.4.2-unstable.5.tgz","fileCount":597,"unpackedSize":3197325,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhoWdNCRA9TVsSAnZWagAAu/kP/2nUt9acAh/cfTuecVYp\nGVLAQALxB1Y6ma6T4gtbJ2E0ahAem5lpkBF8ZmNbFj+I6yWNMvYoQ0AUBgpq\nhWeFe3W3kOmPn/vQtyC/dg7u4l6vo92Cts7MCv80TeAIr8ffLJ0Yu/1nwpLk\n9oHOwGn6haTFv5DGKRJpjPD/2hm1o/rF75JY6W9SNNNQ49kNRg8JCWRySsUZ\nHEy710as0VQ8M325nh1t70Qednk4hcVwlUTAm2K+O1lcZ1Kf/Mora/QrlU4A\n9zG2pPNGaW582Qm4ifrymfPZGoGWO4F02nqmvIPIXSztCGKXPqWZNgIAVDrm\nGyMJ26Ou257TKdzYgzB8a575DyXtPQhsevjBj190VLC0OlRydetLHenBPmTM\n1hxm58ishhwX5io28hCTf6RgKWK0R0eE0nS7/3DWBDajJ9Oomv6S0l8cstpS\nzrOKtdwHMBYelCL3utvWTYjXjZ+OVr2vyn+mlqehMoRRmk3vQhY7HpwW+Jpu\nULidcvCNfU01hZzlxSM6VSEILPwuhkws9rSnMU/fya5+Ibs/WDI5tg9gIZ1D\nimi18voS/0krHzyC93fvMZ+mWGMWnWl8b/JzLsK2yjtTXhyvMe++W8ubhdkE\n0Z0YufqP7lhzVI8Vsp2WUcZXDYGfbEJlp7pDbElxvcCMMjxb82+luE9F7Oq2\nxsS2\r\n=mLNQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEwYMmZG7l8a5ZE7UAao56VSGLiYGM1RT4HEsOQChaH3AiBbd0k8RZjqyTm7O7DxmmPXATIqBGRkCNv1kvganx5OoQ=="}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.4.2-unstable.5_1637967692954_0.9736408560678953"},"_hasShrinkwrap":false},"0.4.2-unstable.6":{"name":"@sphereon/pe-js","version":"0.4.2-unstable.6","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","typings":"dist/main/index.d.ts","browser":"dist/browser/index.js","module":"dist/module/index.js","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosure","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build:browser":"tsc -p tsconfig.browser.json","build:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","rimraf":"^2.6.2","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":150},"readmeFilename":"README.md","readme":"<h1 align=\"center\">\n  <br>\n  <a href=\"https://www.sphereon.com\"><img src=\"https://sphereon.com/content/themes/sphereon/assets/img/logo.svg\" alt=\"Sphereon\" width=\"400\"></a>\n  <br>PE-JS   DIF Presentation Exchange JavaScript Library \n  <br>\n</h1>\n\n[![CI](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml/badge.svg)](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/Sphereon-Opensource/pe-js/branch/develop/graph/badge.svg?token=9P1JGUYA35)](https://codecov.io/gh/Sphereon-Opensource/pe-js) [![NPM Version](https://img.shields.io/npm/v/@sphereon/pe-js.svg)](https://npm.im/@sphereon/pe-js)\n\n## Active Development\n_IMPORTANT: This software still is in early development stage. As such you should expect breaking changes in APIs, we expect to keep that to a minimum though._\n\n## Background\n\nThe PE-JS Library is a general use presentation exchange library that implements the functionality described in the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/). It is written in Typescript and can be compiled to any target JavaScript version.\n\nSphereon's PE Library is useful for both verifier systems and holders (e.g. wallets) and can be used in client side browsers and mobile applications as well as on server side technology such as REST APIs (e.g. built with NodeJS). It allows anyone to add DIF Presentation Exchange logic to their existing wallets, or verifiers, without making any further assumptions about the technologies used in their products.\n\nThe presentation exchange operates generally as follows; The verifier creates a Presentation Definition asking for credentials from the holder. The definition for the credentials is sent to the holder, who returns a presentation as a response. Now the verifier will verify the presentation by checking the signature and other accompanying proofs. \n\nThe presentation exchange will ensure that the model used by the verifier, can be interpreted by the holder. It then ensures that the correct parts from the holders credentials are used to create the presentation. The PE contains all the logic to interpret the models, therefore removing the need for the verifier and holder to align their specific models.\n\nThe data objects (models) used in PE-JS are generated from Sphereon's DIF PE OpenAPI Spec component. The code for the component can be seen at [PE-OpenAPI github repository](https://github.com/Sphereon-Opensource/pe-openapi). This allows the generation of the objects in many languages and frameworks consistently by configuring the maven plugin.\n\n\n### The PE Library supports the following actions:\n\n * Creating a presentation definition / request\n * Validating a presentation definition / request to be as per specification\n * Creating a presentation submission\n * Validating a presentation submission when received\n * Input evaluations: Verification of presentation submissions to be as per presentation definition\n * Utilities: to build and use different models compliant with the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/).\n\nStateful storage or credential management should be implemented in separate libraries/ modules that make use of the underlying DIF Presentation Exchange implementation. By keeping these separate, the library will stay platform agnostic. \n\n## For PE-JS developers\n\nThis project has been created using:\n* `yarn` version 1.22.5\n* `node` version 12.22.1\n\n### Install\n```shell\nyarn install\n```\n### Build\n```shell\nyarn build\n```\n### Test\nThe test command runs:\n* `eslint`\n* `prettier`\n* `unit`\n\nYou can also run only a single section of these tests, using for example `yarn test:unit`.\n```shell\nyarn test\n```\n\n### Utility scripts\nThere are several other utility scripts that help with development.\n\n* `yarn fix` - runs `eslint --fix` as well as `prettier` to fix code style\n* `yarn cov` - generates code coverage report\n\n\n## For PE-JS Users\n\nThe library can be installed direction from npmjs via:\n\n```shell\n# install via yarn\nyarn add @sphereon/pe-js\n\n# install via npm\nnpm install @sphereon/pe-js\n```\n\nThe core functionality of the DIF Presentation Exchange can be outlined as follows:\n\n* Input Evaluation\n* Credential Query\n* Utilities\n\n#### Input Evaluation\nInput evaluation is the primary mechanism by which a verifier determines whether a presentation submission from a holder matches the requested presentation definition from the request.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  \"id\": \"32f54163-7166-48f1-93d8-ff217bdb0653\",\n  \"input_descriptors\": [\n    {\n      \"id\": \"wa_driver_license\",\n      \"name\": \"Washington State Business License\",\n      \"purpose\": \"We can only allow licensed Washington State business representatives into the WA Business Conference\",\n      \"schema\": [{\n        \"uri\": \"https://licenses.example.com/business-license.json\"\n      }]\n    }\n  ]\n};\n\nconst verifiablePresentation = {\n  '@context': [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  type: [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: {...},\n  verifiableCredential: [...],\n  proof: {...}\n}\n\nconst {value, warnings, errors} = pejs.evaluate(presentationDefinition, verifiablePresentation);\n```\n\n#### Credential Query\nA credential query allows holders to filter their set of credentials for matches to a given presentation definition.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\n// Definition from verifier request\nconst presentationDefinition = {\n  ...\n};\n\n// Example for loading credentials\nconst credentials = await secureStore.getCredentials();\n\n// Find matching credentials\nconst srMatches = pejs.selectFrom(presentationDefinition, credentials, holderDid);\n\n// An example that selects the first 'count' credentials from\n// the matches. in a real scenario, the user has to select what \n// to disclose\nconst selectedCredentials = srMatches.map(\n  ({matches, count}) => matches.slice(0, count)\n).flat();\n\n// Construct presentation submission from selected credentials\nconst presentationSubmission = pejs.presentationFrom(presentationDefinition, selectedCredentials, holderDID);\n\nconst presentation = {\n  \"@context\": [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  \"type\": [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: presentationSubmission,\n  verifiableCredential: selectedCredentials\n};\n\n// Presentation would be signed and sent to verifier\n```\n\n#### Utilities\nIn addition to the core functionality above, the underlying validation methods are exposed as low-level helper functions.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  ...\n};\n\nconst {warnings: pdWarnings, errors: pdErrors} = pejs.validateDefinition(presentationDefinition);\n\nconst presentationSubmission = {\n  ...\n};\n\nconst {warnings: psWarnings, errors: psErrors} = pejs.validateSubmission(presentationSubmission);\n```\n\n## API\n\n### Evaluate\n```typescript\nevaluate(presentationDefinition, verifiablePresentation)\n```\n##### Description\nEvaluates whether a presentation submission meets the requested presentation definition\nSince this method will be used both **before** and **after** creating a VerifiablePresentation, we accept both _signed_ and _unsigned_ version of a presentation here. \n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `presentation` | `Presentation` | the Presentation object containing the required credentials and a `presentation_submission` object mapping back to the presentation definition |\n\n#### Return value\nIf evaluation is successful, `value` will be a non-null `PresentationSubmission` mapping the submitted credentials to the requested inputs.\n```typescript\ninterface EvaluationResults {\n  value?: PresentationSubmission;\n  warnings?: string[];\n  errors?: Error[];\n}\n```\n\n### SelectFrom\n```typescript\nselectFrom(presentationDefinition, credentials, holderDids)\n```\n##### Description\nGathers the matching credentials that fit a given presentation definition\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `credentials` | `VerifiableCredential[]` | the array of verifiable credentials to select from |\n| `holderDids` | `string[]` | the holder's dids. this can be found in VerifiablePresentation's holder property note that a wallet can have many holderDids retrieved from different places|\n\n#### Return value\n- If the selection was successful or partially successful, the `matches` array will consist of `SubmissionRequirementMatch` object(s), representing the matching credentials for each `SubmissionRequirement` in the `presentationDefinition` input parameter.\n- If the selection was not successful, the `errors` array will consist of `Checked` object(s), representing what has failed in your selection process.\n\n```typescript\nimport { Status } from './ConstraintUtils';\n\ninterface SelectResults {\n  errors?: Checked[];\n  matches?: SubmissionRequirementMatch[];\n  /**\n   * This is the parameter that pejs library user should look into to determine what to do next\n   * Status can have three values:\n   *  1. INFO: everything is fine, you can call `presentationFrom` after this method\n   *  2. WARN: method was called with more credentials than required. \n   *       To enhance credential holder's privacy it is recommended to select credentials which are absolutely required.\n   *  3. Error: the credentials you've sent didn't satisfy the requirement defined presentationDefinition object\n   */\n  areRequiredCredentialsPresent: Status;\n  /**\n   * All matched/selectable credentials\n   */\n  selectableVerifiableCredentials?: VerifiableCredential[];\n  /**\n   * Following are indexes of the verifiableCredentials passed to the selectFrom method that have been selected.\n   */\n  vcIndexes?: number[];\n  warnings?: Checked[];\n}\n\ninterface SubmissionRequirementMatch {\n  name?: string;\n  rule: Rules;\n  min?: number;\n  count?: number;\n  max?: number;\n  matches: string[];\n  from?: string[];\n  from_nested?: SubmissionRequirementMatch[]; // VerifiableCredential Address\n}\n```\n\n### PresentationFrom\n```typescript\npresentationFrom(presentationDefinition, selectedCredentials, holderDID)\n```\n##### Description\nCreates the corresponding Presentation Submission object to be included in the Verifiable Presentation response, which maps the submitted credentials to the requested inputs in the `presentationDefinition` input parameter.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `selectedCredentials` | `VerifiableCredential[]` | the array of verifiable credentials that meet the submission requirements in the presentation definition |\n| `holderDid` | `string` | the holder's DID. This can be found in VerifiablePresentation's holder property note that a wallet can have many holderDIDs retrieved from different places|\n\n#### Return value\nIf the selected credentials successfully match the submission requirements in the presentation definition, the return value will be a non-null `PresentationSubmission`\n```typescript\ninterface PresentationSubmission {\n  id?: string;\n  definition_id: string;\n  descriptor_map: Descriptor[]\n}\n```\n\n### Validation\n```typescript\nvalidateDefinition(objToValidate)\n```\n```typescript\nvalidateSubmission(objToValidate)\n```\n#### Description\nA validation utility function for `PresentationDefinition` and `PresentationSubmission` objects.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `objToValidate` | <code>PresentationDefinition &#124; PresentationSubmission</code> | the presentation definition or presentation definition to be validated |\n\n#### Return value\nThe `validate` method returns a validated results array `NonEmptyArray<Checked>` , with structure:\n```typescript\ninterface Checked {\n  tag: string;\n  status: Status;\n  message?: string;\n}\n```\nstatus can have following values `'info' | 'warn' | 'error'`\n\n\n## Workflow Diagram\n![Flow diagram](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/Sphereon-Opensource/pe-js/develop/docs/simple-scenario.puml)\n# Glossary\n\nTerm | Definition |\n---- | ---------- |\nCredential | A set of one or more claims made by an issuer. |\nVerifiable Credential |  Is a tamper-evident credential that has authorship that can be cryptographically verified. Verifiable credentials can be used to build verifiable presentations, which can also be cryptographically verified. The claims in a credential can be about different subjects. |\nPresentation Definition | Presentation Definitions are objects that articulate what proofs a Verifier requires. |\nHolder | Holders are entities that have one or more verifiable credentials in their possession. Holders are also the entities that submit proofs to Verifiers to satisfy the requirements described in a Presentation Definition.\nHolder's Did | Unique ID URI string and PKI metadata document format for describing the cryptographic keys and other fundamental PKI values linked to a unique, user-controlled, self-sovereign identifier in holder's wallet|\nVerifier | Verifiers are entities that define what proofs they require from a Holder (via a Presentation Definition) in order to proceed with an interaction. |\nIssuer | A role an entity can perform by asserting claims about one or more subjects, creating a verifiable credential from these claims, and transmitting the verifiable credential to a holder. |\nPresentation | Data derived from one or more verifiable credentials, issued by one or more issuers |\nVerifiable Presentation | Is a tamper-evident presentation encoded in such a way that authorship of the data can be trusted after a process of cryptographic verification.\n\n## Further work:\n1. Implementation of presentation-exchange v2\n2. In the [DIF documentation](https://identity.foundation/presentation-exchange/#input-evaluation) some entries are addressing `nested credentials` and `nested paths` these are currently not fully support yet.\n","licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.4.2-unstable.6","dist":{"shasum":"b1a07d8ba7a0d66bee43998c940a7a22bfcead57","integrity":"sha512-0iaOnmftT8jQMxRYq87MSWYOhoFJUQOmDCZWal/rI36jwELFwwLLlRFu0BQlqIoV91xmeQNRuTosvxCNv7vYcQ==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.4.2-unstable.6.tgz","fileCount":597,"unpackedSize":3199780,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhoXc3CRA9TVsSAnZWagAA63gP/28vksUD9U9ErCtriOjB\nquAscrl1LTk4TkSHMkPjy0MZYcy/G9nF/mSd4kTMTf+meXZ7qcTg7TKLyG3t\nsf3/tuJv908VYc2ay/QRKaebLf5dq8aBNecvjJvqavMz56Ad2soDFM4PWPBu\n3obYrQ3ywHzHrolSswoQeqDvJWvNjrzuuxvtxeMa7NCB2nQwIqofYX4ad4um\n6P5VEI6IxqaZmXYahQjeZcCxwHZCMwmzhEWcoBD+MOKPnY00bnfvieKep9/U\nbhcKYla11v1RX32PjHP466abydMHZ9cGtUz5Jm754QUffrWh+oN/9S+BJvV5\nA+JSxuNe0H1UyjL/xC0EEkfqa7fPiTcRFphZZaOnmmE5wbbHqmtdIijxqRMU\nw9GIl/95B+gNm2DAJo2WjnbZHJhFW/SvXdxKSvFDqPgs1PnBcWS/tPquAhcC\nGJuXjPOpoK4JZ3FNcKPYG8sdM48PU+YcjVnW9PdhjNStqLCYLSsYg66wDi9G\n46xpE3+Ub+6tgYmqKn+4tUUQYZqsX6DTZHr0c8aBT3qMBYPqrzztXfKwAWbo\nuTtalLuPJLbJkzyfsxPkcyMg21+D2b/YBGpWrBAw4G2SdrN5EoENMSBjcVhc\nUupbVqL9e+BgVtvo4dZXqlF55N0Bs+sTiuxkkaD/Ag8tSo7mV1wxMaZ/zDZg\nDW/C\r\n=bsGI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA+s6x+R7PdrfEjxikGue+2gZ8RwT1PCmlFqKLJgRk/FAiAmfivRkZ2Ol8/C6WgIYjE3JvaTJZj8wpxVUHK9rKWR5A=="}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.4.2-unstable.6_1637971767152_0.1539400211669819"},"_hasShrinkwrap":false},"0.4.2-unstable.7":{"name":"@sphereon/pe-js","version":"0.4.2-unstable.7","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","typings":"dist/main/index.d.ts","browser":"dist/browser/index.js","module":"dist/module/index.js","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosure","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build:browser":"tsc -p tsconfig.browser.json","build:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","rimraf":"^2.6.2","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":150},"readmeFilename":"README.md","readme":"<h1 align=\"center\">\n  <br>\n  <a href=\"https://www.sphereon.com\"><img src=\"https://sphereon.com/content/themes/sphereon/assets/img/logo.svg\" alt=\"Sphereon\" width=\"400\"></a>\n  <br>PE-JS   DIF Presentation Exchange JavaScript Library \n  <br>\n</h1>\n\n[![CI](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml/badge.svg)](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/Sphereon-Opensource/pe-js/branch/develop/graph/badge.svg?token=9P1JGUYA35)](https://codecov.io/gh/Sphereon-Opensource/pe-js) [![NPM Version](https://img.shields.io/npm/v/@sphereon/pe-js.svg)](https://npm.im/@sphereon/pe-js)\n\n## Active Development\n_IMPORTANT: This software still is in early development stage. As such you should expect breaking changes in APIs, we expect to keep that to a minimum though._\n\n## Background\n\nThe PE-JS Library is a general use presentation exchange library that implements the functionality described in the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/). It is written in Typescript and can be compiled to any target JavaScript version.\n\nSphereon's PE Library is useful for both verifier systems and holders (e.g. wallets) and can be used in client side browsers and mobile applications as well as on server side technology such as REST APIs (e.g. built with NodeJS). It allows anyone to add DIF Presentation Exchange logic to their existing wallets, or verifiers, without making any further assumptions about the technologies used in their products.\n\nThe presentation exchange operates generally as follows; The verifier creates a Presentation Definition asking for credentials from the holder. The definition for the credentials is sent to the holder, who returns a presentation as a response. Now the verifier will verify the presentation by checking the signature and other accompanying proofs. \n\nThe presentation exchange will ensure that the model used by the verifier, can be interpreted by the holder. It then ensures that the correct parts from the holders credentials are used to create the presentation. The PE contains all the logic to interpret the models, therefore removing the need for the verifier and holder to align their specific models.\n\nThe data objects (models) used in PE-JS are generated from Sphereon's DIF PE OpenAPI Spec component. The code for the component can be seen at [PE-OpenAPI github repository](https://github.com/Sphereon-Opensource/pe-openapi). This allows the generation of the objects in many languages and frameworks consistently by configuring the maven plugin.\n\n\n### The PE Library supports the following actions:\n\n * Creating a presentation definition / request\n * Validating a presentation definition / request to be as per specification\n * Creating a presentation submission\n * Validating a presentation submission when received\n * Input evaluations: Verification of presentation submissions to be as per presentation definition\n * Utilities: to build and use different models compliant with the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/).\n\nStateful storage or credential management should be implemented in separate libraries/ modules that make use of the underlying DIF Presentation Exchange implementation. By keeping these separate, the library will stay platform agnostic. \n\n## For PE-JS developers\n\nThis project has been created using:\n* `yarn` version 1.22.5\n* `node` version 12.22.1\n\n### Install\n```shell\nyarn install\n```\n### Build\n```shell\nyarn build\n```\n### Test\nThe test command runs:\n* `eslint`\n* `prettier`\n* `unit`\n\nYou can also run only a single section of these tests, using for example `yarn test:unit`.\n```shell\nyarn test\n```\n\n### Utility scripts\nThere are several other utility scripts that help with development.\n\n* `yarn fix` - runs `eslint --fix` as well as `prettier` to fix code style\n* `yarn cov` - generates code coverage report\n\n\n## For PE-JS Users\n\nThe library can be installed direction from npmjs via:\n\n```shell\n# install via yarn\nyarn add @sphereon/pe-js\n\n# install via npm\nnpm install @sphereon/pe-js\n```\n\nThe core functionality of the DIF Presentation Exchange can be outlined as follows:\n\n* Input Evaluation\n* Credential Query\n* Utilities\n\n#### Input Evaluation\nInput evaluation is the primary mechanism by which a verifier determines whether a presentation submission from a holder matches the requested presentation definition from the request.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  \"id\": \"32f54163-7166-48f1-93d8-ff217bdb0653\",\n  \"input_descriptors\": [\n    {\n      \"id\": \"wa_driver_license\",\n      \"name\": \"Washington State Business License\",\n      \"purpose\": \"We can only allow licensed Washington State business representatives into the WA Business Conference\",\n      \"schema\": [{\n        \"uri\": \"https://licenses.example.com/business-license.json\"\n      }]\n    }\n  ]\n};\n\nconst verifiablePresentation = {\n  '@context': [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  type: [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: {...},\n  verifiableCredential: [...],\n  proof: {...}\n}\n\nconst {value, warnings, errors} = pejs.evaluate(presentationDefinition, verifiablePresentation);\n```\n\n#### Credential Query\nA credential query allows holders to filter their set of credentials for matches to a given presentation definition.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\n// Definition from verifier request\nconst presentationDefinition = {\n  ...\n};\n\n// Example for loading credentials\nconst credentials = await secureStore.getCredentials();\n\n// Find matching credentials\nconst srMatches = pejs.selectFrom(presentationDefinition, credentials, holderDid);\n\n// An example that selects the first 'count' credentials from\n// the matches. in a real scenario, the user has to select what \n// to disclose\nconst selectedCredentials = srMatches.map(\n  ({matches, count}) => matches.slice(0, count)\n).flat();\n\n// Construct presentation submission from selected credentials\nconst presentationSubmission = pejs.presentationFrom(presentationDefinition, selectedCredentials, holderDID);\n\nconst presentation = {\n  \"@context\": [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  \"type\": [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: presentationSubmission,\n  verifiableCredential: selectedCredentials\n};\n\n// Presentation would be signed and sent to verifier\n```\n\n#### Utilities\nIn addition to the core functionality above, the underlying validation methods are exposed as low-level helper functions.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  ...\n};\n\nconst {warnings: pdWarnings, errors: pdErrors} = pejs.validateDefinition(presentationDefinition);\n\nconst presentationSubmission = {\n  ...\n};\n\nconst {warnings: psWarnings, errors: psErrors} = pejs.validateSubmission(presentationSubmission);\n```\n\n## API\n\n### Evaluate\n```typescript\nevaluate(presentationDefinition, verifiablePresentation)\n```\n##### Description\nEvaluates whether a presentation submission meets the requested presentation definition\nSince this method will be used both **before** and **after** creating a VerifiablePresentation, we accept both _signed_ and _unsigned_ version of a presentation here. \n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `presentation` | `Presentation` | the Presentation object containing the required credentials and a `presentation_submission` object mapping back to the presentation definition |\n\n#### Return value\nIf evaluation is successful, `value` will be a non-null `PresentationSubmission` mapping the submitted credentials to the requested inputs.\n```typescript\ninterface EvaluationResults {\n  value?: PresentationSubmission;\n  warnings?: string[];\n  errors?: Error[];\n}\n```\n\n### SelectFrom\n```typescript\nselectFrom(presentationDefinition, credentials, holderDids)\n```\n##### Description\nGathers the matching credentials that fit a given presentation definition\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `credentials` | `VerifiableCredential[]` | the array of verifiable credentials to select from |\n| `holderDids` | `string[]` | the holder's dids. this can be found in VerifiablePresentation's holder property note that a wallet can have many holderDids retrieved from different places|\n\n#### Return value\n- If the selection was successful or partially successful, the `matches` array will consist of `SubmissionRequirementMatch` object(s), representing the matching credentials for each `SubmissionRequirement` in the `presentationDefinition` input parameter.\n- If the selection was not successful, the `errors` array will consist of `Checked` object(s), representing what has failed in your selection process.\n\n```typescript\nimport { Status } from './ConstraintUtils';\n\ninterface SelectResults {\n  errors?: Checked[];\n  matches?: SubmissionRequirementMatch[];\n  /**\n   * This is the parameter that pejs library user should look into to determine what to do next\n   * Status can have three values:\n   *  1. INFO: everything is fine, you can call `presentationFrom` after this method\n   *  2. WARN: method was called with more credentials than required. \n   *       To enhance credential holder's privacy it is recommended to select credentials which are absolutely required.\n   *  3. Error: the credentials you've sent didn't satisfy the requirement defined presentationDefinition object\n   */\n  areRequiredCredentialsPresent: Status;\n  /**\n   * All matched/selectable credentials\n   */\n  selectableVerifiableCredentials?: VerifiableCredential[];\n  /**\n   * Following are indexes of the verifiableCredentials passed to the selectFrom method that have been selected.\n   */\n  vcIndexes?: number[];\n  warnings?: Checked[];\n}\n\ninterface SubmissionRequirementMatch {\n  name?: string;\n  rule: Rules;\n  min?: number;\n  count?: number;\n  max?: number;\n  matches: string[];\n  from?: string[];\n  from_nested?: SubmissionRequirementMatch[]; // VerifiableCredential Address\n}\n```\n\n### PresentationFrom\n```typescript\npresentationFrom(presentationDefinition, selectedCredentials, holderDID)\n```\n##### Description\nCreates the corresponding Presentation Submission object to be included in the Verifiable Presentation response, which maps the submitted credentials to the requested inputs in the `presentationDefinition` input parameter.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `selectedCredentials` | `VerifiableCredential[]` | the array of verifiable credentials that meet the submission requirements in the presentation definition |\n| `holderDid` | `string` | the holder's DID. This can be found in VerifiablePresentation's holder property note that a wallet can have many holderDIDs retrieved from different places|\n\n#### Return value\nIf the selected credentials successfully match the submission requirements in the presentation definition, the return value will be a non-null `PresentationSubmission`\n```typescript\ninterface PresentationSubmission {\n  id?: string;\n  definition_id: string;\n  descriptor_map: Descriptor[]\n}\n```\n\n### Validation\n```typescript\nvalidateDefinition(objToValidate)\n```\n```typescript\nvalidateSubmission(objToValidate)\n```\n#### Description\nA validation utility function for `PresentationDefinition` and `PresentationSubmission` objects.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `objToValidate` | <code>PresentationDefinition &#124; PresentationSubmission</code> | the presentation definition or presentation definition to be validated |\n\n#### Return value\nThe `validate` method returns a validated results array `NonEmptyArray<Checked>` , with structure:\n```typescript\ninterface Checked {\n  tag: string;\n  status: Status;\n  message?: string;\n}\n```\nstatus can have following values `'info' | 'warn' | 'error'`\n\n\n## Workflow Diagram\n![Flow diagram](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/Sphereon-Opensource/pe-js/develop/docs/simple-scenario.puml)\n# Glossary\n\nTerm | Definition |\n---- | ---------- |\nCredential | A set of one or more claims made by an issuer. |\nVerifiable Credential |  Is a tamper-evident credential that has authorship that can be cryptographically verified. Verifiable credentials can be used to build verifiable presentations, which can also be cryptographically verified. The claims in a credential can be about different subjects. |\nPresentation Definition | Presentation Definitions are objects that articulate what proofs a Verifier requires. |\nHolder | Holders are entities that have one or more verifiable credentials in their possession. Holders are also the entities that submit proofs to Verifiers to satisfy the requirements described in a Presentation Definition.\nHolder's Did | Unique ID URI string and PKI metadata document format for describing the cryptographic keys and other fundamental PKI values linked to a unique, user-controlled, self-sovereign identifier in holder's wallet|\nVerifier | Verifiers are entities that define what proofs they require from a Holder (via a Presentation Definition) in order to proceed with an interaction. |\nIssuer | A role an entity can perform by asserting claims about one or more subjects, creating a verifiable credential from these claims, and transmitting the verifiable credential to a holder. |\nPresentation | Data derived from one or more verifiable credentials, issued by one or more issuers |\nVerifiable Presentation | Is a tamper-evident presentation encoded in such a way that authorship of the data can be trusted after a process of cryptographic verification.\n\n## Further work:\n1. Implementation of presentation-exchange v2\n2. In the [DIF documentation](https://identity.foundation/presentation-exchange/#input-evaluation) some entries are addressing `nested credentials` and `nested paths` these are currently not fully support yet.\n","licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.4.2-unstable.7","dist":{"shasum":"5944206cbc58d28eabfd1c8cdd8472085b3c63f6","integrity":"sha512-4t+LQZ0Jaz0i8QWEpdobS9LoAte0q4CgLSB+hnnsrTJ02+5b5QK2Y1fvbfwy52ktN7Sxl18end0i+gFSrHYr+g==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.4.2-unstable.7.tgz","fileCount":597,"unpackedSize":3192710,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhoXofCRA9TVsSAnZWagAANqwP/0mNzqQdXbI7ILO93Pol\nCsGXlzerTjAWcQElSQrobctN1gFlyYeOLIKBfwsqoVVe8E/plN/D1Nxb51yT\nH/aeVPcXEu/W6qy+Z8co4hPB09cZDgbDFboxDOTwdEbIDdy1ilOycZ4I+Hqk\ni6EcMutQKAaQc1ow2piAIOQeVt97Yb6zajYAymuF5nyXxbfIPeqURlUyVKS1\nIE+H7c03yOQOsOFy2WE1UZtf2cUKd/4Osi6+bQCdKIt5pzADEuqQNcsrrW4X\nAjEQ+m8DVo+uz/2IRK0TNxp68pZwanm4lYSbhBB00hr0ts9kbzMs/+JC/YlF\nbHAQH+czqfQYHe04/tYi6P4FJf2JW5Kvytj3oWC7aCewEONTAZvp7gqe+nWB\nWbdbyJ88A627qdw+J4v/slVCffL+mpYf6N6mu6sPk7aqWiazHNAbWZp5f5d0\nDwHAO7rEAmEudqCa53VhXLiSa/bVKaj1jiSd1WzAKXCSr7RD8/nUU2p1Mf8j\nML2X/EP/4gQ6sWSc13di89tmwWujqnxUeTorYtKN+tLRrSInbMwSLBR1d1xq\nGuIQe/GPkANSBsk95leTfM2jxes6oGeQkOksFqAA26UG8MezoO4birOqcHok\n7zhhtZyfMUzSSLvVqdhgByoujtOarmqFtY8zwik3Xf7cBzl+G1dFAvNJbHN2\ntMfU\r\n=FyNh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCZ5W2sQ5zuBJTh7fvvDio0qPZ5K29C7Db9zybS+gfAjwIhAMyMyf7d5yuw3RbPrbOXMpn27xvy8eBWtrX4nYJpAav4"}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.4.2-unstable.7_1637972511023_0.5471392550898075"},"_hasShrinkwrap":false},"0.4.2-unstable.8":{"name":"@sphereon/pe-js","version":"0.4.2-unstable.8","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","typings":"dist/main/index.d.ts","browser":"dist/browser/index.js","module":"dist/module/index.js","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosure","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build:browser":"tsc -p tsconfig.browser.json","build:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","rimraf":"^2.6.2","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":150},"readmeFilename":"README.md","readme":"<h1 align=\"center\">\n  <br>\n  <a href=\"https://www.sphereon.com\"><img src=\"https://sphereon.com/content/themes/sphereon/assets/img/logo.svg\" alt=\"Sphereon\" width=\"400\"></a>\n  <br>PE-JS   DIF Presentation Exchange JavaScript Library \n  <br>\n</h1>\n\n[![CI](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml/badge.svg)](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/Sphereon-Opensource/pe-js/branch/develop/graph/badge.svg?token=9P1JGUYA35)](https://codecov.io/gh/Sphereon-Opensource/pe-js) [![NPM Version](https://img.shields.io/npm/v/@sphereon/pe-js.svg)](https://npm.im/@sphereon/pe-js)\n\n## Active Development\n_IMPORTANT: This software still is in early development stage. As such you should expect breaking changes in APIs, we expect to keep that to a minimum though._\n\n## Background\n\nThe PE-JS Library is a general use presentation exchange library that implements the functionality described in the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/). It is written in Typescript and can be compiled to any target JavaScript version.\n\nSphereon's PE Library is useful for both verifier systems and holders (e.g. wallets) and can be used in client side browsers and mobile applications as well as on server side technology such as REST APIs (e.g. built with NodeJS). It allows anyone to add DIF Presentation Exchange logic to their existing wallets, or verifiers, without making any further assumptions about the technologies used in their products.\n\nThe presentation exchange operates generally as follows; The verifier creates a Presentation Definition asking for credentials from the holder. The definition for the credentials is sent to the holder, who returns a presentation as a response. Now the verifier will verify the presentation by checking the signature and other accompanying proofs. \n\nThe presentation exchange will ensure that the model used by the verifier, can be interpreted by the holder. It then ensures that the correct parts from the holders credentials are used to create the presentation. The PE contains all the logic to interpret the models, therefore removing the need for the verifier and holder to align their specific models.\n\nThe data objects (models) used in PE-JS are generated from Sphereon's DIF PE OpenAPI Spec component. The code for the component can be seen at [PE-OpenAPI github repository](https://github.com/Sphereon-Opensource/pe-openapi). This allows the generation of the objects in many languages and frameworks consistently by configuring the maven plugin.\n\n\n### The PE Library supports the following actions:\n\n * Creating a presentation definition / request\n * Validating a presentation definition / request to be as per specification\n * Creating a presentation submission\n * Validating a presentation submission when received\n * Input evaluations: Verification of presentation submissions to be as per presentation definition\n * Utilities: to build and use different models compliant with the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/).\n\nStateful storage or credential management should be implemented in separate libraries/ modules that make use of the underlying DIF Presentation Exchange implementation. By keeping these separate, the library will stay platform agnostic. \n\n## For PE-JS developers\n\nThis project has been created using:\n* `yarn` version 1.22.5\n* `node` version 12.22.1\n\n### Install\n```shell\nyarn install\n```\n### Build\n```shell\nyarn build\n```\n### Test\nThe test command runs:\n* `eslint`\n* `prettier`\n* `unit`\n\nYou can also run only a single section of these tests, using for example `yarn test:unit`.\n```shell\nyarn test\n```\n\n### Utility scripts\nThere are several other utility scripts that help with development.\n\n* `yarn fix` - runs `eslint --fix` as well as `prettier` to fix code style\n* `yarn cov` - generates code coverage report\n\n\n## For PE-JS Users\n\nThe library can be installed direction from npmjs via:\n\n```shell\n# install via yarn\nyarn add @sphereon/pe-js\n\n# install via npm\nnpm install @sphereon/pe-js\n```\n\nThe core functionality of the DIF Presentation Exchange can be outlined as follows:\n\n* Input Evaluation\n* Credential Query\n* Utilities\n\n#### Input Evaluation\nInput evaluation is the primary mechanism by which a verifier determines whether a presentation submission from a holder matches the requested presentation definition from the request.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  \"id\": \"32f54163-7166-48f1-93d8-ff217bdb0653\",\n  \"input_descriptors\": [\n    {\n      \"id\": \"wa_driver_license\",\n      \"name\": \"Washington State Business License\",\n      \"purpose\": \"We can only allow licensed Washington State business representatives into the WA Business Conference\",\n      \"schema\": [{\n        \"uri\": \"https://licenses.example.com/business-license.json\"\n      }]\n    }\n  ]\n};\n\nconst verifiablePresentation = {\n  '@context': [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  type: [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: {...},\n  verifiableCredential: [...],\n  proof: {...}\n}\n\nconst {value, warnings, errors} = pejs.evaluate(presentationDefinition, verifiablePresentation);\n```\n\n#### Credential Query\nA credential query allows holders to filter their set of credentials for matches to a given presentation definition.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\n// Definition from verifier request\nconst presentationDefinition = {\n  ...\n};\n\n// Example for loading credentials\nconst credentials = await secureStore.getCredentials();\n\n// Find matching credentials\nconst srMatches = pejs.selectFrom(presentationDefinition, credentials, holderDid);\n\n// An example that selects the first 'count' credentials from\n// the matches. in a real scenario, the user has to select what \n// to disclose\nconst selectedCredentials = srMatches.map(\n  ({matches, count}) => matches.slice(0, count)\n).flat();\n\n// Construct presentation submission from selected credentials\nconst presentationSubmission = pejs.presentationFrom(presentationDefinition, selectedCredentials, holderDID);\n\nconst presentation = {\n  \"@context\": [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  \"type\": [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: presentationSubmission,\n  verifiableCredential: selectedCredentials\n};\n\n// Presentation would be signed and sent to verifier\n```\n\n#### Utilities\nIn addition to the core functionality above, the underlying validation methods are exposed as low-level helper functions.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  ...\n};\n\nconst {warnings: pdWarnings, errors: pdErrors} = pejs.validateDefinition(presentationDefinition);\n\nconst presentationSubmission = {\n  ...\n};\n\nconst {warnings: psWarnings, errors: psErrors} = pejs.validateSubmission(presentationSubmission);\n```\n\n## API\n\n### Evaluate\n```typescript\nevaluate(presentationDefinition, verifiablePresentation)\n```\n##### Description\nEvaluates whether a presentation submission meets the requested presentation definition\nSince this method will be used both **before** and **after** creating a VerifiablePresentation, we accept both _signed_ and _unsigned_ version of a presentation here. \n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `presentation` | `Presentation` | the Presentation object containing the required credentials and a `presentation_submission` object mapping back to the presentation definition |\n\n#### Return value\nIf evaluation is successful, `value` will be a non-null `PresentationSubmission` mapping the submitted credentials to the requested inputs.\n```typescript\ninterface EvaluationResults {\n  value?: PresentationSubmission;\n  warnings?: string[];\n  errors?: Error[];\n}\n```\n\n### SelectFrom\n```typescript\nselectFrom(presentationDefinition, credentials, holderDids)\n```\n##### Description\nGathers the matching credentials that fit a given presentation definition\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `credentials` | `VerifiableCredential[]` | the array of verifiable credentials to select from |\n| `holderDids` | `string[]` | the holder's dids. this can be found in VerifiablePresentation's holder property note that a wallet can have many holderDids retrieved from different places|\n\n#### Return value\n- If the selection was successful or partially successful, the `matches` array will consist of `SubmissionRequirementMatch` object(s), representing the matching credentials for each `SubmissionRequirement` in the `presentationDefinition` input parameter.\n- If the selection was not successful, the `errors` array will consist of `Checked` object(s), representing what has failed in your selection process.\n\n```typescript\nimport { Status } from './ConstraintUtils';\n\ninterface SelectResults {\n  errors?: Checked[];\n  matches?: SubmissionRequirementMatch[];\n  /**\n   * This is the parameter that pejs library user should look into to determine what to do next\n   * Status can have three values:\n   *  1. INFO: everything is fine, you can call `presentationFrom` after this method\n   *  2. WARN: method was called with more credentials than required. \n   *       To enhance credential holder's privacy it is recommended to select credentials which are absolutely required.\n   *  3. Error: the credentials you've sent didn't satisfy the requirement defined presentationDefinition object\n   */\n  areRequiredCredentialsPresent: Status;\n  /**\n   * All matched/selectable credentials\n   */\n  selectableVerifiableCredentials?: VerifiableCredential[];\n  /**\n   * Following are indexes of the verifiableCredentials passed to the selectFrom method that have been selected.\n   */\n  vcIndexes?: number[];\n  warnings?: Checked[];\n}\n\ninterface SubmissionRequirementMatch {\n  name?: string;\n  rule: Rules;\n  min?: number;\n  count?: number;\n  max?: number;\n  matches: string[];\n  from?: string[];\n  from_nested?: SubmissionRequirementMatch[]; // VerifiableCredential Address\n}\n```\n\n### PresentationFrom\n```typescript\npresentationFrom(presentationDefinition, selectedCredentials, holderDID)\n```\n##### Description\nCreates the corresponding Presentation Submission object to be included in the Verifiable Presentation response, which maps the submitted credentials to the requested inputs in the `presentationDefinition` input parameter.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `selectedCredentials` | `VerifiableCredential[]` | the array of verifiable credentials that meet the submission requirements in the presentation definition |\n| `holderDid` | `string` | the holder's DID. This can be found in VerifiablePresentation's holder property note that a wallet can have many holderDIDs retrieved from different places|\n\n#### Return value\nIf the selected credentials successfully match the submission requirements in the presentation definition, the return value will be a non-null `PresentationSubmission`\n```typescript\ninterface PresentationSubmission {\n  id?: string;\n  definition_id: string;\n  descriptor_map: Descriptor[]\n}\n```\n\n### Validation\n```typescript\nvalidateDefinition(objToValidate)\n```\n```typescript\nvalidateSubmission(objToValidate)\n```\n#### Description\nA validation utility function for `PresentationDefinition` and `PresentationSubmission` objects.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `objToValidate` | <code>PresentationDefinition &#124; PresentationSubmission</code> | the presentation definition or presentation definition to be validated |\n\n#### Return value\nThe `validate` method returns a validated results array `NonEmptyArray<Checked>` , with structure:\n```typescript\ninterface Checked {\n  tag: string;\n  status: Status;\n  message?: string;\n}\n```\nstatus can have following values `'info' | 'warn' | 'error'`\n\n\n## Workflow Diagram\n![Flow diagram](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/Sphereon-Opensource/pe-js/develop/docs/simple-scenario.puml)\n# Glossary\n\nTerm | Definition |\n---- | ---------- |\nCredential | A set of one or more claims made by an issuer. |\nVerifiable Credential |  Is a tamper-evident credential that has authorship that can be cryptographically verified. Verifiable credentials can be used to build verifiable presentations, which can also be cryptographically verified. The claims in a credential can be about different subjects. |\nPresentation Definition | Presentation Definitions are objects that articulate what proofs a Verifier requires. |\nHolder | Holders are entities that have one or more verifiable credentials in their possession. Holders are also the entities that submit proofs to Verifiers to satisfy the requirements described in a Presentation Definition.\nHolder's Did | Unique ID URI string and PKI metadata document format for describing the cryptographic keys and other fundamental PKI values linked to a unique, user-controlled, self-sovereign identifier in holder's wallet|\nVerifier | Verifiers are entities that define what proofs they require from a Holder (via a Presentation Definition) in order to proceed with an interaction. |\nIssuer | A role an entity can perform by asserting claims about one or more subjects, creating a verifiable credential from these claims, and transmitting the verifiable credential to a holder. |\nPresentation | Data derived from one or more verifiable credentials, issued by one or more issuers |\nVerifiable Presentation | Is a tamper-evident presentation encoded in such a way that authorship of the data can be trusted after a process of cryptographic verification.\n\n## Further work:\n1. Implementation of presentation-exchange v2\n2. In the [DIF documentation](https://identity.foundation/presentation-exchange/#input-evaluation) some entries are addressing `nested credentials` and `nested paths` these are currently not fully support yet.\n","licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.4.2-unstable.8","dist":{"shasum":"670b497fb737a200c52a8905affef7d02f4d8643","integrity":"sha512-72xTaxk6n21p1v3o0cxSCjrOMrvGrEZqTXlYRHMjbdY+8AFXLebuht8O+oLXiJ9C0YluQCdx9G8/PIuKu6YGOA==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.4.2-unstable.8.tgz","fileCount":597,"unpackedSize":3203019,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhoX42CRA9TVsSAnZWagAARZEP/ihOJMcZI0V+1LCSC9g4\nq5t1wHX8+fizzvoj9jmsCU82e6yPQKQgMoKFO8uLCCwYllYi21TfobzDnsU1\nywjwCczZd3NOwdNGSi0vtMFvWqMLqHJ4s/WxcuX7oPn3SRnYcuj7luB/lvVr\nvOSYNpCnm1iU2UXtelQIPkveH1WkLUAT0q/uUc9zciAjSByXTg1tdkx+4ffX\nypzKcN7osF7s4D1DdwuRu6beS+oER9rlijMgppPCUy3Q6jbRFwboOSzhU/6c\nGmIh34eveuaHsGcHtKe8Vt54kX4ZPgrkO7D0lgj7i7eitjTZhVGmJ2cXjnzd\nfKZKz9+hCytafYdMZda5Z8uhmCiPrkp40xy+EmlFnDLl0nj0Uds9ZJhFYQhT\nR/VqatT+L8BH3t7pUSG8xEKM9vNP4QeVx/WKU13/0xrDBhK/MZ9I96m7Nx+U\nwIhq/VZq4ENM5z/2/k84rHDRLvkvtb9w4EE/wE+89sg4tq4qbadnK4hGVtay\n5MHKLG2oUVpzIJ/m5kvQ4ezm3MeL+6/rLvXZtujyE8h8tHSZspnUB7ePrT1L\nJjBGFgTZ3+PFr1pvQ34dzwDnR2JCd2O2GZ76DTX7tXtFKQ7db3kAFgPqgqrH\nFXQKO8YZm4vSRX/myVqkahCvBm0MpXJSiDV0O9JrqhuUfJRQbzTe2YK7UVOA\ngZDy\r\n=ewaH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBuQyU2jB/81AGDkciLN6Vy/WcrLkpAu5le3BO+AE7MYAiEAyDSQuu27p6HeuRugdi3Yw36aN3MzPB5ORmSBGF53t/Y="}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.4.2-unstable.8_1637973558353_0.6640140857052745"},"_hasShrinkwrap":false},"0.4.2-unstable.9":{"name":"@sphereon/pe-js","version":"0.4.2-unstable.9","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","typings":"dist/main/index.d.ts","browser":"dist/browser/index.js","module":"dist/module/index.js","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosure","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build:browser":"tsc -p tsconfig.browser.json","build:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","rimraf":"^2.6.2","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":150},"readmeFilename":"README.md","readme":"<h1 align=\"center\">\n  <br>\n  <a href=\"https://www.sphereon.com\"><img src=\"https://sphereon.com/content/themes/sphereon/assets/img/logo.svg\" alt=\"Sphereon\" width=\"400\"></a>\n  <br>PE-JS   DIF Presentation Exchange JavaScript Library \n  <br>\n</h1>\n\n[![CI](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml/badge.svg)](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/Sphereon-Opensource/pe-js/branch/develop/graph/badge.svg?token=9P1JGUYA35)](https://codecov.io/gh/Sphereon-Opensource/pe-js) [![NPM Version](https://img.shields.io/npm/v/@sphereon/pe-js.svg)](https://npm.im/@sphereon/pe-js)\n\n## Active Development\n_IMPORTANT: This software still is in early development stage. As such you should expect breaking changes in APIs, we expect to keep that to a minimum though._\n\n## Background\n\nThe PE-JS Library is a general use presentation exchange library that implements the functionality described in the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/). It is written in Typescript and can be compiled to any target JavaScript version.\n\nSphereon's PE Library is useful for both verifier systems and holders (e.g. wallets) and can be used in client side browsers and mobile applications as well as on server side technology such as REST APIs (e.g. built with NodeJS). It allows anyone to add DIF Presentation Exchange logic to their existing wallets, or verifiers, without making any further assumptions about the technologies used in their products.\n\nThe presentation exchange operates generally as follows; The verifier creates a Presentation Definition asking for credentials from the holder. The definition for the credentials is sent to the holder, who returns a presentation as a response. Now the verifier will verify the presentation by checking the signature and other accompanying proofs. \n\nThe presentation exchange will ensure that the model used by the verifier, can be interpreted by the holder. It then ensures that the correct parts from the holders credentials are used to create the presentation. The PE contains all the logic to interpret the models, therefore removing the need for the verifier and holder to align their specific models.\n\nThe data objects (models) used in PE-JS are generated from Sphereon's DIF PE OpenAPI Spec component. The code for the component can be seen at [PE-OpenAPI github repository](https://github.com/Sphereon-Opensource/pe-openapi). This allows the generation of the objects in many languages and frameworks consistently by configuring the maven plugin.\n\n\n### The PE Library supports the following actions:\n\n * Creating a presentation definition / request\n * Validating a presentation definition / request to be as per specification\n * Creating a presentation submission\n * Validating a presentation submission when received\n * Input evaluations: Verification of presentation submissions to be as per presentation definition\n * Utilities: to build and use different models compliant with the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/).\n\nStateful storage or credential management should be implemented in separate libraries/ modules that make use of the underlying DIF Presentation Exchange implementation. By keeping these separate, the library will stay platform agnostic. \n\n## For PE-JS developers\n\nThis project has been created using:\n* `yarn` version 1.22.5\n* `node` version 12.22.1\n\n### Install\n```shell\nyarn install\n```\n### Build\n```shell\nyarn build\n```\n### Test\nThe test command runs:\n* `eslint`\n* `prettier`\n* `unit`\n\nYou can also run only a single section of these tests, using for example `yarn test:unit`.\n```shell\nyarn test\n```\n\n### Utility scripts\nThere are several other utility scripts that help with development.\n\n* `yarn fix` - runs `eslint --fix` as well as `prettier` to fix code style\n* `yarn cov` - generates code coverage report\n\n\n## For PE-JS Users\n\nThe library can be installed direction from npmjs via:\n\n```shell\n# install via yarn\nyarn add @sphereon/pe-js\n\n# install via npm\nnpm install @sphereon/pe-js\n```\n\nThe core functionality of the DIF Presentation Exchange can be outlined as follows:\n\n* Input Evaluation\n* Credential Query\n* Utilities\n\n#### Input Evaluation\nInput evaluation is the primary mechanism by which a verifier determines whether a presentation submission from a holder matches the requested presentation definition from the request.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  \"id\": \"32f54163-7166-48f1-93d8-ff217bdb0653\",\n  \"input_descriptors\": [\n    {\n      \"id\": \"wa_driver_license\",\n      \"name\": \"Washington State Business License\",\n      \"purpose\": \"We can only allow licensed Washington State business representatives into the WA Business Conference\",\n      \"schema\": [{\n        \"uri\": \"https://licenses.example.com/business-license.json\"\n      }]\n    }\n  ]\n};\n\nconst verifiablePresentation = {\n  '@context': [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  type: [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: {...},\n  verifiableCredential: [...],\n  proof: {...}\n}\n\nconst {value, warnings, errors} = pejs.evaluate(presentationDefinition, verifiablePresentation);\n```\n\n#### Credential Query\nA credential query allows holders to filter their set of credentials for matches to a given presentation definition.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\n// Definition from verifier request\nconst presentationDefinition = {\n  ...\n};\n\n// Example for loading credentials\nconst credentials = await secureStore.getCredentials();\n\n// Find matching credentials\nconst srMatches = pejs.selectFrom(presentationDefinition, credentials, holderDid);\n\n// An example that selects the first 'count' credentials from\n// the matches. in a real scenario, the user has to select what \n// to disclose\nconst selectedCredentials = srMatches.map(\n  ({matches, count}) => matches.slice(0, count)\n).flat();\n\n// Construct presentation submission from selected credentials\nconst presentationSubmission = pejs.presentationFrom(presentationDefinition, selectedCredentials, holderDID);\n\nconst presentation = {\n  \"@context\": [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  \"type\": [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: presentationSubmission,\n  verifiableCredential: selectedCredentials\n};\n\n// Presentation would be signed and sent to verifier\n```\n\n#### Utilities\nIn addition to the core functionality above, the underlying validation methods are exposed as low-level helper functions.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  ...\n};\n\nconst {warnings: pdWarnings, errors: pdErrors} = pejs.validateDefinition(presentationDefinition);\n\nconst presentationSubmission = {\n  ...\n};\n\nconst {warnings: psWarnings, errors: psErrors} = pejs.validateSubmission(presentationSubmission);\n```\n\n## API\n\n### Evaluate\n```typescript\nevaluate(presentationDefinition, verifiablePresentation)\n```\n##### Description\nEvaluates whether a presentation submission meets the requested presentation definition\nSince this method will be used both **before** and **after** creating a VerifiablePresentation, we accept both _signed_ and _unsigned_ version of a presentation here. \n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `presentation` | `Presentation` | the Presentation object containing the required credentials and a `presentation_submission` object mapping back to the presentation definition |\n\n#### Return value\nIf evaluation is successful, `value` will be a non-null `PresentationSubmission` mapping the submitted credentials to the requested inputs.\n```typescript\ninterface EvaluationResults {\n  value?: PresentationSubmission;\n  warnings?: string[];\n  errors?: Error[];\n}\n```\n\n### SelectFrom\n```typescript\nselectFrom(presentationDefinition, credentials, holderDids)\n```\n##### Description\nGathers the matching credentials that fit a given presentation definition\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `credentials` | `VerifiableCredential[]` | the array of verifiable credentials to select from |\n| `holderDids` | `string[]` | the holder's dids. this can be found in VerifiablePresentation's holder property note that a wallet can have many holderDids retrieved from different places|\n\n#### Return value\n- If the selection was successful or partially successful, the `matches` array will consist of `SubmissionRequirementMatch` object(s), representing the matching credentials for each `SubmissionRequirement` in the `presentationDefinition` input parameter.\n- If the selection was not successful, the `errors` array will consist of `Checked` object(s), representing what has failed in your selection process.\n\n```typescript\nimport { Status } from './ConstraintUtils';\n\ninterface SelectResults {\n  errors?: Checked[];\n  matches?: SubmissionRequirementMatch[];\n  /**\n   * This is the parameter that pejs library user should look into to determine what to do next\n   * Status can have three values:\n   *  1. INFO: everything is fine, you can call `presentationFrom` after this method\n   *  2. WARN: method was called with more credentials than required. \n   *       To enhance credential holder's privacy it is recommended to select credentials which are absolutely required.\n   *  3. Error: the credentials you've sent didn't satisfy the requirement defined presentationDefinition object\n   */\n  areRequiredCredentialsPresent: Status;\n  /**\n   * All matched/selectable credentials\n   */\n  selectableVerifiableCredentials?: VerifiableCredential[];\n  /**\n   * Following are indexes of the verifiableCredentials passed to the selectFrom method that have been selected.\n   */\n  vcIndexes?: number[];\n  warnings?: Checked[];\n}\n\ninterface SubmissionRequirementMatch {\n  name?: string;\n  rule: Rules;\n  min?: number;\n  count?: number;\n  max?: number;\n  matches: string[];\n  from?: string[];\n  from_nested?: SubmissionRequirementMatch[]; // VerifiableCredential Address\n}\n```\n\n### PresentationFrom\n```typescript\npresentationFrom(presentationDefinition, selectedCredentials, holderDID)\n```\n##### Description\nCreates the corresponding Presentation Submission object to be included in the Verifiable Presentation response, which maps the submitted credentials to the requested inputs in the `presentationDefinition` input parameter.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `selectedCredentials` | `VerifiableCredential[]` | the array of verifiable credentials that meet the submission requirements in the presentation definition |\n| `holderDid` | `string` | the holder's DID. This can be found in VerifiablePresentation's holder property note that a wallet can have many holderDIDs retrieved from different places|\n\n#### Return value\nIf the selected credentials successfully match the submission requirements in the presentation definition, the return value will be a non-null `PresentationSubmission`\n```typescript\ninterface PresentationSubmission {\n  id?: string;\n  definition_id: string;\n  descriptor_map: Descriptor[]\n}\n```\n\n### Validation\n```typescript\nvalidateDefinition(objToValidate)\n```\n```typescript\nvalidateSubmission(objToValidate)\n```\n#### Description\nA validation utility function for `PresentationDefinition` and `PresentationSubmission` objects.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `objToValidate` | <code>PresentationDefinition &#124; PresentationSubmission</code> | the presentation definition or presentation definition to be validated |\n\n#### Return value\nThe `validate` method returns a validated results array `NonEmptyArray<Checked>` , with structure:\n```typescript\ninterface Checked {\n  tag: string;\n  status: Status;\n  message?: string;\n}\n```\nstatus can have following values `'info' | 'warn' | 'error'`\n\n\n## Workflow Diagram\n![Flow diagram](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/Sphereon-Opensource/pe-js/develop/docs/simple-scenario.puml)\n# Glossary\n\nTerm | Definition |\n---- | ---------- |\nCredential | A set of one or more claims made by an issuer. |\nVerifiable Credential |  Is a tamper-evident credential that has authorship that can be cryptographically verified. Verifiable credentials can be used to build verifiable presentations, which can also be cryptographically verified. The claims in a credential can be about different subjects. |\nPresentation Definition | Presentation Definitions are objects that articulate what proofs a Verifier requires. |\nHolder | Holders are entities that have one or more verifiable credentials in their possession. Holders are also the entities that submit proofs to Verifiers to satisfy the requirements described in a Presentation Definition.\nHolder's Did | Unique ID URI string and PKI metadata document format for describing the cryptographic keys and other fundamental PKI values linked to a unique, user-controlled, self-sovereign identifier in holder's wallet|\nVerifier | Verifiers are entities that define what proofs they require from a Holder (via a Presentation Definition) in order to proceed with an interaction. |\nIssuer | A role an entity can perform by asserting claims about one or more subjects, creating a verifiable credential from these claims, and transmitting the verifiable credential to a holder. |\nPresentation | Data derived from one or more verifiable credentials, issued by one or more issuers |\nVerifiable Presentation | Is a tamper-evident presentation encoded in such a way that authorship of the data can be trusted after a process of cryptographic verification.\n\n## Further work:\n1. Implementation of presentation-exchange v2\n2. In the [DIF documentation](https://identity.foundation/presentation-exchange/#input-evaluation) some entries are addressing `nested credentials` and `nested paths` these are currently not fully support yet.\n","licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.4.2-unstable.9","dist":{"shasum":"04730b9d16b940d9db10df2a5663bcaa55808c46","integrity":"sha512-9oWTemzJ5Qyf7bb+JwyF6nW9BcteBJ6OevBGywam0CtIWxapPHzh1GmeAELtYrpqp7C4hdAxQXYy47/LulJ7Pw==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.4.2-unstable.9.tgz","fileCount":597,"unpackedSize":3198268,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhoYJ7CRA9TVsSAnZWagAA09AP/34cPMLVkv++RhbtzFJH\nSxhoxDietijT3hbv4tAIi9eeL0tt6feU65RELGRVfjSCY6CYdFUFDq2uCpb0\nUNqpcbpn61x+nKT9UAfxfmA8jluVQBwt20Vf6Sbr2qjNgcALZ6k9jNkWlkFR\nnpfJPQXDjBlEJjEkRnmFe4Ob9XjdJriUla405kiVjtd8pG6f3ldkgSxAeWO4\n848XRUC1frzviZ/6rPqVuN6ohhDrt5QoMOP1E00ibFOI3OEayVG4WCipRItD\nM3fBl4kB+jk0lAaf2BTEOAPCmZLjgH/SOvK4x2g58YmHsQX/YfI9Asij721Z\nOQUlPzXvUy3sPFulqCkHcH4wrAj3xxBpCT5nqGDt+GMyh8drWwRGyERov9w5\nf0APDZ6TdsstvJ1BDkm70kZ+lwZW3XORWwWGKYDrDIGi966ckuQprio6fhe/\nDkEJrhyoftYLlpHIqhc0y71PW9eEcs1VG9VqNu9eR8sPRAv8Ps1JP/xIEjEA\nE9/ZNWTx/AJgITT6p4O3zHB2BerR+jBrtmcOp479LhgrYCjBT0SI6QvivdBM\nDrywSGz7nFetiP0FVHHS2TVPBNbpp6lT5oG1OU92slY4xyR1l+lhHAfv9vu9\ncif+yN8xNzouBy73U5lMDRrpfA2jXHw4ZIXkXeMVSljMDXwwVxt/hR9fT9zD\nwbiR\r\n=pjgl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICm5IN+5CsDIUaoQhy3yb8R0JoZ0kjCjOGNI8IDApWpZAiEA6AtVILgsOSn6BtM/B1QhgU2kgzrTCXbDEQFwW7/wWlc="}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.4.2-unstable.9_1637974650786_0.4870007259269764"},"_hasShrinkwrap":false},"0.4.2-unstable.10":{"name":"@sphereon/pe-js","version":"0.4.2-unstable.10","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","typings":"dist/main/index.d.ts","browser":"dist/browser/index.js","module":"dist/module/index.js","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosure","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build:browser":"tsc -p tsconfig.browser.json","build:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","rimraf":"^2.6.2","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":150},"readmeFilename":"README.md","readme":"<h1 align=\"center\">\n  <br>\n  <a href=\"https://www.sphereon.com\"><img src=\"https://sphereon.com/content/themes/sphereon/assets/img/logo.svg\" alt=\"Sphereon\" width=\"400\"></a>\n  <br>PE-JS   DIF Presentation Exchange JavaScript Library \n  <br>\n</h1>\n\n[![CI](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml/badge.svg)](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/Sphereon-Opensource/pe-js/branch/develop/graph/badge.svg?token=9P1JGUYA35)](https://codecov.io/gh/Sphereon-Opensource/pe-js) [![NPM Version](https://img.shields.io/npm/v/@sphereon/pe-js.svg)](https://npm.im/@sphereon/pe-js)\n\n## Active Development\n_IMPORTANT: This software still is in early development stage. As such you should expect breaking changes in APIs, we expect to keep that to a minimum though._\n\n## Background\n\nThe PE-JS Library is a general use presentation exchange library that implements the functionality described in the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/). It is written in Typescript and can be compiled to any target JavaScript version.\n\nSphereon's PE Library is useful for both verifier systems and holders (e.g. wallets) and can be used in client side browsers and mobile applications as well as on server side technology such as REST APIs (e.g. built with NodeJS). It allows anyone to add DIF Presentation Exchange logic to their existing wallets, or verifiers, without making any further assumptions about the technologies used in their products.\n\nThe presentation exchange operates generally as follows; The verifier creates a Presentation Definition asking for credentials from the holder. The definition for the credentials is sent to the holder, who returns a presentation as a response. Now the verifier will verify the presentation by checking the signature and other accompanying proofs. \n\nThe presentation exchange will ensure that the model used by the verifier, can be interpreted by the holder. It then ensures that the correct parts from the holders credentials are used to create the presentation. The PE contains all the logic to interpret the models, therefore removing the need for the verifier and holder to align their specific models.\n\nThe data objects (models) used in PE-JS are generated from Sphereon's DIF PE OpenAPI Spec component. The code for the component can be seen at [PE-OpenAPI github repository](https://github.com/Sphereon-Opensource/pe-openapi). This allows the generation of the objects in many languages and frameworks consistently by configuring the maven plugin.\n\n\n### The PE Library supports the following actions:\n\n * Creating a presentation definition / request\n * Validating a presentation definition / request to be as per specification\n * Creating a presentation submission\n * Validating a presentation submission when received\n * Input evaluations: Verification of presentation submissions to be as per presentation definition\n * Utilities: to build and use different models compliant with the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/).\n\nStateful storage or credential management should be implemented in separate libraries/ modules that make use of the underlying DIF Presentation Exchange implementation. By keeping these separate, the library will stay platform agnostic. \n\n## For PE-JS developers\n\nThis project has been created using:\n* `yarn` version 1.22.5\n* `node` version 12.22.1\n\n### Install\n```shell\nyarn install\n```\n### Build\n```shell\nyarn build\n```\n### Test\nThe test command runs:\n* `eslint`\n* `prettier`\n* `unit`\n\nYou can also run only a single section of these tests, using for example `yarn test:unit`.\n```shell\nyarn test\n```\n\n### Utility scripts\nThere are several other utility scripts that help with development.\n\n* `yarn fix` - runs `eslint --fix` as well as `prettier` to fix code style\n* `yarn cov` - generates code coverage report\n\n\n## For PE-JS Users\n\nThe library can be installed direction from npmjs via:\n\n```shell\n# install via yarn\nyarn add @sphereon/pe-js\n\n# install via npm\nnpm install @sphereon/pe-js\n```\n\nThe core functionality of the DIF Presentation Exchange can be outlined as follows:\n\n* Input Evaluation\n* Credential Query\n* Utilities\n\n#### Input Evaluation\nInput evaluation is the primary mechanism by which a verifier determines whether a presentation submission from a holder matches the requested presentation definition from the request.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  \"id\": \"32f54163-7166-48f1-93d8-ff217bdb0653\",\n  \"input_descriptors\": [\n    {\n      \"id\": \"wa_driver_license\",\n      \"name\": \"Washington State Business License\",\n      \"purpose\": \"We can only allow licensed Washington State business representatives into the WA Business Conference\",\n      \"schema\": [{\n        \"uri\": \"https://licenses.example.com/business-license.json\"\n      }]\n    }\n  ]\n};\n\nconst verifiablePresentation = {\n  '@context': [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  type: [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: {...},\n  verifiableCredential: [...],\n  proof: {...}\n}\n\nconst {value, warnings, errors} = pejs.evaluate(presentationDefinition, verifiablePresentation);\n```\n\n#### Credential Query\nA credential query allows holders to filter their set of credentials for matches to a given presentation definition.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\n// Definition from verifier request\nconst presentationDefinition = {\n  ...\n};\n\n// Example for loading credentials\nconst credentials = await secureStore.getCredentials();\n\n// Find matching credentials\nconst srMatches = pejs.selectFrom(presentationDefinition, credentials, holderDid);\n\n// An example that selects the first 'count' credentials from\n// the matches. in a real scenario, the user has to select what \n// to disclose\nconst selectedCredentials = srMatches.map(\n  ({matches, count}) => matches.slice(0, count)\n).flat();\n\n// Construct presentation submission from selected credentials\nconst presentationSubmission = pejs.presentationFrom(presentationDefinition, selectedCredentials, holderDID);\n\nconst presentation = {\n  \"@context\": [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  \"type\": [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: presentationSubmission,\n  verifiableCredential: selectedCredentials\n};\n\n// Presentation would be signed and sent to verifier\n```\n\n#### Utilities\nIn addition to the core functionality above, the underlying validation methods are exposed as low-level helper functions.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  ...\n};\n\nconst {warnings: pdWarnings, errors: pdErrors} = pejs.validateDefinition(presentationDefinition);\n\nconst presentationSubmission = {\n  ...\n};\n\nconst {warnings: psWarnings, errors: psErrors} = pejs.validateSubmission(presentationSubmission);\n```\n\n## API\n\n### Evaluate\n```typescript\nevaluate(presentationDefinition, verifiablePresentation)\n```\n##### Description\nEvaluates whether a presentation submission meets the requested presentation definition\nSince this method will be used both **before** and **after** creating a VerifiablePresentation, we accept both _signed_ and _unsigned_ version of a presentation here. \n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `presentation` | `Presentation` | the Presentation object containing the required credentials and a `presentation_submission` object mapping back to the presentation definition |\n\n#### Return value\nIf evaluation is successful, `value` will be a non-null `PresentationSubmission` mapping the submitted credentials to the requested inputs.\n```typescript\ninterface EvaluationResults {\n  value?: PresentationSubmission;\n  warnings?: string[];\n  errors?: Error[];\n}\n```\n\n### SelectFrom\n```typescript\nselectFrom(presentationDefinition, credentials, holderDids)\n```\n##### Description\nGathers the matching credentials that fit a given presentation definition\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `credentials` | `VerifiableCredential[]` | the array of verifiable credentials to select from |\n| `holderDids` | `string[]` | the holder's dids. this can be found in VerifiablePresentation's holder property note that a wallet can have many holderDids retrieved from different places|\n\n#### Return value\n- If the selection was successful or partially successful, the `matches` array will consist of `SubmissionRequirementMatch` object(s), representing the matching credentials for each `SubmissionRequirement` in the `presentationDefinition` input parameter.\n- If the selection was not successful, the `errors` array will consist of `Checked` object(s), representing what has failed in your selection process.\n\n```typescript\nimport { Status } from './ConstraintUtils';\n\ninterface SelectResults {\n  errors?: Checked[];\n  matches?: SubmissionRequirementMatch[];\n  /**\n   * This is the parameter that pejs library user should look into to determine what to do next\n   * Status can have three values:\n   *  1. INFO: everything is fine, you can call `presentationFrom` after this method\n   *  2. WARN: method was called with more credentials than required. \n   *       To enhance credential holder's privacy it is recommended to select credentials which are absolutely required.\n   *  3. Error: the credentials you've sent didn't satisfy the requirement defined presentationDefinition object\n   */\n  areRequiredCredentialsPresent: Status;\n  /**\n   * All matched/selectable credentials\n   */\n  selectableVerifiableCredentials?: VerifiableCredential[];\n  /**\n   * Following are indexes of the verifiableCredentials passed to the selectFrom method that have been selected.\n   */\n  vcIndexes?: number[];\n  warnings?: Checked[];\n}\n\ninterface SubmissionRequirementMatch {\n  name?: string;\n  rule: Rules;\n  min?: number;\n  count?: number;\n  max?: number;\n  matches: string[];\n  from?: string[];\n  from_nested?: SubmissionRequirementMatch[]; // VerifiableCredential Address\n}\n```\n\n### PresentationFrom\n```typescript\npresentationFrom(presentationDefinition, selectedCredentials, holderDID)\n```\n##### Description\nCreates the corresponding Presentation Submission object to be included in the Verifiable Presentation response, which maps the submitted credentials to the requested inputs in the `presentationDefinition` input parameter.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `selectedCredentials` | `VerifiableCredential[]` | the array of verifiable credentials that meet the submission requirements in the presentation definition |\n| `holderDid` | `string` | the holder's DID. This can be found in VerifiablePresentation's holder property note that a wallet can have many holderDIDs retrieved from different places|\n\n#### Return value\nIf the selected credentials successfully match the submission requirements in the presentation definition, the return value will be a non-null `PresentationSubmission`\n```typescript\ninterface PresentationSubmission {\n  id?: string;\n  definition_id: string;\n  descriptor_map: Descriptor[]\n}\n```\n\n### Validation\n```typescript\nvalidateDefinition(objToValidate)\n```\n```typescript\nvalidateSubmission(objToValidate)\n```\n#### Description\nA validation utility function for `PresentationDefinition` and `PresentationSubmission` objects.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `objToValidate` | <code>PresentationDefinition &#124; PresentationSubmission</code> | the presentation definition or presentation definition to be validated |\n\n#### Return value\nThe `validate` method returns a validated results array `NonEmptyArray<Checked>` , with structure:\n```typescript\ninterface Checked {\n  tag: string;\n  status: Status;\n  message?: string;\n}\n```\nstatus can have following values `'info' | 'warn' | 'error'`\n\n\n## Workflow Diagram\n![Flow diagram](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/Sphereon-Opensource/pe-js/develop/docs/simple-scenario.puml)\n# Glossary\n\nTerm | Definition |\n---- | ---------- |\nCredential | A set of one or more claims made by an issuer. |\nVerifiable Credential |  Is a tamper-evident credential that has authorship that can be cryptographically verified. Verifiable credentials can be used to build verifiable presentations, which can also be cryptographically verified. The claims in a credential can be about different subjects. |\nPresentation Definition | Presentation Definitions are objects that articulate what proofs a Verifier requires. |\nHolder | Holders are entities that have one or more verifiable credentials in their possession. Holders are also the entities that submit proofs to Verifiers to satisfy the requirements described in a Presentation Definition.\nHolder's Did | Unique ID URI string and PKI metadata document format for describing the cryptographic keys and other fundamental PKI values linked to a unique, user-controlled, self-sovereign identifier in holder's wallet|\nVerifier | Verifiers are entities that define what proofs they require from a Holder (via a Presentation Definition) in order to proceed with an interaction. |\nIssuer | A role an entity can perform by asserting claims about one or more subjects, creating a verifiable credential from these claims, and transmitting the verifiable credential to a holder. |\nPresentation | Data derived from one or more verifiable credentials, issued by one or more issuers |\nVerifiable Presentation | Is a tamper-evident presentation encoded in such a way that authorship of the data can be trusted after a process of cryptographic verification.\n\n## Further work:\n1. Implementation of presentation-exchange v2\n2. In the [DIF documentation](https://identity.foundation/presentation-exchange/#input-evaluation) some entries are addressing `nested credentials` and `nested paths` these are currently not fully support yet.\n","licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.4.2-unstable.10","dist":{"shasum":"43bbcfa586560ba63c771e3d0f3643b679fe1fd9","integrity":"sha512-77F7t9uLnCXRXEfnGwddtEsKhjSU8GFwf+SIRmV+D4E3UdjclqrfxnwvQuB6GXMtN30gQlvuWF8HfLspByzcxw==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.4.2-unstable.10.tgz","fileCount":597,"unpackedSize":3198590,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhoYQ7CRA9TVsSAnZWagAAqt8P/0gINxJxOMV5U+x0z0Yv\nQ+rJ0AVj7qDwcto/5j6W2YUtGNFHJ1v/r1PtrUgIzCIysZ5qn80/41tExAuD\n4l/NRrdPYxqLTIp9457600lrvMvm9IWh97d0HS5XrW3zi+o41Sty8bJF6EHS\noCp5povnv7XPSyMrwR2OHd1BWuX7iLOLXHmnOuiexVnr2wxG9TxekYVbCw/7\nrtrjqEyv0nH60irG10M7rRt9OVC5dcNlyL+agShNl7gZLlBJmdRnVL2sblk/\nryzC14/k4/gOB50gLhkOZA07YpUNv6k5W70bskhM4Iutv33Zr9VzNcBW7lS7\nH6w1J88/2rV+bPtj46wGY+oUDWaXpgUl2+YF745JjVSTY5yaWXV1pTdzXNGG\nPGx6l6ywmQy89fVabFyMt7kkhnn9rErobtDV3j3PZN63e+4Ay8bs72S9yXD9\ngr9YRE0KSvLWhdTdK693dN+WOxpZpVKfeCPFzBrRtghKklPDs4NanIcqB6Wd\n/JaFEtFwVC/hPlnbRdYtYSGB7KAlqciEJTbzbwwFKYy5onQO8iLQOuZAqIYL\nu2hz0m+4Gdzvtg4UYU7c9ZNO3I45JISGWY8wc/TedQz5Vf3jjxvk3mvx9IyF\nVjnCEV/J2oFVxycQlRvtpMYyv5wqbjB/9jtYNBwS/hCI7dyrvxeqepAq1vzt\nU4Xw\r\n=3laR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDH6ylJKK0wanrol9M8mrdwSa09r6kEtnu9eV+ETIkpbAiAkSu1MihKEzAwUvvNL0bbA7pg/2WGxwSc8cQEC/YNEXQ=="}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.4.2-unstable.10_1637975099328_0.4497943807030682"},"_hasShrinkwrap":false},"0.4.2-unstable.11":{"name":"@sphereon/pe-js","version":"0.4.2-unstable.11","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","typings":"dist/main/index.d.ts","browser":"dist/browser/index.js","module":"dist/module/index.js","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosure","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build-dis:browser":"tsc -p tsconfig.browser.json","build-dis:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","rimraf":"^2.6.2","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":150},"readmeFilename":"README.md","readme":"<h1 align=\"center\">\n  <br>\n  <a href=\"https://www.sphereon.com\"><img src=\"https://sphereon.com/content/themes/sphereon/assets/img/logo.svg\" alt=\"Sphereon\" width=\"400\"></a>\n  <br>PE-JS   DIF Presentation Exchange JavaScript Library \n  <br>\n</h1>\n\n[![CI](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml/badge.svg)](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/Sphereon-Opensource/pe-js/branch/develop/graph/badge.svg?token=9P1JGUYA35)](https://codecov.io/gh/Sphereon-Opensource/pe-js) [![NPM Version](https://img.shields.io/npm/v/@sphereon/pe-js.svg)](https://npm.im/@sphereon/pe-js)\n\n## Active Development\n_IMPORTANT: This software still is in early development stage. As such you should expect breaking changes in APIs, we expect to keep that to a minimum though._\n\n## Background\n\nThe PE-JS Library is a general use presentation exchange library that implements the functionality described in the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/). It is written in Typescript and can be compiled to any target JavaScript version.\n\nSphereon's PE Library is useful for both verifier systems and holders (e.g. wallets) and can be used in client side browsers and mobile applications as well as on server side technology such as REST APIs (e.g. built with NodeJS). It allows anyone to add DIF Presentation Exchange logic to their existing wallets, or verifiers, without making any further assumptions about the technologies used in their products.\n\nThe presentation exchange operates generally as follows; The verifier creates a Presentation Definition asking for credentials from the holder. The definition for the credentials is sent to the holder, who returns a presentation as a response. Now the verifier will verify the presentation by checking the signature and other accompanying proofs. \n\nThe presentation exchange will ensure that the model used by the verifier, can be interpreted by the holder. It then ensures that the correct parts from the holders credentials are used to create the presentation. The PE contains all the logic to interpret the models, therefore removing the need for the verifier and holder to align their specific models.\n\nThe data objects (models) used in PE-JS are generated from Sphereon's DIF PE OpenAPI Spec component. The code for the component can be seen at [PE-OpenAPI github repository](https://github.com/Sphereon-Opensource/pe-openapi). This allows the generation of the objects in many languages and frameworks consistently by configuring the maven plugin.\n\n\n### The PE Library supports the following actions:\n\n * Creating a presentation definition / request\n * Validating a presentation definition / request to be as per specification\n * Creating a presentation submission\n * Validating a presentation submission when received\n * Input evaluations: Verification of presentation submissions to be as per presentation definition\n * Utilities: to build and use different models compliant with the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/).\n\nStateful storage or credential management should be implemented in separate libraries/ modules that make use of the underlying DIF Presentation Exchange implementation. By keeping these separate, the library will stay platform agnostic. \n\n## For PE-JS developers\n\nThis project has been created using:\n* `yarn` version 1.22.5\n* `node` version 12.22.1\n\n### Install\n```shell\nyarn install\n```\n### Build\n```shell\nyarn build\n```\n### Test\nThe test command runs:\n* `eslint`\n* `prettier`\n* `unit`\n\nYou can also run only a single section of these tests, using for example `yarn test:unit`.\n```shell\nyarn test\n```\n\n### Utility scripts\nThere are several other utility scripts that help with development.\n\n* `yarn fix` - runs `eslint --fix` as well as `prettier` to fix code style\n* `yarn cov` - generates code coverage report\n\n\n## For PE-JS Users\n\nThe library can be installed direction from npmjs via:\n\n```shell\n# install via yarn\nyarn add @sphereon/pe-js\n\n# install via npm\nnpm install @sphereon/pe-js\n```\n\nThe core functionality of the DIF Presentation Exchange can be outlined as follows:\n\n* Input Evaluation\n* Credential Query\n* Utilities\n\n#### Input Evaluation\nInput evaluation is the primary mechanism by which a verifier determines whether a presentation submission from a holder matches the requested presentation definition from the request.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  \"id\": \"32f54163-7166-48f1-93d8-ff217bdb0653\",\n  \"input_descriptors\": [\n    {\n      \"id\": \"wa_driver_license\",\n      \"name\": \"Washington State Business License\",\n      \"purpose\": \"We can only allow licensed Washington State business representatives into the WA Business Conference\",\n      \"schema\": [{\n        \"uri\": \"https://licenses.example.com/business-license.json\"\n      }]\n    }\n  ]\n};\n\nconst verifiablePresentation = {\n  '@context': [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  type: [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: {...},\n  verifiableCredential: [...],\n  proof: {...}\n}\n\nconst {value, warnings, errors} = pejs.evaluate(presentationDefinition, verifiablePresentation);\n```\n\n#### Credential Query\nA credential query allows holders to filter their set of credentials for matches to a given presentation definition.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\n// Definition from verifier request\nconst presentationDefinition = {\n  ...\n};\n\n// Example for loading credentials\nconst credentials = await secureStore.getCredentials();\n\n// Find matching credentials\nconst srMatches = pejs.selectFrom(presentationDefinition, credentials, holderDid);\n\n// An example that selects the first 'count' credentials from\n// the matches. in a real scenario, the user has to select what \n// to disclose\nconst selectedCredentials = srMatches.map(\n  ({matches, count}) => matches.slice(0, count)\n).flat();\n\n// Construct presentation submission from selected credentials\nconst presentationSubmission = pejs.presentationFrom(presentationDefinition, selectedCredentials, holderDID);\n\nconst presentation = {\n  \"@context\": [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  \"type\": [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: presentationSubmission,\n  verifiableCredential: selectedCredentials\n};\n\n// Presentation would be signed and sent to verifier\n```\n\n#### Utilities\nIn addition to the core functionality above, the underlying validation methods are exposed as low-level helper functions.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  ...\n};\n\nconst {warnings: pdWarnings, errors: pdErrors} = pejs.validateDefinition(presentationDefinition);\n\nconst presentationSubmission = {\n  ...\n};\n\nconst {warnings: psWarnings, errors: psErrors} = pejs.validateSubmission(presentationSubmission);\n```\n\n## API\n\n### Evaluate\n```typescript\nevaluate(presentationDefinition, verifiablePresentation)\n```\n##### Description\nEvaluates whether a presentation submission meets the requested presentation definition\nSince this method will be used both **before** and **after** creating a VerifiablePresentation, we accept both _signed_ and _unsigned_ version of a presentation here. \n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `presentation` | `Presentation` | the Presentation object containing the required credentials and a `presentation_submission` object mapping back to the presentation definition |\n\n#### Return value\nIf evaluation is successful, `value` will be a non-null `PresentationSubmission` mapping the submitted credentials to the requested inputs.\n```typescript\ninterface EvaluationResults {\n  value?: PresentationSubmission;\n  warnings?: string[];\n  errors?: Error[];\n}\n```\n\n### SelectFrom\n```typescript\nselectFrom(presentationDefinition, credentials, holderDids)\n```\n##### Description\nGathers the matching credentials that fit a given presentation definition\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `credentials` | `VerifiableCredential[]` | the array of verifiable credentials to select from |\n| `holderDids` | `string[]` | the holder's dids. this can be found in VerifiablePresentation's holder property note that a wallet can have many holderDids retrieved from different places|\n\n#### Return value\n- If the selection was successful or partially successful, the `matches` array will consist of `SubmissionRequirementMatch` object(s), representing the matching credentials for each `SubmissionRequirement` in the `presentationDefinition` input parameter.\n- If the selection was not successful, the `errors` array will consist of `Checked` object(s), representing what has failed in your selection process.\n\n```typescript\nimport { Status } from './ConstraintUtils';\n\ninterface SelectResults {\n  errors?: Checked[];\n  matches?: SubmissionRequirementMatch[];\n  /**\n   * This is the parameter that pejs library user should look into to determine what to do next\n   * Status can have three values:\n   *  1. INFO: everything is fine, you can call `presentationFrom` after this method\n   *  2. WARN: method was called with more credentials than required. \n   *       To enhance credential holder's privacy it is recommended to select credentials which are absolutely required.\n   *  3. Error: the credentials you've sent didn't satisfy the requirement defined presentationDefinition object\n   */\n  areRequiredCredentialsPresent: Status;\n  /**\n   * All matched/selectable credentials\n   */\n  selectableVerifiableCredentials?: VerifiableCredential[];\n  /**\n   * Following are indexes of the verifiableCredentials passed to the selectFrom method that have been selected.\n   */\n  vcIndexes?: number[];\n  warnings?: Checked[];\n}\n\ninterface SubmissionRequirementMatch {\n  name?: string;\n  rule: Rules;\n  min?: number;\n  count?: number;\n  max?: number;\n  matches: string[];\n  from?: string[];\n  from_nested?: SubmissionRequirementMatch[]; // VerifiableCredential Address\n}\n```\n\n### PresentationFrom\n```typescript\npresentationFrom(presentationDefinition, selectedCredentials, holderDID)\n```\n##### Description\nCreates the corresponding Presentation Submission object to be included in the Verifiable Presentation response, which maps the submitted credentials to the requested inputs in the `presentationDefinition` input parameter.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `selectedCredentials` | `VerifiableCredential[]` | the array of verifiable credentials that meet the submission requirements in the presentation definition |\n| `holderDid` | `string` | the holder's DID. This can be found in VerifiablePresentation's holder property note that a wallet can have many holderDIDs retrieved from different places|\n\n#### Return value\nIf the selected credentials successfully match the submission requirements in the presentation definition, the return value will be a non-null `PresentationSubmission`\n```typescript\ninterface PresentationSubmission {\n  id?: string;\n  definition_id: string;\n  descriptor_map: Descriptor[]\n}\n```\n\n### Validation\n```typescript\nvalidateDefinition(objToValidate)\n```\n```typescript\nvalidateSubmission(objToValidate)\n```\n#### Description\nA validation utility function for `PresentationDefinition` and `PresentationSubmission` objects.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `objToValidate` | <code>PresentationDefinition &#124; PresentationSubmission</code> | the presentation definition or presentation definition to be validated |\n\n#### Return value\nThe `validate` method returns a validated results array `NonEmptyArray<Checked>` , with structure:\n```typescript\ninterface Checked {\n  tag: string;\n  status: Status;\n  message?: string;\n}\n```\nstatus can have following values `'info' | 'warn' | 'error'`\n\n\n## Workflow Diagram\n![Flow diagram](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/Sphereon-Opensource/pe-js/develop/docs/simple-scenario.puml)\n# Glossary\n\nTerm | Definition |\n---- | ---------- |\nCredential | A set of one or more claims made by an issuer. |\nVerifiable Credential |  Is a tamper-evident credential that has authorship that can be cryptographically verified. Verifiable credentials can be used to build verifiable presentations, which can also be cryptographically verified. The claims in a credential can be about different subjects. |\nPresentation Definition | Presentation Definitions are objects that articulate what proofs a Verifier requires. |\nHolder | Holders are entities that have one or more verifiable credentials in their possession. Holders are also the entities that submit proofs to Verifiers to satisfy the requirements described in a Presentation Definition.\nHolder's Did | Unique ID URI string and PKI metadata document format for describing the cryptographic keys and other fundamental PKI values linked to a unique, user-controlled, self-sovereign identifier in holder's wallet|\nVerifier | Verifiers are entities that define what proofs they require from a Holder (via a Presentation Definition) in order to proceed with an interaction. |\nIssuer | A role an entity can perform by asserting claims about one or more subjects, creating a verifiable credential from these claims, and transmitting the verifiable credential to a holder. |\nPresentation | Data derived from one or more verifiable credentials, issued by one or more issuers |\nVerifiable Presentation | Is a tamper-evident presentation encoded in such a way that authorship of the data can be trusted after a process of cryptographic verification.\n\n## Further work:\n1. Implementation of presentation-exchange v2\n2. In the [DIF documentation](https://identity.foundation/presentation-exchange/#input-evaluation) some entries are addressing `nested credentials` and `nested paths` these are currently not fully support yet.\n","licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.4.2-unstable.11","dist":{"shasum":"35f3086658515e886c2d81a7f91de0fd995e9877","integrity":"sha512-TtBFmuVWsy5gzuDcsWxGoUvxk9jPp7vnnEnzAa83fkc/9ZoRIN/8btuRZoRf00dWEdaIyuJmP1RgRV051c6KMg==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.4.2-unstable.11.tgz","fileCount":302,"unpackedSize":1201926,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhoYTyCRA9TVsSAnZWagAAX7wP/3kvTDQp+E/6jl/RfVXH\nEM+hglI7jBlOA0sbVMkNpKXIzo6difOhyy5bnswxpa6eWroD/ftvn2CwR6Eh\nOno3RCcmx/Gf6g9xu4niK/bsizMX0RSwJnflE65RL/YnI4aXgr/ch6XiKhHD\nBWtGmjfLS6yvqubl8EhDO2VUx1t93NyUaVFFoYM0YIBN7xHaqCDVimjdRLPG\nvHvvttkLzdI9/WlTUAUDKxyUgqyWvLntjyShD+s1KZfkBqtH0cL5HNHXWyzd\nhkVvVCvtQEcLgzj6KhMyyFG9+oHOT3KIJC5Ns5Roz1QT9YNt0GI8RB7RJAmZ\nQFicYLsyzbpNY3NLKVDa1MyYfnTb6NGoCe2g0Bd1UktcKAAZhzge3gW3OD6H\nAdcml/E9kjncCXUp5YoZLOMao59ZxEOiwK6YiKwDzuQiOBTQ8JYxhazqTDs5\nB6+/GGejWg5XGtkPBjqScNMyYFwHeGneRG/LH8Hgu0nMi69yfh0VFAOALglY\n3rhQrvPIEKK9ffNhHYMy22uXIFx8B58iHim4MZnq/RMbL1DlWrXdt/Rz3p7L\nrTpdD77k5q0inH8hNH+3wSJ7R2hoDTP73euzUT+T0E1zqTeGYOPgazzdrFvu\nYec+jtanvS0qSnkS7htBkmiAkLgt9ELoRC+jS3dPypq4X54CfJmrfpPQilGM\nx1p+\r\n=nYcp\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICUGqmQ44eyDYvTtP9lr+P4qKJ+xLudOVAoSoT2covumAiEAnHrn4ypsxfFTsbJ1qF3WvlLFi1MCwRqrVmXSosgxHvo="}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.4.2-unstable.11_1637975282226_0.5749341142277506"},"_hasShrinkwrap":false},"0.4.2-unstable.12":{"name":"@sphereon/pe-js","version":"0.4.2-unstable.12","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","typings":"dist/main/index.d.ts","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosure","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.json","build-dis:browser":"tsc -p tsconfig.browser.json","build-dis:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","rimraf":"^2.6.2","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":150},"readmeFilename":"README.md","readme":"<h1 align=\"center\">\n  <br>\n  <a href=\"https://www.sphereon.com\"><img src=\"https://sphereon.com/content/themes/sphereon/assets/img/logo.svg\" alt=\"Sphereon\" width=\"400\"></a>\n  <br>PE-JS   DIF Presentation Exchange JavaScript Library \n  <br>\n</h1>\n\n[![CI](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml/badge.svg)](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/Sphereon-Opensource/pe-js/branch/develop/graph/badge.svg?token=9P1JGUYA35)](https://codecov.io/gh/Sphereon-Opensource/pe-js) [![NPM Version](https://img.shields.io/npm/v/@sphereon/pe-js.svg)](https://npm.im/@sphereon/pe-js)\n\n## Active Development\n_IMPORTANT: This software still is in early development stage. As such you should expect breaking changes in APIs, we expect to keep that to a minimum though._\n\n## Background\n\nThe PE-JS Library is a general use presentation exchange library that implements the functionality described in the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/). It is written in Typescript and can be compiled to any target JavaScript version.\n\nSphereon's PE Library is useful for both verifier systems and holders (e.g. wallets) and can be used in client side browsers and mobile applications as well as on server side technology such as REST APIs (e.g. built with NodeJS). It allows anyone to add DIF Presentation Exchange logic to their existing wallets, or verifiers, without making any further assumptions about the technologies used in their products.\n\nThe presentation exchange operates generally as follows; The verifier creates a Presentation Definition asking for credentials from the holder. The definition for the credentials is sent to the holder, who returns a presentation as a response. Now the verifier will verify the presentation by checking the signature and other accompanying proofs. \n\nThe presentation exchange will ensure that the model used by the verifier, can be interpreted by the holder. It then ensures that the correct parts from the holders credentials are used to create the presentation. The PE contains all the logic to interpret the models, therefore removing the need for the verifier and holder to align their specific models.\n\nThe data objects (models) used in PE-JS are generated from Sphereon's DIF PE OpenAPI Spec component. The code for the component can be seen at [PE-OpenAPI github repository](https://github.com/Sphereon-Opensource/pe-openapi). This allows the generation of the objects in many languages and frameworks consistently by configuring the maven plugin.\n\n\n### The PE Library supports the following actions:\n\n * Creating a presentation definition / request\n * Validating a presentation definition / request to be as per specification\n * Creating a presentation submission\n * Validating a presentation submission when received\n * Input evaluations: Verification of presentation submissions to be as per presentation definition\n * Utilities: to build and use different models compliant with the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/).\n\nStateful storage or credential management should be implemented in separate libraries/ modules that make use of the underlying DIF Presentation Exchange implementation. By keeping these separate, the library will stay platform agnostic. \n\n## For PE-JS developers\n\nThis project has been created using:\n* `yarn` version 1.22.5\n* `node` version 12.22.1\n\n### Install\n```shell\nyarn install\n```\n### Build\n```shell\nyarn build\n```\n### Test\nThe test command runs:\n* `eslint`\n* `prettier`\n* `unit`\n\nYou can also run only a single section of these tests, using for example `yarn test:unit`.\n```shell\nyarn test\n```\n\n### Utility scripts\nThere are several other utility scripts that help with development.\n\n* `yarn fix` - runs `eslint --fix` as well as `prettier` to fix code style\n* `yarn cov` - generates code coverage report\n\n\n## For PE-JS Users\n\nThe library can be installed direction from npmjs via:\n\n```shell\n# install via yarn\nyarn add @sphereon/pe-js\n\n# install via npm\nnpm install @sphereon/pe-js\n```\n\nThe core functionality of the DIF Presentation Exchange can be outlined as follows:\n\n* Input Evaluation\n* Credential Query\n* Utilities\n\n#### Input Evaluation\nInput evaluation is the primary mechanism by which a verifier determines whether a presentation submission from a holder matches the requested presentation definition from the request.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  \"id\": \"32f54163-7166-48f1-93d8-ff217bdb0653\",\n  \"input_descriptors\": [\n    {\n      \"id\": \"wa_driver_license\",\n      \"name\": \"Washington State Business License\",\n      \"purpose\": \"We can only allow licensed Washington State business representatives into the WA Business Conference\",\n      \"schema\": [{\n        \"uri\": \"https://licenses.example.com/business-license.json\"\n      }]\n    }\n  ]\n};\n\nconst verifiablePresentation = {\n  '@context': [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  type: [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: {...},\n  verifiableCredential: [...],\n  proof: {...}\n}\n\nconst {value, warnings, errors} = pejs.evaluate(presentationDefinition, verifiablePresentation);\n```\n\n#### Credential Query\nA credential query allows holders to filter their set of credentials for matches to a given presentation definition.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\n// Definition from verifier request\nconst presentationDefinition = {\n  ...\n};\n\n// Example for loading credentials\nconst credentials = await secureStore.getCredentials();\n\n// Find matching credentials\nconst srMatches = pejs.selectFrom(presentationDefinition, credentials, holderDid);\n\n// An example that selects the first 'count' credentials from\n// the matches. in a real scenario, the user has to select what \n// to disclose\nconst selectedCredentials = srMatches.map(\n  ({matches, count}) => matches.slice(0, count)\n).flat();\n\n// Construct presentation submission from selected credentials\nconst presentationSubmission = pejs.presentationFrom(presentationDefinition, selectedCredentials, holderDID);\n\nconst presentation = {\n  \"@context\": [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  \"type\": [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: presentationSubmission,\n  verifiableCredential: selectedCredentials\n};\n\n// Presentation would be signed and sent to verifier\n```\n\n#### Utilities\nIn addition to the core functionality above, the underlying validation methods are exposed as low-level helper functions.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  ...\n};\n\nconst {warnings: pdWarnings, errors: pdErrors} = pejs.validateDefinition(presentationDefinition);\n\nconst presentationSubmission = {\n  ...\n};\n\nconst {warnings: psWarnings, errors: psErrors} = pejs.validateSubmission(presentationSubmission);\n```\n\n## API\n\n### Evaluate\n```typescript\nevaluate(presentationDefinition, verifiablePresentation)\n```\n##### Description\nEvaluates whether a presentation submission meets the requested presentation definition\nSince this method will be used both **before** and **after** creating a VerifiablePresentation, we accept both _signed_ and _unsigned_ version of a presentation here. \n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `presentation` | `Presentation` | the Presentation object containing the required credentials and a `presentation_submission` object mapping back to the presentation definition |\n\n#### Return value\nIf evaluation is successful, `value` will be a non-null `PresentationSubmission` mapping the submitted credentials to the requested inputs.\n```typescript\ninterface EvaluationResults {\n  value?: PresentationSubmission;\n  warnings?: string[];\n  errors?: Error[];\n}\n```\n\n### SelectFrom\n```typescript\nselectFrom(presentationDefinition, credentials, holderDids)\n```\n##### Description\nGathers the matching credentials that fit a given presentation definition\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `credentials` | `VerifiableCredential[]` | the array of verifiable credentials to select from |\n| `holderDids` | `string[]` | the holder's dids. this can be found in VerifiablePresentation's holder property note that a wallet can have many holderDids retrieved from different places|\n\n#### Return value\n- If the selection was successful or partially successful, the `matches` array will consist of `SubmissionRequirementMatch` object(s), representing the matching credentials for each `SubmissionRequirement` in the `presentationDefinition` input parameter.\n- If the selection was not successful, the `errors` array will consist of `Checked` object(s), representing what has failed in your selection process.\n\n```typescript\nimport { Status } from './ConstraintUtils';\n\ninterface SelectResults {\n  errors?: Checked[];\n  matches?: SubmissionRequirementMatch[];\n  /**\n   * This is the parameter that pejs library user should look into to determine what to do next\n   * Status can have three values:\n   *  1. INFO: everything is fine, you can call `presentationFrom` after this method\n   *  2. WARN: method was called with more credentials than required. \n   *       To enhance credential holder's privacy it is recommended to select credentials which are absolutely required.\n   *  3. Error: the credentials you've sent didn't satisfy the requirement defined presentationDefinition object\n   */\n  areRequiredCredentialsPresent: Status;\n  /**\n   * All matched/selectable credentials\n   */\n  selectableVerifiableCredentials?: VerifiableCredential[];\n  /**\n   * Following are indexes of the verifiableCredentials passed to the selectFrom method that have been selected.\n   */\n  vcIndexes?: number[];\n  warnings?: Checked[];\n}\n\ninterface SubmissionRequirementMatch {\n  name?: string;\n  rule: Rules;\n  min?: number;\n  count?: number;\n  max?: number;\n  matches: string[];\n  from?: string[];\n  from_nested?: SubmissionRequirementMatch[]; // VerifiableCredential Address\n}\n```\n\n### PresentationFrom\n```typescript\npresentationFrom(presentationDefinition, selectedCredentials, holderDID)\n```\n##### Description\nCreates the corresponding Presentation Submission object to be included in the Verifiable Presentation response, which maps the submitted credentials to the requested inputs in the `presentationDefinition` input parameter.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `selectedCredentials` | `VerifiableCredential[]` | the array of verifiable credentials that meet the submission requirements in the presentation definition |\n| `holderDid` | `string` | the holder's DID. This can be found in VerifiablePresentation's holder property note that a wallet can have many holderDIDs retrieved from different places|\n\n#### Return value\nIf the selected credentials successfully match the submission requirements in the presentation definition, the return value will be a non-null `PresentationSubmission`\n```typescript\ninterface PresentationSubmission {\n  id?: string;\n  definition_id: string;\n  descriptor_map: Descriptor[]\n}\n```\n\n### Validation\n```typescript\nvalidateDefinition(objToValidate)\n```\n```typescript\nvalidateSubmission(objToValidate)\n```\n#### Description\nA validation utility function for `PresentationDefinition` and `PresentationSubmission` objects.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `objToValidate` | <code>PresentationDefinition &#124; PresentationSubmission</code> | the presentation definition or presentation definition to be validated |\n\n#### Return value\nThe `validate` method returns a validated results array `NonEmptyArray<Checked>` , with structure:\n```typescript\ninterface Checked {\n  tag: string;\n  status: Status;\n  message?: string;\n}\n```\nstatus can have following values `'info' | 'warn' | 'error'`\n\n\n## Workflow Diagram\n![Flow diagram](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/Sphereon-Opensource/pe-js/develop/docs/simple-scenario.puml)\n# Glossary\n\nTerm | Definition |\n---- | ---------- |\nCredential | A set of one or more claims made by an issuer. |\nVerifiable Credential |  Is a tamper-evident credential that has authorship that can be cryptographically verified. Verifiable credentials can be used to build verifiable presentations, which can also be cryptographically verified. The claims in a credential can be about different subjects. |\nPresentation Definition | Presentation Definitions are objects that articulate what proofs a Verifier requires. |\nHolder | Holders are entities that have one or more verifiable credentials in their possession. Holders are also the entities that submit proofs to Verifiers to satisfy the requirements described in a Presentation Definition.\nHolder's Did | Unique ID URI string and PKI metadata document format for describing the cryptographic keys and other fundamental PKI values linked to a unique, user-controlled, self-sovereign identifier in holder's wallet|\nVerifier | Verifiers are entities that define what proofs they require from a Holder (via a Presentation Definition) in order to proceed with an interaction. |\nIssuer | A role an entity can perform by asserting claims about one or more subjects, creating a verifiable credential from these claims, and transmitting the verifiable credential to a holder. |\nPresentation | Data derived from one or more verifiable credentials, issued by one or more issuers |\nVerifiable Presentation | Is a tamper-evident presentation encoded in such a way that authorship of the data can be trusted after a process of cryptographic verification.\n\n## Further work:\n1. Implementation of presentation-exchange v2\n2. In the [DIF documentation](https://identity.foundation/presentation-exchange/#input-evaluation) some entries are addressing `nested credentials` and `nested paths` these are currently not fully support yet.\n","licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.4.2-unstable.12","dist":{"shasum":"f2f29b3c18d3981639c754eca809707ba0f95745","integrity":"sha512-NCxe6s4MuHkb1xVSi/Ub58XZsFRVQmSyI/Azr1AaFTE65abuEq18tb/F1TShYtbYHlSxtzsmd651mtsIeEtZhQ==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.4.2-unstable.12.tgz","fileCount":196,"unpackedSize":1035701,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhoYamCRA9TVsSAnZWagAApi8P/ivRlHNaN//b5t+k4Kws\n5KHiUYbSDBUzX+l6q5TE3YqHfwHqrqYBxhziAf/R0gy9iMjrfhZfRxc9wp50\nLbNEj3kesgPhLiDeFjXIUYe0hpr3kQArnynGJGE4Y69mcJxwF+wjSOgjK0Sa\n2dPSOXUOgYKrfqhOxTPxne5/wv6lGXlXgg5XT4IZez6nKqHnQLo5IgSVDmZN\nDFIJOnf4MlTHrw+cKD7vI3HW2fJ0iioy9tzaQlGziRlbcFc9Go00OjSx04CE\nXux7VnEpqPpvJkoZCmzLiVisiVmqSYqUbJ0n1ivqK4+niVNWCcLlguKlrfAz\npyLoPfO9lLjxwW3nFNhiflRZEXmHcwigfltW707VPpEvAO6y+ROwujMeQU8W\n0LMgwOwlCYk3xBu6ua0GJ5ydwoaTHDT6DQF1XrJgm/zUUcXkjnk7Bsmae3L5\nfPtWnciiqnmGioWv3xK/X/iV8hRaZNEcrrURlNyYrOOR5XKTaxtQRCq1o3yz\niVs95kV6yi/TLj9ZAJITn5TkqHRojMOSoxpD8wsb+DCfYFyzMh8NY92LPkM1\nqNqmyROmsGe4gFl+iNzTw39jkYBjzMUoT+ojrsObmPf8X8XC1Og8tZ34rjwV\nYoGY1mN41tN8g/6CHdn23dDl66pTGh5qqW/iDJ2ytuB4XePaZ3xRipg3ylfY\nXY0T\r\n=e8Iv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD+g5ysoMJIb/x+mGLIPSDGvcuNoqwt298jBbqAON9W4QIhAIVyYo7UBG6vObDlcXR8Qm3vKRDLYiyNmtqbJqyb31nD"}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.4.2-unstable.12_1637975718071_0.8582158402694711"},"_hasShrinkwrap":false},"0.4.2-unstable.13":{"name":"@sphereon/pe-js","version":"0.4.2-unstable.13","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","typings":"dist/main/index.d.ts","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosure","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build-dis:browser":"tsc -p tsconfig.browser.json","build-dis:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","rimraf":"^2.6.2","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":150},"readmeFilename":"README.md","readme":"<h1 align=\"center\">\n  <br>\n  <a href=\"https://www.sphereon.com\"><img src=\"https://sphereon.com/content/themes/sphereon/assets/img/logo.svg\" alt=\"Sphereon\" width=\"400\"></a>\n  <br>PE-JS   DIF Presentation Exchange JavaScript Library \n  <br>\n</h1>\n\n[![CI](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml/badge.svg)](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/Sphereon-Opensource/pe-js/branch/develop/graph/badge.svg?token=9P1JGUYA35)](https://codecov.io/gh/Sphereon-Opensource/pe-js) [![NPM Version](https://img.shields.io/npm/v/@sphereon/pe-js.svg)](https://npm.im/@sphereon/pe-js)\n\n## Active Development\n_IMPORTANT: This software still is in early development stage. As such you should expect breaking changes in APIs, we expect to keep that to a minimum though._\n\n## Background\n\nThe PE-JS Library is a general use presentation exchange library that implements the functionality described in the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/). It is written in Typescript and can be compiled to any target JavaScript version.\n\nSphereon's PE Library is useful for both verifier systems and holders (e.g. wallets) and can be used in client side browsers and mobile applications as well as on server side technology such as REST APIs (e.g. built with NodeJS). It allows anyone to add DIF Presentation Exchange logic to their existing wallets, or verifiers, without making any further assumptions about the technologies used in their products.\n\nThe presentation exchange operates generally as follows; The verifier creates a Presentation Definition asking for credentials from the holder. The definition for the credentials is sent to the holder, who returns a presentation as a response. Now the verifier will verify the presentation by checking the signature and other accompanying proofs. \n\nThe presentation exchange will ensure that the model used by the verifier, can be interpreted by the holder. It then ensures that the correct parts from the holders credentials are used to create the presentation. The PE contains all the logic to interpret the models, therefore removing the need for the verifier and holder to align their specific models.\n\nThe data objects (models) used in PE-JS are generated from Sphereon's DIF PE OpenAPI Spec component. The code for the component can be seen at [PE-OpenAPI github repository](https://github.com/Sphereon-Opensource/pe-openapi). This allows the generation of the objects in many languages and frameworks consistently by configuring the maven plugin.\n\n\n### The PE Library supports the following actions:\n\n * Creating a presentation definition / request\n * Validating a presentation definition / request to be as per specification\n * Creating a presentation submission\n * Validating a presentation submission when received\n * Input evaluations: Verification of presentation submissions to be as per presentation definition\n * Utilities: to build and use different models compliant with the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/).\n\nStateful storage or credential management should be implemented in separate libraries/ modules that make use of the underlying DIF Presentation Exchange implementation. By keeping these separate, the library will stay platform agnostic. \n\n## For PE-JS developers\n\nThis project has been created using:\n* `yarn` version 1.22.5\n* `node` version 12.22.1\n\n### Install\n```shell\nyarn install\n```\n### Build\n```shell\nyarn build\n```\n### Test\nThe test command runs:\n* `eslint`\n* `prettier`\n* `unit`\n\nYou can also run only a single section of these tests, using for example `yarn test:unit`.\n```shell\nyarn test\n```\n\n### Utility scripts\nThere are several other utility scripts that help with development.\n\n* `yarn fix` - runs `eslint --fix` as well as `prettier` to fix code style\n* `yarn cov` - generates code coverage report\n\n\n## For PE-JS Users\n\nThe library can be installed direction from npmjs via:\n\n```shell\n# install via yarn\nyarn add @sphereon/pe-js\n\n# install via npm\nnpm install @sphereon/pe-js\n```\n\nThe core functionality of the DIF Presentation Exchange can be outlined as follows:\n\n* Input Evaluation\n* Credential Query\n* Utilities\n\n#### Input Evaluation\nInput evaluation is the primary mechanism by which a verifier determines whether a presentation submission from a holder matches the requested presentation definition from the request.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  \"id\": \"32f54163-7166-48f1-93d8-ff217bdb0653\",\n  \"input_descriptors\": [\n    {\n      \"id\": \"wa_driver_license\",\n      \"name\": \"Washington State Business License\",\n      \"purpose\": \"We can only allow licensed Washington State business representatives into the WA Business Conference\",\n      \"schema\": [{\n        \"uri\": \"https://licenses.example.com/business-license.json\"\n      }]\n    }\n  ]\n};\n\nconst verifiablePresentation = {\n  '@context': [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  type: [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: {...},\n  verifiableCredential: [...],\n  proof: {...}\n}\n\nconst {value, warnings, errors} = pejs.evaluate(presentationDefinition, verifiablePresentation);\n```\n\n#### Credential Query\nA credential query allows holders to filter their set of credentials for matches to a given presentation definition.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\n// Definition from verifier request\nconst presentationDefinition = {\n  ...\n};\n\n// Example for loading credentials\nconst credentials = await secureStore.getCredentials();\n\n// Find matching credentials\nconst srMatches = pejs.selectFrom(presentationDefinition, credentials, holderDid);\n\n// An example that selects the first 'count' credentials from\n// the matches. in a real scenario, the user has to select what \n// to disclose\nconst selectedCredentials = srMatches.map(\n  ({matches, count}) => matches.slice(0, count)\n).flat();\n\n// Construct presentation submission from selected credentials\nconst presentationSubmission = pejs.presentationFrom(presentationDefinition, selectedCredentials, holderDID);\n\nconst presentation = {\n  \"@context\": [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  \"type\": [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: presentationSubmission,\n  verifiableCredential: selectedCredentials\n};\n\n// Presentation would be signed and sent to verifier\n```\n\n#### Utilities\nIn addition to the core functionality above, the underlying validation methods are exposed as low-level helper functions.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  ...\n};\n\nconst {warnings: pdWarnings, errors: pdErrors} = pejs.validateDefinition(presentationDefinition);\n\nconst presentationSubmission = {\n  ...\n};\n\nconst {warnings: psWarnings, errors: psErrors} = pejs.validateSubmission(presentationSubmission);\n```\n\n## API\n\n### Evaluate\n```typescript\nevaluate(presentationDefinition, verifiablePresentation)\n```\n##### Description\nEvaluates whether a presentation submission meets the requested presentation definition\nSince this method will be used both **before** and **after** creating a VerifiablePresentation, we accept both _signed_ and _unsigned_ version of a presentation here. \n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `presentation` | `Presentation` | the Presentation object containing the required credentials and a `presentation_submission` object mapping back to the presentation definition |\n\n#### Return value\nIf evaluation is successful, `value` will be a non-null `PresentationSubmission` mapping the submitted credentials to the requested inputs.\n```typescript\ninterface EvaluationResults {\n  value?: PresentationSubmission;\n  warnings?: string[];\n  errors?: Error[];\n}\n```\n\n### SelectFrom\n```typescript\nselectFrom(presentationDefinition, credentials, holderDids)\n```\n##### Description\nGathers the matching credentials that fit a given presentation definition\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `credentials` | `VerifiableCredential[]` | the array of verifiable credentials to select from |\n| `holderDids` | `string[]` | the holder's dids. this can be found in VerifiablePresentation's holder property note that a wallet can have many holderDids retrieved from different places|\n\n#### Return value\n- If the selection was successful or partially successful, the `matches` array will consist of `SubmissionRequirementMatch` object(s), representing the matching credentials for each `SubmissionRequirement` in the `presentationDefinition` input parameter.\n- If the selection was not successful, the `errors` array will consist of `Checked` object(s), representing what has failed in your selection process.\n\n```typescript\nimport { Status } from './ConstraintUtils';\n\ninterface SelectResults {\n  errors?: Checked[];\n  matches?: SubmissionRequirementMatch[];\n  /**\n   * This is the parameter that pejs library user should look into to determine what to do next\n   * Status can have three values:\n   *  1. INFO: everything is fine, you can call `presentationFrom` after this method\n   *  2. WARN: method was called with more credentials than required. \n   *       To enhance credential holder's privacy it is recommended to select credentials which are absolutely required.\n   *  3. Error: the credentials you've sent didn't satisfy the requirement defined presentationDefinition object\n   */\n  areRequiredCredentialsPresent: Status;\n  /**\n   * All matched/selectable credentials\n   */\n  selectableVerifiableCredentials?: VerifiableCredential[];\n  /**\n   * Following are indexes of the verifiableCredentials passed to the selectFrom method that have been selected.\n   */\n  vcIndexes?: number[];\n  warnings?: Checked[];\n}\n\ninterface SubmissionRequirementMatch {\n  name?: string;\n  rule: Rules;\n  min?: number;\n  count?: number;\n  max?: number;\n  matches: string[];\n  from?: string[];\n  from_nested?: SubmissionRequirementMatch[]; // VerifiableCredential Address\n}\n```\n\n### PresentationFrom\n```typescript\npresentationFrom(presentationDefinition, selectedCredentials, holderDID)\n```\n##### Description\nCreates the corresponding Presentation Submission object to be included in the Verifiable Presentation response, which maps the submitted credentials to the requested inputs in the `presentationDefinition` input parameter.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `selectedCredentials` | `VerifiableCredential[]` | the array of verifiable credentials that meet the submission requirements in the presentation definition |\n| `holderDid` | `string` | the holder's DID. This can be found in VerifiablePresentation's holder property note that a wallet can have many holderDIDs retrieved from different places|\n\n#### Return value\nIf the selected credentials successfully match the submission requirements in the presentation definition, the return value will be a non-null `PresentationSubmission`\n```typescript\ninterface PresentationSubmission {\n  id?: string;\n  definition_id: string;\n  descriptor_map: Descriptor[]\n}\n```\n\n### Validation\n```typescript\nvalidateDefinition(objToValidate)\n```\n```typescript\nvalidateSubmission(objToValidate)\n```\n#### Description\nA validation utility function for `PresentationDefinition` and `PresentationSubmission` objects.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `objToValidate` | <code>PresentationDefinition &#124; PresentationSubmission</code> | the presentation definition or presentation definition to be validated |\n\n#### Return value\nThe `validate` method returns a validated results array `NonEmptyArray<Checked>` , with structure:\n```typescript\ninterface Checked {\n  tag: string;\n  status: Status;\n  message?: string;\n}\n```\nstatus can have following values `'info' | 'warn' | 'error'`\n\n\n## Workflow Diagram\n![Flow diagram](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/Sphereon-Opensource/pe-js/develop/docs/simple-scenario.puml)\n# Glossary\n\nTerm | Definition |\n---- | ---------- |\nCredential | A set of one or more claims made by an issuer. |\nVerifiable Credential |  Is a tamper-evident credential that has authorship that can be cryptographically verified. Verifiable credentials can be used to build verifiable presentations, which can also be cryptographically verified. The claims in a credential can be about different subjects. |\nPresentation Definition | Presentation Definitions are objects that articulate what proofs a Verifier requires. |\nHolder | Holders are entities that have one or more verifiable credentials in their possession. Holders are also the entities that submit proofs to Verifiers to satisfy the requirements described in a Presentation Definition.\nHolder's Did | Unique ID URI string and PKI metadata document format for describing the cryptographic keys and other fundamental PKI values linked to a unique, user-controlled, self-sovereign identifier in holder's wallet|\nVerifier | Verifiers are entities that define what proofs they require from a Holder (via a Presentation Definition) in order to proceed with an interaction. |\nIssuer | A role an entity can perform by asserting claims about one or more subjects, creating a verifiable credential from these claims, and transmitting the verifiable credential to a holder. |\nPresentation | Data derived from one or more verifiable credentials, issued by one or more issuers |\nVerifiable Presentation | Is a tamper-evident presentation encoded in such a way that authorship of the data can be trusted after a process of cryptographic verification.\n\n## Further work:\n1. Implementation of presentation-exchange v2\n2. In the [DIF documentation](https://identity.foundation/presentation-exchange/#input-evaluation) some entries are addressing `nested credentials` and `nested paths` these are currently not fully support yet.\n","licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.4.2-unstable.13","dist":{"shasum":"f1e4b8ce0a68517fde46607b136df918127eb881","integrity":"sha512-8ZuOeVS7gWvY7cR34c+cRAxXr3fAOIq0IGTxt/sF4ZlZApissoudjFcVkdQl1sW4dtIwhO2xwHmogRQeF7d+cA==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.4.2-unstable.13.tgz","fileCount":196,"unpackedSize":1038030,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhoY0nCRA9TVsSAnZWagAACKQP/2HK3zIdnoo5h1krYrUb\nl9YT9Q9yXg2ML+EB+QmrQoHcTW0SPQRT0IWAqvFEXlVPS2sSZ5h66IpoqP53\naniLdildQJm3hx457Nrl/eCPsJqia4/TS9U7465G1GYgWrhfrG+wPax0P7Xz\nAiep/SXy7rLLIaHYzgxe7C/mcJU8shrSqnvg1VZQ3LrGLDeP6cNGrsjFkiOS\neX0jX0qRebn65T7ItwyqouT6bgF2WOM+rM9EqA8OIHDYjeZZLorU6wEPStaL\n0d6v6zv0yl9aE4wMIpo9iuZKkfSLlnWM0lPYHPG7rhGcXGbt6XAW6DIS2G6H\nCBgISrSFiXBusjjyzwUnfULeNIQPCb6E4D0I9hPepfQnjzWdK0fEWPWVZ4WZ\noygHsc0b78HD/Drr3BwZhaTIV4MkA9FDGDl4Pf+QOG3dhBoFB/9qaiWV5sXT\nqCcCLrmphKQCZgyHWAyNHWQBwW86RXERzTAqAepiI2N2sOHNchSeikAeVxUX\nwQydK8M3yU4LhG+6XjLWlfk9UPQYGK8ntFyOvLyPQ0bmS2PM6zZ/uzNbEr5G\nyCZG6tc2lffXdWc536IuXu62/4cYdCtIVlBaGhYnf3MY9+WxFSCAXpiYb7Vt\nwy0L2CVUTBbx5jvd5u5ALabu7r2r6BBHK80HFsWE/bjSMp40C8FUDmeyZEnL\nyLBi\r\n=S9bd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDIZ9xn1jdLtTWTjy5Y7tddZPqae8Hf3tUqHw6t64oe8AiEA3ppyvfJD1QTj6yaz9CJJzeHT8ZJiElHvUXSFGOVq8ts="}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.4.2-unstable.13_1637977383788_0.7938648415451577"},"_hasShrinkwrap":false},"0.4.2-unstable.14":{"name":"@sphereon/pe-js","version":"0.4.2-unstable.14","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","typings":"dist/main/index.d.ts","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosure","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build-dis:browser":"tsc -p tsconfig.browser.json","build-dis:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","rimraf":"^2.6.2","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":150},"readmeFilename":"README.md","readme":"<h1 align=\"center\">\n  <br>\n  <a href=\"https://www.sphereon.com\"><img src=\"https://sphereon.com/content/themes/sphereon/assets/img/logo.svg\" alt=\"Sphereon\" width=\"400\"></a>\n  <br>PE-JS   DIF Presentation Exchange JavaScript Library \n  <br>\n</h1>\n\n[![CI](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml/badge.svg)](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/Sphereon-Opensource/pe-js/branch/develop/graph/badge.svg?token=9P1JGUYA35)](https://codecov.io/gh/Sphereon-Opensource/pe-js) [![NPM Version](https://img.shields.io/npm/v/@sphereon/pe-js.svg)](https://npm.im/@sphereon/pe-js)\n\n## Active Development\n_IMPORTANT: This software still is in early development stage. As such you should expect breaking changes in APIs, we expect to keep that to a minimum though._\n\n## Background\n\nThe PE-JS Library is a general use presentation exchange library that implements the functionality described in the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/). It is written in Typescript and can be compiled to any target JavaScript version.\n\nSphereon's PE Library is useful for both verifier systems and holders (e.g. wallets) and can be used in client side browsers and mobile applications as well as on server side technology such as REST APIs (e.g. built with NodeJS). It allows anyone to add DIF Presentation Exchange logic to their existing wallets, or verifiers, without making any further assumptions about the technologies used in their products.\n\nThe presentation exchange operates generally as follows; The verifier creates a Presentation Definition asking for credentials from the holder. The definition for the credentials is sent to the holder, who returns a presentation as a response. Now the verifier will verify the presentation by checking the signature and other accompanying proofs. \n\nThe presentation exchange will ensure that the model used by the verifier, can be interpreted by the holder. It then ensures that the correct parts from the holders credentials are used to create the presentation. The PE contains all the logic to interpret the models, therefore removing the need for the verifier and holder to align their specific models.\n\nThe data objects (models) used in PE-JS are generated from Sphereon's DIF PE OpenAPI Spec component. The code for the component can be seen at [PE-OpenAPI github repository](https://github.com/Sphereon-Opensource/pe-openapi). This allows the generation of the objects in many languages and frameworks consistently by configuring the maven plugin.\n\n\n### The PE Library supports the following actions:\n\n * Creating a presentation definition / request\n * Validating a presentation definition / request to be as per specification\n * Creating a presentation submission\n * Validating a presentation submission when received\n * Input evaluations: Verification of presentation submissions to be as per presentation definition\n * Utilities: to build and use different models compliant with the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/).\n\nStateful storage or credential management should be implemented in separate libraries/ modules that make use of the underlying DIF Presentation Exchange implementation. By keeping these separate, the library will stay platform agnostic. \n\n## For PE-JS developers\n\nThis project has been created using:\n* `yarn` version 1.22.5\n* `node` version 12.22.1\n\n### Install\n```shell\nyarn install\n```\n### Build\n```shell\nyarn build\n```\n### Test\nThe test command runs:\n* `eslint`\n* `prettier`\n* `unit`\n\nYou can also run only a single section of these tests, using for example `yarn test:unit`.\n```shell\nyarn test\n```\n\n### Utility scripts\nThere are several other utility scripts that help with development.\n\n* `yarn fix` - runs `eslint --fix` as well as `prettier` to fix code style\n* `yarn cov` - generates code coverage report\n\n\n## For PE-JS Users\n\nThe library can be installed direction from npmjs via:\n\n```shell\n# install via yarn\nyarn add @sphereon/pe-js\n\n# install via npm\nnpm install @sphereon/pe-js\n```\n\nThe core functionality of the DIF Presentation Exchange can be outlined as follows:\n\n* Input Evaluation\n* Credential Query\n* Utilities\n\n#### Input Evaluation\nInput evaluation is the primary mechanism by which a verifier determines whether a presentation submission from a holder matches the requested presentation definition from the request.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  \"id\": \"32f54163-7166-48f1-93d8-ff217bdb0653\",\n  \"input_descriptors\": [\n    {\n      \"id\": \"wa_driver_license\",\n      \"name\": \"Washington State Business License\",\n      \"purpose\": \"We can only allow licensed Washington State business representatives into the WA Business Conference\",\n      \"schema\": [{\n        \"uri\": \"https://licenses.example.com/business-license.json\"\n      }]\n    }\n  ]\n};\n\nconst verifiablePresentation = {\n  '@context': [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  type: [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: {...},\n  verifiableCredential: [...],\n  proof: {...}\n}\n\nconst {value, warnings, errors} = pejs.evaluate(presentationDefinition, verifiablePresentation);\n```\n\n#### Credential Query\nA credential query allows holders to filter their set of credentials for matches to a given presentation definition.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\n// Definition from verifier request\nconst presentationDefinition = {\n  ...\n};\n\n// Example for loading credentials\nconst credentials = await secureStore.getCredentials();\n\n// Find matching credentials\nconst srMatches = pejs.selectFrom(presentationDefinition, credentials, holderDid);\n\n// An example that selects the first 'count' credentials from\n// the matches. in a real scenario, the user has to select what \n// to disclose\nconst selectedCredentials = srMatches.map(\n  ({matches, count}) => matches.slice(0, count)\n).flat();\n\n// Construct presentation submission from selected credentials\nconst presentationSubmission = pejs.presentationFrom(presentationDefinition, selectedCredentials, holderDID);\n\nconst presentation = {\n  \"@context\": [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  \"type\": [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: presentationSubmission,\n  verifiableCredential: selectedCredentials\n};\n\n// Presentation would be signed and sent to verifier\n```\n\n#### Utilities\nIn addition to the core functionality above, the underlying validation methods are exposed as low-level helper functions.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  ...\n};\n\nconst {warnings: pdWarnings, errors: pdErrors} = pejs.validateDefinition(presentationDefinition);\n\nconst presentationSubmission = {\n  ...\n};\n\nconst {warnings: psWarnings, errors: psErrors} = pejs.validateSubmission(presentationSubmission);\n```\n\n## API\n\n### Evaluate\n```typescript\nevaluate(presentationDefinition, verifiablePresentation)\n```\n##### Description\nEvaluates whether a presentation submission meets the requested presentation definition\nSince this method will be used both **before** and **after** creating a VerifiablePresentation, we accept both _signed_ and _unsigned_ version of a presentation here. \n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `presentation` | `Presentation` | the Presentation object containing the required credentials and a `presentation_submission` object mapping back to the presentation definition |\n\n#### Return value\nIf evaluation is successful, `value` will be a non-null `PresentationSubmission` mapping the submitted credentials to the requested inputs.\n```typescript\ninterface EvaluationResults {\n  value?: PresentationSubmission;\n  warnings?: string[];\n  errors?: Error[];\n}\n```\n\n### SelectFrom\n```typescript\nselectFrom(presentationDefinition, credentials, holderDids)\n```\n##### Description\nGathers the matching credentials that fit a given presentation definition\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `credentials` | `VerifiableCredential[]` | the array of verifiable credentials to select from |\n| `holderDids` | `string[]` | the holder's dids. this can be found in VerifiablePresentation's holder property note that a wallet can have many holderDids retrieved from different places|\n\n#### Return value\n- If the selection was successful or partially successful, the `matches` array will consist of `SubmissionRequirementMatch` object(s), representing the matching credentials for each `SubmissionRequirement` in the `presentationDefinition` input parameter.\n- If the selection was not successful, the `errors` array will consist of `Checked` object(s), representing what has failed in your selection process.\n\n```typescript\nimport { Status } from './ConstraintUtils';\n\ninterface SelectResults {\n  errors?: Checked[];\n  matches?: SubmissionRequirementMatch[];\n  /**\n   * This is the parameter that pejs library user should look into to determine what to do next\n   * Status can have three values:\n   *  1. INFO: everything is fine, you can call `presentationFrom` after this method\n   *  2. WARN: method was called with more credentials than required. \n   *       To enhance credential holder's privacy it is recommended to select credentials which are absolutely required.\n   *  3. Error: the credentials you've sent didn't satisfy the requirement defined presentationDefinition object\n   */\n  areRequiredCredentialsPresent: Status;\n  /**\n   * All matched/selectable credentials\n   */\n  verifiableCredential?: VerifiableCredential[];\n  /**\n   * Following are indexes of the verifiableCredentials passed to the selectFrom method that have been selected.\n   */\n  vcIndexes?: number[];\n  warnings?: Checked[];\n}\n\ninterface SubmissionRequirementMatch {\n  name?: string;\n  rule: Rules;\n  min?: number;\n  count?: number;\n  max?: number;\n  matches: string[];\n  from?: string[];\n  from_nested?: SubmissionRequirementMatch[]; // VerifiableCredential Address\n}\n```\n\n### PresentationFrom\n```typescript\npresentationFrom(presentationDefinition, selectedCredentials, holderDID)\n```\n##### Description\nCreates the corresponding Presentation Submission object to be included in the Verifiable Presentation response, which maps the submitted credentials to the requested inputs in the `presentationDefinition` input parameter.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `selectedCredentials` | `VerifiableCredential[]` | the array of verifiable credentials that meet the submission requirements in the presentation definition |\n| `holderDid` | `string` | the holder's DID. This can be found in VerifiablePresentation's holder property note that a wallet can have many holderDIDs retrieved from different places|\n\n#### Return value\nIf the selected credentials successfully match the submission requirements in the presentation definition, the return value will be a non-null `PresentationSubmission`\n```typescript\ninterface PresentationSubmission {\n  id?: string;\n  definition_id: string;\n  descriptor_map: Descriptor[]\n}\n```\n\n### Validation\n```typescript\nvalidateDefinition(objToValidate)\n```\n```typescript\nvalidateSubmission(objToValidate)\n```\n#### Description\nA validation utility function for `PresentationDefinition` and `PresentationSubmission` objects.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `objToValidate` | <code>PresentationDefinition &#124; PresentationSubmission</code> | the presentation definition or presentation definition to be validated |\n\n#### Return value\nThe `validate` method returns a validated results array `NonEmptyArray<Checked>` , with structure:\n```typescript\ninterface Checked {\n  tag: string;\n  status: Status;\n  message?: string;\n}\n```\nstatus can have following values `'info' | 'warn' | 'error'`\n\n\n## Workflow Diagram\n![Flow diagram](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/Sphereon-Opensource/pe-js/develop/docs/simple-scenario.puml)\n# Glossary\n\nTerm | Definition |\n---- | ---------- |\nCredential | A set of one or more claims made by an issuer. |\nVerifiable Credential |  Is a tamper-evident credential that has authorship that can be cryptographically verified. Verifiable credentials can be used to build verifiable presentations, which can also be cryptographically verified. The claims in a credential can be about different subjects. |\nPresentation Definition | Presentation Definitions are objects that articulate what proofs a Verifier requires. |\nHolder | Holders are entities that have one or more verifiable credentials in their possession. Holders are also the entities that submit proofs to Verifiers to satisfy the requirements described in a Presentation Definition.\nHolder's Did | Unique ID URI string and PKI metadata document format for describing the cryptographic keys and other fundamental PKI values linked to a unique, user-controlled, self-sovereign identifier in holder's wallet|\nVerifier | Verifiers are entities that define what proofs they require from a Holder (via a Presentation Definition) in order to proceed with an interaction. |\nIssuer | A role an entity can perform by asserting claims about one or more subjects, creating a verifiable credential from these claims, and transmitting the verifiable credential to a holder. |\nPresentation | Data derived from one or more verifiable credentials, issued by one or more issuers |\nVerifiable Presentation | Is a tamper-evident presentation encoded in such a way that authorship of the data can be trusted after a process of cryptographic verification.\n\n## Further work:\n1. Implementation of presentation-exchange v2\n2. In the [DIF documentation](https://identity.foundation/presentation-exchange/#input-evaluation) some entries are addressing `nested credentials` and `nested paths` these are currently not fully support yet.\n","licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.4.2-unstable.14","dist":{"shasum":"b02f09b5049da543a4acda2ede187de541ad5d7b","integrity":"sha512-JVSBJs5V7aWnUXYTdHdIRVxpwvPK/eGp6yS5+5iT3Il3Qh+zJ0AEuIpvr+ytKytVodyOCOx65sNLVvcoGFFsTQ==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.4.2-unstable.14.tgz","fileCount":196,"unpackedSize":1038553,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhobdZCRA9TVsSAnZWagAAcK8P/2bXd7PIk6bUwaXCQViO\niTMe2S9H2EJWeII4g2vdj+wAec+QQ0k2hNAB59PIhyXMf44bleU2DQcinJ3w\nYeh2OZ6R6bVRyqk+4XqL25SgAO4gqhStJYR2czRsd6LJTvodp5GQtYaFyEmK\nzV8v79NiPoVGk7eJxua7QuBVBMw88e7OQeiKMKBZMokKOv3lZ7jRW6ytS5ps\n04BYtvLVETPtSKv9t9feQmNwUPBucju7bfzV/59OS/JmEuH5rhpoH1YGaZSJ\nCnG4yj6gxP0siTYRLhuw7jYgxkgWKYc3gSWTfbdGd5Pq/9QBhHqa1J3zZEpR\nB/xr2OP/AQvRLMY78JvCYTOU2huagHgFQfUyyG/OEuyIjVyOO/7teaTeN2CL\n+Ezzh0EBqfwDEo5EldvuzQCAKTiUlv8O2l3gPV++Nh1y4Rp0Eugx/QGJJATe\nP9nMpReNOQPlQ3oA9nRO7O/77PfcdV+D2oSmKfik7/ehBhj1RCpUuxPHosjD\naKqPRRMwkZT2toaq0bVJzTJ6T7P0iKms7LMMaFxje0H1jlvkOqhZtzMY+79F\nmjGFBlP90UFeN/cmcC+6jIVVHkPHVBgRLbNmwbIsBMinOCz4dXjwyIQrYY9c\npIyEOTf0ZKNIhEwehBCVHa9ywqS/lngNgqdh+aZyxCwGH7om2/4BdCWAG9kJ\n/IRp\r\n=zvf4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCWPUEsGOvGkR8iVGzRtpNXWbOs6h8+q1Hot5hILXb4hwIhALtPl3sR0bJTAMEVe05xCf1sj+Q8xeKYoFJ0ccAbA2G8"}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.4.2-unstable.14_1637988185384_0.6555327277297553"},"_hasShrinkwrap":false},"0.4.2-unstable.15":{"name":"@sphereon/pe-js","version":"0.4.2-unstable.15","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","typings":"dist/main/index.d.ts","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosure","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build-dis:browser":"tsc -p tsconfig.browser.json","build-dis:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","rimraf":"^2.6.2","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":150},"readmeFilename":"README.md","readme":"<h1 align=\"center\">\n  <br>\n  <a href=\"https://www.sphereon.com\"><img src=\"https://sphereon.com/content/themes/sphereon/assets/img/logo.svg\" alt=\"Sphereon\" width=\"400\"></a>\n  <br>PE-JS   DIF Presentation Exchange JavaScript Library \n  <br>\n</h1>\n\n[![CI](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml/badge.svg)](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/Sphereon-Opensource/pe-js/branch/develop/graph/badge.svg?token=9P1JGUYA35)](https://codecov.io/gh/Sphereon-Opensource/pe-js) [![NPM Version](https://img.shields.io/npm/v/@sphereon/pe-js.svg)](https://npm.im/@sphereon/pe-js)\n\n## Active Development\n_IMPORTANT: This software still is in early development stage. As such you should expect breaking changes in APIs, we expect to keep that to a minimum though._\n\n## Background\n\nThe PE-JS Library is a general use presentation exchange library that implements the functionality described in the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/). It is written in Typescript and can be compiled to any target JavaScript version.\n\nSphereon's PE Library is useful for both verifier systems and holders (e.g. wallets) and can be used in client side browsers and mobile applications as well as on server side technology such as REST APIs (e.g. built with NodeJS). It allows anyone to add DIF Presentation Exchange logic to their existing wallets, or verifiers, without making any further assumptions about the technologies used in their products.\n\nThe presentation exchange operates generally as follows; The verifier creates a Presentation Definition asking for credentials from the holder. The definition for the credentials is sent to the holder, who returns a presentation as a response. Now the verifier will verify the presentation by checking the signature and other accompanying proofs. \n\nThe presentation exchange will ensure that the model used by the verifier, can be interpreted by the holder. It then ensures that the correct parts from the holders credentials are used to create the presentation. The PE contains all the logic to interpret the models, therefore removing the need for the verifier and holder to align their specific models.\n\nThe data objects (models) used in PE-JS are generated from Sphereon's DIF PE OpenAPI Spec component. The code for the component can be seen at [PE-OpenAPI github repository](https://github.com/Sphereon-Opensource/pe-openapi). This allows the generation of the objects in many languages and frameworks consistently by configuring the maven plugin.\n\n\n### The PE Library supports the following actions:\n\n * Creating a presentation definition / request\n * Validating a presentation definition / request to be as per specification\n * Creating a presentation submission\n * Validating a presentation submission when received\n * Input evaluations: Verification of presentation submissions to be as per presentation definition\n * Utilities: to build and use different models compliant with the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/).\n\nStateful storage or credential management should be implemented in separate libraries/ modules that make use of the underlying DIF Presentation Exchange implementation. By keeping these separate, the library will stay platform agnostic. \n\n## For PE-JS developers\n\nThis project has been created using:\n* `yarn` version 1.22.5\n* `node` version 12.22.1\n\n### Install\n```shell\nyarn install\n```\n### Build\n```shell\nyarn build\n```\n### Test\nThe test command runs:\n* `eslint`\n* `prettier`\n* `unit`\n\nYou can also run only a single section of these tests, using for example `yarn test:unit`.\n```shell\nyarn test\n```\n\n### Utility scripts\nThere are several other utility scripts that help with development.\n\n* `yarn fix` - runs `eslint --fix` as well as `prettier` to fix code style\n* `yarn cov` - generates code coverage report\n\n\n## For PE-JS Users\n\nThe library can be installed direction from npmjs via:\n\n```shell\n# install via yarn\nyarn add @sphereon/pe-js\n\n# install via npm\nnpm install @sphereon/pe-js\n```\n\nThe core functionality of the DIF Presentation Exchange can be outlined as follows:\n\n* Input Evaluation\n* Credential Query\n* Utilities\n\n#### Input Evaluation\nInput evaluation is the primary mechanism by which a verifier determines whether a presentation submission from a holder matches the requested presentation definition from the request.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  \"id\": \"32f54163-7166-48f1-93d8-ff217bdb0653\",\n  \"input_descriptors\": [\n    {\n      \"id\": \"wa_driver_license\",\n      \"name\": \"Washington State Business License\",\n      \"purpose\": \"We can only allow licensed Washington State business representatives into the WA Business Conference\",\n      \"schema\": [{\n        \"uri\": \"https://licenses.example.com/business-license.json\"\n      }]\n    }\n  ]\n};\n\nconst verifiablePresentation = {\n  '@context': [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  type: [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: {...},\n  verifiableCredential: [...],\n  proof: {...}\n}\n\nconst {value, warnings, errors} = pejs.evaluate(presentationDefinition, verifiablePresentation);\n```\n\n#### Credential Query\nA credential query allows holders to filter their set of credentials for matches to a given presentation definition.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\n// Definition from verifier request\nconst presentationDefinition = {\n  ...\n};\n\n// Example for loading credentials\nconst credentials = await secureStore.getCredentials();\n\n// Find matching credentials\nconst srMatches = pejs.selectFrom(presentationDefinition, credentials, holderDid);\n\n// An example that selects the first 'count' credentials from\n// the matches. in a real scenario, the user has to select what \n// to disclose\nconst selectedCredentials = srMatches.map(\n  ({matches, count}) => matches.slice(0, count)\n).flat();\n\n// Construct presentation submission from selected credentials\nconst presentationSubmission = pejs.presentationFrom(presentationDefinition, selectedCredentials, holderDID);\n\nconst presentation = {\n  \"@context\": [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  \"type\": [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: presentationSubmission,\n  verifiableCredential: selectedCredentials\n};\n\n// Presentation would be signed and sent to verifier\n```\n\n#### Utilities\nIn addition to the core functionality above, the underlying validation methods are exposed as low-level helper functions.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  ...\n};\n\nconst {warnings: pdWarnings, errors: pdErrors} = pejs.validateDefinition(presentationDefinition);\n\nconst presentationSubmission = {\n  ...\n};\n\nconst {warnings: psWarnings, errors: psErrors} = pejs.validateSubmission(presentationSubmission);\n```\n\n## API\n\n### Evaluate\n```typescript\nevaluate(presentationDefinition, verifiablePresentation)\n```\n##### Description\nEvaluates whether a presentation submission meets the requested presentation definition\nSince this method will be used both **before** and **after** creating a VerifiablePresentation, we accept both _signed_ and _unsigned_ version of a presentation here. \n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `presentation` | `Presentation` | the Presentation object containing the required credentials and a `presentation_submission` object mapping back to the presentation definition |\n\n#### Return value\nIf evaluation is successful, `value` will be a non-null `PresentationSubmission` mapping the submitted credentials to the requested inputs.\n```typescript\ninterface EvaluationResults {\n  value?: PresentationSubmission;\n  warnings?: string[];\n  errors?: Error[];\n}\n```\n\n### SelectFrom\n```typescript\nselectFrom(presentationDefinition, credentials, holderDids)\n```\n##### Description\nGathers the matching credentials that fit a given presentation definition\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `credentials` | `VerifiableCredential[]` | the array of verifiable credentials to select from |\n| `holderDids` | `string[]` | the holder's dids. this can be found in VerifiablePresentation's holder property note that a wallet can have many holderDids retrieved from different places|\n\n#### Return value\n- If the selection was successful or partially successful, the `matches` array will consist of `SubmissionRequirementMatch` object(s), representing the matching credentials for each `SubmissionRequirement` in the `presentationDefinition` input parameter.\n- If the selection was not successful, the `errors` array will consist of `Checked` object(s), representing what has failed in your selection process.\n\n```typescript\nimport { Status } from './ConstraintUtils';\n\ninterface SelectResults {\n  errors?: Checked[];\n  matches?: SubmissionRequirementMatch[];\n  /**\n   * This is the parameter that pejs library user should look into to determine what to do next\n   * Status can have three values:\n   *  1. INFO: everything is fine, you can call `presentationFrom` after this method\n   *  2. WARN: method was called with more credentials than required. \n   *       To enhance credential holder's privacy it is recommended to select credentials which are absolutely required.\n   *  3. Error: the credentials you've sent didn't satisfy the requirement defined presentationDefinition object\n   */\n  areRequiredCredentialsPresent: Status;\n  /**\n   * All matched/selectable credentials\n   */\n  selectableVerifiableCredentials?: VerifiableCredential[];\n  /**\n   * Following are indexes of the verifiableCredentials passed to the selectFrom method that have been selected.\n   */\n  vcIndexes?: number[];\n  warnings?: Checked[];\n}\n\ninterface SubmissionRequirementMatch {\n  name?: string;\n  rule: Rules;\n  min?: number;\n  count?: number;\n  max?: number;\n  matches: string[];\n  from?: string[];\n  from_nested?: SubmissionRequirementMatch[]; // VerifiableCredential Address\n}\n```\n\n### PresentationFrom\n```typescript\npresentationFrom(presentationDefinition, selectedCredentials, holderDID)\n```\n##### Description\nCreates the corresponding Presentation Submission object to be included in the Verifiable Presentation response, which maps the submitted credentials to the requested inputs in the `presentationDefinition` input parameter.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `selectedCredentials` | `VerifiableCredential[]` | the array of verifiable credentials that meet the submission requirements in the presentation definition |\n| `holderDid` | `string` | the holder's DID. This can be found in VerifiablePresentation's holder property note that a wallet can have many holderDIDs retrieved from different places|\n\n#### Return value\nIf the selected credentials successfully match the submission requirements in the presentation definition, the return value will be a non-null `PresentationSubmission`\n```typescript\ninterface PresentationSubmission {\n  id?: string;\n  definition_id: string;\n  descriptor_map: Descriptor[]\n}\n```\n\n### Validation\n```typescript\nvalidateDefinition(objToValidate)\n```\n```typescript\nvalidateSubmission(objToValidate)\n```\n#### Description\nA validation utility function for `PresentationDefinition` and `PresentationSubmission` objects.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `objToValidate` | <code>PresentationDefinition &#124; PresentationSubmission</code> | the presentation definition or presentation definition to be validated |\n\n#### Return value\nThe `validate` method returns a validated results array `NonEmptyArray<Checked>` , with structure:\n```typescript\ninterface Checked {\n  tag: string;\n  status: Status;\n  message?: string;\n}\n```\nstatus can have following values `'info' | 'warn' | 'error'`\n\n\n## Workflow Diagram\n![Flow diagram](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/Sphereon-Opensource/pe-js/develop/docs/simple-scenario.puml)\n# Glossary\n\nTerm | Definition |\n---- | ---------- |\nCredential | A set of one or more claims made by an issuer. |\nVerifiable Credential |  Is a tamper-evident credential that has authorship that can be cryptographically verified. Verifiable credentials can be used to build verifiable presentations, which can also be cryptographically verified. The claims in a credential can be about different subjects. |\nPresentation Definition | Presentation Definitions are objects that articulate what proofs a Verifier requires. |\nHolder | Holders are entities that have one or more verifiable credentials in their possession. Holders are also the entities that submit proofs to Verifiers to satisfy the requirements described in a Presentation Definition.\nHolder's Did | Unique ID URI string and PKI metadata document format for describing the cryptographic keys and other fundamental PKI values linked to a unique, user-controlled, self-sovereign identifier in holder's wallet|\nVerifier | Verifiers are entities that define what proofs they require from a Holder (via a Presentation Definition) in order to proceed with an interaction. |\nIssuer | A role an entity can perform by asserting claims about one or more subjects, creating a verifiable credential from these claims, and transmitting the verifiable credential to a holder. |\nPresentation | Data derived from one or more verifiable credentials, issued by one or more issuers |\nVerifiable Presentation | Is a tamper-evident presentation encoded in such a way that authorship of the data can be trusted after a process of cryptographic verification.\n\n## Further work:\n1. Implementation of presentation-exchange v2\n2. In the [DIF documentation](https://identity.foundation/presentation-exchange/#input-evaluation) some entries are addressing `nested credentials` and `nested paths` these are currently not fully support yet.\n","licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.4.2-unstable.15","dist":{"shasum":"3fe1f6737e372676b2682db4f8a6adc78b43625e","integrity":"sha512-pymZT7O/hg6ANySdn8wBM1tXMgEyFPF1K42M3B1QEqFsah0jDB2V8ibV6ifWA1o/qkNXYYobK/YaJ4wcO2daUQ==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.4.2-unstable.15.tgz","fileCount":196,"unpackedSize":1037385,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhoklvCRA9TVsSAnZWagAAN6IP/2iW27ArswTuKyNqge+1\nC9QDvpBs72jtNkGY6PZxKWPIcYHp7e8ogKUC5zbGdUsyZDEz1drDGWKFZwj4\nSgZrWZf78JewuRHiLSDg5v2uSJlGjtDuUCftph+cO/hcjMxNhb1nu+W4HwUR\nq0w9kJWvtNIplNT73ULwSrWIXh1ys9EywgrCszqLVavPPRrvYiatvJPd22Wo\nunEbHb0IRv0U0iEEhmjEA0rsW6eAKzZyP3auIaCcqqvEEpGPvljpx8uYDT8p\n74XJ0tcYWkwwuLHA1JYiOrpfqOs1CkbG+a43OJuOtahwmy34ix8To9Qpum0c\ndsp1KWbvz83V4YFkaoSvJg1IGE9i+55B/1VnZScFR0XEWQWzr0Wt4EMf65cs\nvp0Ba5xrtlxmcTZ1y8P/BVtQozqXuLX5pJgTkbl9gRurlGeUDqAb2tRgBG/u\n9MwiQhpzfu8sBHq8C4dL0S4AOSQFCF15aBsOXDG26CbZyfkdyP2BF7OFBENe\nKFKy+6Xwazvt+XvwpI8+nOhMzYw6qQFEEJkg3o0ADvm69yjqoQIj+OwsLPfZ\nxdDgPSU/alfFvQEiP54oGK3JdnIz4IAD1n1FE4tCpzkt0SvgINF/AnRicsWu\n9uDOaMhNzUcceouowQebnkblrjQeqWGBAM8jdpSjMFnAKzh/B1o50X1qIfBc\n7CY7\r\n=dwY3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCUob02Zh2gbiw3SOqBka43ncqyQ5cB6bly4LvCfzjtqgIhAMnRTfzE0258ljZAYVRPl7VGo4SV6XCrNJsSxZIC8K4y"}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.4.2-unstable.15_1638025583656_0.183270034443894"},"_hasShrinkwrap":false},"0.4.2-unstable.16":{"name":"@sphereon/pe-js","version":"0.4.2-unstable.16","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","typings":"dist/main/index.d.ts","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosure","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build-dis:browser":"tsc -p tsconfig.browser.json","build-dis:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","rimraf":"^2.6.2","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":150},"readmeFilename":"README.md","readme":"<h1 align=\"center\">\n  <br>\n  <a href=\"https://www.sphereon.com\"><img src=\"https://sphereon.com/content/themes/sphereon/assets/img/logo.svg\" alt=\"Sphereon\" width=\"400\"></a>\n  <br>PE-JS   DIF Presentation Exchange JavaScript Library \n  <br>\n</h1>\n\n[![CI](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml/badge.svg)](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/Sphereon-Opensource/pe-js/branch/develop/graph/badge.svg?token=9P1JGUYA35)](https://codecov.io/gh/Sphereon-Opensource/pe-js) [![NPM Version](https://img.shields.io/npm/v/@sphereon/pe-js.svg)](https://npm.im/@sphereon/pe-js)\n\n## Active Development\n_IMPORTANT: This software still is in early development stage. As such you should expect breaking changes in APIs, we expect to keep that to a minimum though._\n\n## Background\n\nThe PE-JS Library is a general use presentation exchange library that implements the functionality described in the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/). It is written in Typescript and can be compiled to any target JavaScript version.\n\nSphereon's PE Library is useful for both verifier systems and holders (e.g. wallets) and can be used in client side browsers and mobile applications as well as on server side technology such as REST APIs (e.g. built with NodeJS). It allows anyone to add DIF Presentation Exchange logic to their existing wallets, or verifiers, without making any further assumptions about the technologies used in their products.\n\nThe presentation exchange operates generally as follows; The verifier creates a Presentation Definition asking for credentials from the holder. The definition for the credentials is sent to the holder, who returns a presentation as a response. Now the verifier will verify the presentation by checking the signature and other accompanying proofs. \n\nThe presentation exchange will ensure that the model used by the verifier, can be interpreted by the holder. It then ensures that the correct parts from the holders credentials are used to create the presentation. The PE contains all the logic to interpret the models, therefore removing the need for the verifier and holder to align their specific models.\n\nThe data objects (models) used in PE-JS are generated from Sphereon's DIF PE OpenAPI Spec component. The code for the component can be seen at [PE-OpenAPI github repository](https://github.com/Sphereon-Opensource/pe-openapi). This allows the generation of the objects in many languages and frameworks consistently by configuring the maven plugin.\n\n\n### The PE Library supports the following actions:\n\n * Creating a presentation definition / request\n * Validating a presentation definition / request to be as per specification\n * Creating a presentation submission\n * Validating a presentation submission when received\n * Input evaluations: Verification of presentation submissions to be as per presentation definition\n * Utilities: to build and use different models compliant with the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/).\n\nStateful storage or credential management should be implemented in separate libraries/ modules that make use of the underlying DIF Presentation Exchange implementation. By keeping these separate, the library will stay platform agnostic. \n\n## For PE-JS developers\n\nThis project has been created using:\n* `yarn` version 1.22.5\n* `node` version 12.22.1\n\n### Install\n```shell\nyarn install\n```\n### Build\n```shell\nyarn build\n```\n### Test\nThe test command runs:\n* `eslint`\n* `prettier`\n* `unit`\n\nYou can also run only a single section of these tests, using for example `yarn test:unit`.\n```shell\nyarn test\n```\n\n### Utility scripts\nThere are several other utility scripts that help with development.\n\n* `yarn fix` - runs `eslint --fix` as well as `prettier` to fix code style\n* `yarn cov` - generates code coverage report\n\n\n## For PE-JS Users\n\nThe library can be installed direction from npmjs via:\n\n```shell\n# install via yarn\nyarn add @sphereon/pe-js\n\n# install via npm\nnpm install @sphereon/pe-js\n```\n\nThe core functionality of the DIF Presentation Exchange can be outlined as follows:\n\n* Input Evaluation\n* Credential Query\n* Utilities\n\n#### Input Evaluation\nInput evaluation is the primary mechanism by which a verifier determines whether a presentation submission from a holder matches the requested presentation definition from the request.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  \"id\": \"32f54163-7166-48f1-93d8-ff217bdb0653\",\n  \"input_descriptors\": [\n    {\n      \"id\": \"wa_driver_license\",\n      \"name\": \"Washington State Business License\",\n      \"purpose\": \"We can only allow licensed Washington State business representatives into the WA Business Conference\",\n      \"schema\": [{\n        \"uri\": \"https://licenses.example.com/business-license.json\"\n      }]\n    }\n  ]\n};\n\nconst verifiablePresentation = {\n  '@context': [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  type: [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: {...},\n  verifiableCredential: [...],\n  proof: {...}\n}\n\nconst {value, warnings, errors} = pejs.evaluate(presentationDefinition, verifiablePresentation);\n```\n\n#### Credential Query\nA credential query allows holders to filter their set of credentials for matches to a given presentation definition.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\n// Definition from verifier request\nconst presentationDefinition = {\n  ...\n};\n\n// Example for loading credentials\nconst credentials = await secureStore.getCredentials();\n\n// Find matching credentials\nconst srMatches = pejs.selectFrom(presentationDefinition, credentials, holderDid);\n\n// An example that selects the first 'count' credentials from\n// the matches. in a real scenario, the user has to select what \n// to disclose\nconst selectedCredentials = srMatches.map(\n  ({matches, count}) => matches.slice(0, count)\n).flat();\n\n// Construct presentation submission from selected credentials\nconst presentationSubmission = pejs.presentationFrom(presentationDefinition, selectedCredentials, holderDID);\n\nconst presentation = {\n  \"@context\": [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  \"type\": [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: presentationSubmission,\n  verifiableCredential: selectedCredentials\n};\n\n// Presentation would be signed and sent to verifier\n```\n\n#### Utilities\nIn addition to the core functionality above, the underlying validation methods are exposed as low-level helper functions.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  ...\n};\n\nconst {warnings: pdWarnings, errors: pdErrors} = pejs.validateDefinition(presentationDefinition);\n\nconst presentationSubmission = {\n  ...\n};\n\nconst {warnings: psWarnings, errors: psErrors} = pejs.validateSubmission(presentationSubmission);\n```\n\n## API\n\n### Evaluate\n```typescript\nevaluate(presentationDefinition, verifiablePresentation)\n```\n##### Description\nEvaluates whether a presentation submission meets the requested presentation definition\nSince this method will be used both **before** and **after** creating a VerifiablePresentation, we accept both _signed_ and _unsigned_ version of a presentation here. \n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `presentation` | `Presentation` | the Presentation object containing the required credentials and a `presentation_submission` object mapping back to the presentation definition |\n\n#### Return value\nIf evaluation is successful, `value` will be a non-null `PresentationSubmission` mapping the submitted credentials to the requested inputs.\n```typescript\ninterface EvaluationResults {\n  value?: PresentationSubmission;\n  warnings?: string[];\n  errors?: Error[];\n}\n```\n\n### SelectFrom\n```typescript\nselectFrom(presentationDefinition, credentials, holderDids)\n```\n##### Description\nGathers the matching credentials that fit a given presentation definition\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `credentials` | `VerifiableCredential[]` | the array of verifiable credentials to select from |\n| `holderDids` | `string[]` | the holder's dids. this can be found in VerifiablePresentation's holder property note that a wallet can have many holderDids retrieved from different places|\n\n#### Return value\n- If the selection was successful or partially successful, the `matches` array will consist of `SubmissionRequirementMatch` object(s), representing the matching credentials for each `SubmissionRequirement` in the `presentationDefinition` input parameter.\n- If the selection was not successful, the `errors` array will consist of `Checked` object(s), representing what has failed in your selection process.\n\n```typescript\nimport { Status } from './ConstraintUtils';\n\ninterface SelectResults {\n  errors?: Checked[];\n  matches?: SubmissionRequirementMatch[];\n  /**\n   * This is the parameter that pejs library user should look into to determine what to do next\n   * Status can have three values:\n   *  1. INFO: everything is fine, you can call `presentationFrom` after this method\n   *  2. WARN: method was called with more credentials than required. \n   *       To enhance credential holder's privacy it is recommended to select credentials which are absolutely required.\n   *  3. Error: the credentials you've sent didn't satisfy the requirement defined presentationDefinition object\n   */\n  areRequiredCredentialsPresent: Status;\n  /**\n   * All matched/selectable credentials\n   */\n  selectableVerifiableCredentials?: VerifiableCredential[];\n  /**\n   * Following are indexes of the verifiableCredentials passed to the selectFrom method that have been selected.\n   */\n  vcIndexes?: number[];\n  warnings?: Checked[];\n}\n\ninterface SubmissionRequirementMatch {\n  name?: string;\n  rule: Rules;\n  min?: number;\n  count?: number;\n  max?: number;\n  matches: string[];\n  from?: string[];\n  from_nested?: SubmissionRequirementMatch[]; // VerifiableCredential Address\n}\n```\n\n### PresentationFrom\n```typescript\npresentationFrom(presentationDefinition, selectedCredentials, holderDID)\n```\n##### Description\nCreates the corresponding Presentation Submission object to be included in the Verifiable Presentation response, which maps the submitted credentials to the requested inputs in the `presentationDefinition` input parameter.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `selectedCredentials` | `VerifiableCredential[]` | the array of verifiable credentials that meet the submission requirements in the presentation definition |\n| `holderDid` | `string` | the holder's DID. This can be found in VerifiablePresentation's holder property note that a wallet can have many holderDIDs retrieved from different places|\n\n#### Return value\nIf the selected credentials successfully match the submission requirements in the presentation definition, the return value will be a non-null `PresentationSubmission`\n```typescript\ninterface PresentationSubmission {\n  id?: string;\n  definition_id: string;\n  descriptor_map: Descriptor[]\n}\n```\n\n### Validation\n```typescript\nvalidateDefinition(objToValidate)\n```\n```typescript\nvalidateSubmission(objToValidate)\n```\n#### Description\nA validation utility function for `PresentationDefinition` and `PresentationSubmission` objects.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `objToValidate` | <code>PresentationDefinition &#124; PresentationSubmission</code> | the presentation definition or presentation definition to be validated |\n\n#### Return value\nThe `validate` method returns a validated results array `NonEmptyArray<Checked>` , with structure:\n```typescript\ninterface Checked {\n  tag: string;\n  status: Status;\n  message?: string;\n}\n```\nstatus can have following values `'info' | 'warn' | 'error'`\n\n\n## Workflow Diagram\n![Flow diagram](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/Sphereon-Opensource/pe-js/develop/docs/simple-scenario.puml)\n# Glossary\n\nTerm | Definition |\n---- | ---------- |\nCredential | A set of one or more claims made by an issuer. |\nVerifiable Credential |  Is a tamper-evident credential that has authorship that can be cryptographically verified. Verifiable credentials can be used to build verifiable presentations, which can also be cryptographically verified. The claims in a credential can be about different subjects. |\nPresentation Definition | Presentation Definitions are objects that articulate what proofs a Verifier requires. |\nHolder | Holders are entities that have one or more verifiable credentials in their possession. Holders are also the entities that submit proofs to Verifiers to satisfy the requirements described in a Presentation Definition.\nHolder's Did | Unique ID URI string and PKI metadata document format for describing the cryptographic keys and other fundamental PKI values linked to a unique, user-controlled, self-sovereign identifier in holder's wallet|\nVerifier | Verifiers are entities that define what proofs they require from a Holder (via a Presentation Definition) in order to proceed with an interaction. |\nIssuer | A role an entity can perform by asserting claims about one or more subjects, creating a verifiable credential from these claims, and transmitting the verifiable credential to a holder. |\nPresentation | Data derived from one or more verifiable credentials, issued by one or more issuers |\nVerifiable Presentation | Is a tamper-evident presentation encoded in such a way that authorship of the data can be trusted after a process of cryptographic verification.\n\n## Further work:\n1. Implementation of presentation-exchange v2\n2. In the [DIF documentation](https://identity.foundation/presentation-exchange/#input-evaluation) some entries are addressing `nested credentials` and `nested paths` these are currently not fully support yet.\n","licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.4.2-unstable.16","dist":{"shasum":"84408270133a0cddf94c16cc80f8ab44c31d4e99","integrity":"sha512-xpzHwYMT69B/7kHbchVtYhQ47qbyxmyyHTRzk5iUITbfbe2UPTqKJpldDY/wuLEryXajjTGRJfjlMzXfPR2W3Q==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.4.2-unstable.16.tgz","fileCount":196,"unpackedSize":1037385,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhokmACRA9TVsSAnZWagAAe4wP/3SKtKvoOIy5HscMpcz2\nFzuSxfCd+iEa0/+YeLu0WM40dVV2z0gYdO9UPhOiAJAuDabAZeCvtPmk9gt5\nwo/O0qGQwQpnS1SF/EeisBpZnqiPPlyZtV4xQQOp44I+H9t9W/O20Nds6bMz\nqa60fbZoqs8cJIwdjzRDUj0Mipw1x7S6kRlHf5iD4/vIxQ9mJmzfnSOTCDHw\nTfyozWBCHrs6kfL7B9QOi5JvQObYkc+vL8zmC5pjg5AjAyQmI2zTP/7ycjjy\nn/C+QGraOML/2zLxQAsG59tfb1zo+CPY1MVMuNl1AA+Pll71tnjz50klpEnV\nRdFaeKTZsgqbX31LAYxpy2hdjACDmNwwiF/cql3nMv44blKN18MGMoiGbFSz\nK+NFSyitbj3vMnGyQ4v79d0X/xhXSn+/TVuCU3HSrfFXnx3O/1/ZQvgkiiQO\nBgxGZq3sGaTTivPIb35YTUxA07hXDjjqHvFok1UgYFGKy0cRObysDu+tqxRI\nilvJHo41/hq4R33mNs78LYAXj5NEnPhiUeZ1BY7XIqu63xUGiH2n5pUFQ03G\nF9mMDgWWx45TKYoBZPMomGnAOfspbu1E/UGoczEHyO4jLnefa+yjAlIRNXN0\n+kHmYsQ0qe2AWpA/0Lzx/3fNC0JYyzbwWSdx6IG+/hU4ubAOwCa3kgM3mQGq\nCbD0\r\n=SZEs\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEUlLVWj+sR2y3HWamqpnA9nyn1p0M4aHZQYOjYF/kWGAiBcAnmeK8R+Q+Vp1SL6Pf8iXJXSsgd6T1xkzVPmRYUE4g=="}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.4.2-unstable.16_1638025600161_0.345979738935537"},"_hasShrinkwrap":false},"0.4.2-unstable.17":{"name":"@sphereon/pe-js","version":"0.4.2-unstable.17","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","module":"dist/browser/index.js","browser":"dist/browser/index.js","typings":"dist/main/index.d.ts","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosure","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build:browser":"tsc -p tsconfig.browser.json","build-dis:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","rimraf":"^2.6.2","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":150},"readmeFilename":"README.md","readme":"<h1 align=\"center\">\n  <br>\n  <a href=\"https://www.sphereon.com\"><img src=\"https://sphereon.com/content/themes/sphereon/assets/img/logo.svg\" alt=\"Sphereon\" width=\"400\"></a>\n  <br>PE-JS   DIF Presentation Exchange JavaScript Library \n  <br>\n</h1>\n\n[![CI](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml/badge.svg)](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/Sphereon-Opensource/pe-js/branch/develop/graph/badge.svg?token=9P1JGUYA35)](https://codecov.io/gh/Sphereon-Opensource/pe-js) [![NPM Version](https://img.shields.io/npm/v/@sphereon/pe-js.svg)](https://npm.im/@sphereon/pe-js)\n\n## Active Development\n_IMPORTANT: This software still is in early development stage. As such you should expect breaking changes in APIs, we expect to keep that to a minimum though._\n\n## Background\n\nThe PE-JS Library is a general use presentation exchange library that implements the functionality described in the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/). It is written in Typescript and can be compiled to any target JavaScript version.\n\nSphereon's PE Library is useful for both verifier systems and holders (e.g. wallets) and can be used in client side browsers and mobile applications as well as on server side technology such as REST APIs (e.g. built with NodeJS). It allows anyone to add DIF Presentation Exchange logic to their existing wallets, or verifiers, without making any further assumptions about the technologies used in their products.\n\nThe presentation exchange operates generally as follows; The verifier creates a Presentation Definition asking for credentials from the holder. The definition for the credentials is sent to the holder, who returns a presentation as a response. Now the verifier will verify the presentation by checking the signature and other accompanying proofs. \n\nThe presentation exchange will ensure that the model used by the verifier, can be interpreted by the holder. It then ensures that the correct parts from the holders credentials are used to create the presentation. The PE contains all the logic to interpret the models, therefore removing the need for the verifier and holder to align their specific models.\n\nThe data objects (models) used in PE-JS are generated from Sphereon's DIF PE OpenAPI Spec component. The code for the component can be seen at [PE-OpenAPI github repository](https://github.com/Sphereon-Opensource/pe-openapi). This allows the generation of the objects in many languages and frameworks consistently by configuring the maven plugin.\n\n\n### The PE Library supports the following actions:\n\n * Creating a presentation definition / request\n * Validating a presentation definition / request to be as per specification\n * Creating a presentation submission\n * Validating a presentation submission when received\n * Input evaluations: Verification of presentation submissions to be as per presentation definition\n * Utilities: to build and use different models compliant with the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/).\n\nStateful storage or credential management should be implemented in separate libraries/ modules that make use of the underlying DIF Presentation Exchange implementation. By keeping these separate, the library will stay platform agnostic. \n\n## For PE-JS developers\n\nThis project has been created using:\n* `yarn` version 1.22.5\n* `node` version 12.22.1\n\n### Install\n```shell\nyarn install\n```\n### Build\n```shell\nyarn build\n```\n### Test\nThe test command runs:\n* `eslint`\n* `prettier`\n* `unit`\n\nYou can also run only a single section of these tests, using for example `yarn test:unit`.\n```shell\nyarn test\n```\n\n### Utility scripts\nThere are several other utility scripts that help with development.\n\n* `yarn fix` - runs `eslint --fix` as well as `prettier` to fix code style\n* `yarn cov` - generates code coverage report\n\n\n## For PE-JS Users\n\nThe library can be installed direction from npmjs via:\n\n```shell\n# install via yarn\nyarn add @sphereon/pe-js\n\n# install via npm\nnpm install @sphereon/pe-js\n```\n\nThe core functionality of the DIF Presentation Exchange can be outlined as follows:\n\n* Input Evaluation\n* Credential Query\n* Utilities\n\n#### Input Evaluation\nInput evaluation is the primary mechanism by which a verifier determines whether a presentation submission from a holder matches the requested presentation definition from the request.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  \"id\": \"32f54163-7166-48f1-93d8-ff217bdb0653\",\n  \"input_descriptors\": [\n    {\n      \"id\": \"wa_driver_license\",\n      \"name\": \"Washington State Business License\",\n      \"purpose\": \"We can only allow licensed Washington State business representatives into the WA Business Conference\",\n      \"schema\": [{\n        \"uri\": \"https://licenses.example.com/business-license.json\"\n      }]\n    }\n  ]\n};\n\nconst verifiablePresentation = {\n  '@context': [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  type: [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: {...},\n  verifiableCredential: [...],\n  proof: {...}\n}\n\nconst {value, warnings, errors} = pejs.evaluate(presentationDefinition, verifiablePresentation);\n```\n\n#### Credential Query\nA credential query allows holders to filter their set of credentials for matches to a given presentation definition.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\n// Definition from verifier request\nconst presentationDefinition = {\n  ...\n};\n\n// Example for loading credentials\nconst credentials = await secureStore.getCredentials();\n\n// Find matching credentials\nconst srMatches = pejs.selectFrom(presentationDefinition, credentials, holderDid);\n\n// An example that selects the first 'count' credentials from\n// the matches. in a real scenario, the user has to select what \n// to disclose\nconst selectedCredentials = srMatches.map(\n  ({matches, count}) => matches.slice(0, count)\n).flat();\n\n// Construct presentation submission from selected credentials\nconst presentationSubmission = pejs.presentationFrom(presentationDefinition, selectedCredentials, holderDID);\n\nconst presentation = {\n  \"@context\": [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  \"type\": [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: presentationSubmission,\n  verifiableCredential: selectedCredentials\n};\n\n// Presentation would be signed and sent to verifier\n```\n\n#### Utilities\nIn addition to the core functionality above, the underlying validation methods are exposed as low-level helper functions.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  ...\n};\n\nconst {warnings: pdWarnings, errors: pdErrors} = pejs.validateDefinition(presentationDefinition);\n\nconst presentationSubmission = {\n  ...\n};\n\nconst {warnings: psWarnings, errors: psErrors} = pejs.validateSubmission(presentationSubmission);\n```\n\n## API\n\n### Evaluate\n```typescript\nevaluate(presentationDefinition, verifiablePresentation)\n```\n##### Description\nEvaluates whether a presentation submission meets the requested presentation definition\nSince this method will be used both **before** and **after** creating a VerifiablePresentation, we accept both _signed_ and _unsigned_ version of a presentation here. \n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `presentation` | `Presentation` | the Presentation object containing the required credentials and a `presentation_submission` object mapping back to the presentation definition |\n\n#### Return value\nIf evaluation is successful, `value` will be a non-null `PresentationSubmission` mapping the submitted credentials to the requested inputs.\n```typescript\ninterface EvaluationResults {\n  value?: PresentationSubmission;\n  warnings?: string[];\n  errors?: Error[];\n}\n```\n\n### SelectFrom\n```typescript\nselectFrom(presentationDefinition, credentials, holderDids)\n```\n##### Description\nGathers the matching credentials that fit a given presentation definition\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `credentials` | `VerifiableCredential[]` | the array of verifiable credentials to select from |\n| `holderDids` | `string[]` | the holder's dids. this can be found in VerifiablePresentation's holder property note that a wallet can have many holderDids retrieved from different places|\n\n#### Return value\n- If the selection was successful or partially successful, the `matches` array will consist of `SubmissionRequirementMatch` object(s), representing the matching credentials for each `SubmissionRequirement` in the `presentationDefinition` input parameter.\n- If the selection was not successful, the `errors` array will consist of `Checked` object(s), representing what has failed in your selection process.\n\n```typescript\nimport { Status } from './ConstraintUtils';\n\ninterface SelectResults {\n  errors?: Checked[];\n  matches?: SubmissionRequirementMatch[];\n  /**\n   * This is the parameter that pejs library user should look into to determine what to do next\n   * Status can have three values:\n   *  1. INFO: everything is fine, you can call `presentationFrom` after this method\n   *  2. WARN: method was called with more credentials than required. \n   *       To enhance credential holder's privacy it is recommended to select credentials which are absolutely required.\n   *  3. Error: the credentials you've sent didn't satisfy the requirement defined presentationDefinition object\n   */\n  areRequiredCredentialsPresent: Status;\n  /**\n   * All matched/selectable credentials\n   */\n  selectableVerifiableCredentials?: VerifiableCredential[];\n  /**\n   * Following are indexes of the verifiableCredentials passed to the selectFrom method that have been selected.\n   */\n  vcIndexes?: number[];\n  warnings?: Checked[];\n}\n\ninterface SubmissionRequirementMatch {\n  name?: string;\n  rule: Rules;\n  min?: number;\n  count?: number;\n  max?: number;\n  matches: string[];\n  from?: string[];\n  from_nested?: SubmissionRequirementMatch[]; // VerifiableCredential Address\n}\n```\n\n### PresentationFrom\n```typescript\npresentationFrom(presentationDefinition, selectedCredentials, holderDID)\n```\n##### Description\nCreates the corresponding Presentation Submission object to be included in the Verifiable Presentation response, which maps the submitted credentials to the requested inputs in the `presentationDefinition` input parameter.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `selectedCredentials` | `VerifiableCredential[]` | the array of verifiable credentials that meet the submission requirements in the presentation definition |\n| `holderDid` | `string` | the holder's DID. This can be found in VerifiablePresentation's holder property note that a wallet can have many holderDIDs retrieved from different places|\n\n#### Return value\nIf the selected credentials successfully match the submission requirements in the presentation definition, the return value will be a non-null `PresentationSubmission`\n```typescript\ninterface PresentationSubmission {\n  id?: string;\n  definition_id: string;\n  descriptor_map: Descriptor[]\n}\n```\n\n### Validation\n```typescript\nvalidateDefinition(objToValidate)\n```\n```typescript\nvalidateSubmission(objToValidate)\n```\n#### Description\nA validation utility function for `PresentationDefinition` and `PresentationSubmission` objects.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `objToValidate` | <code>PresentationDefinition &#124; PresentationSubmission</code> | the presentation definition or presentation definition to be validated |\n\n#### Return value\nThe `validate` method returns a validated results array `NonEmptyArray<Checked>` , with structure:\n```typescript\ninterface Checked {\n  tag: string;\n  status: Status;\n  message?: string;\n}\n```\nstatus can have following values `'info' | 'warn' | 'error'`\n\n\n## Workflow Diagram\n![Flow diagram](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/Sphereon-Opensource/pe-js/develop/docs/simple-scenario.puml)\n# Glossary\n\nTerm | Definition |\n---- | ---------- |\nCredential | A set of one or more claims made by an issuer. |\nVerifiable Credential |  Is a tamper-evident credential that has authorship that can be cryptographically verified. Verifiable credentials can be used to build verifiable presentations, which can also be cryptographically verified. The claims in a credential can be about different subjects. |\nPresentation Definition | Presentation Definitions are objects that articulate what proofs a Verifier requires. |\nHolder | Holders are entities that have one or more verifiable credentials in their possession. Holders are also the entities that submit proofs to Verifiers to satisfy the requirements described in a Presentation Definition.\nHolder's Did | Unique ID URI string and PKI metadata document format for describing the cryptographic keys and other fundamental PKI values linked to a unique, user-controlled, self-sovereign identifier in holder's wallet|\nVerifier | Verifiers are entities that define what proofs they require from a Holder (via a Presentation Definition) in order to proceed with an interaction. |\nIssuer | A role an entity can perform by asserting claims about one or more subjects, creating a verifiable credential from these claims, and transmitting the verifiable credential to a holder. |\nPresentation | Data derived from one or more verifiable credentials, issued by one or more issuers |\nVerifiable Presentation | Is a tamper-evident presentation encoded in such a way that authorship of the data can be trusted after a process of cryptographic verification.\n\n## Further work:\n1. Implementation of presentation-exchange v2\n2. In the [DIF documentation](https://identity.foundation/presentation-exchange/#input-evaluation) some entries are addressing `nested credentials` and `nested paths` these are currently not fully support yet.\n","licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.4.2-unstable.17","dist":{"shasum":"a4e631d922416710f02e48717a13ea5fba7bee66","integrity":"sha512-FKGYD0teQJhx0S98KM1hy9DK/l5f7qbHdXWAnD2wOKpdUIAiTLB3AYiMHvX3jx3JvdLWjLiYEM/jDDKr76RksA==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.4.2-unstable.17.tgz","fileCount":300,"unpackedSize":1403056,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhokpbCRA9TVsSAnZWagAAo7AP/3/iRVE2bZlmdOsT0U49\nbUm5Jn3ng5GhJRqhUc1j/q6+kMDQPEidzQYxrmSfi2wecvxp5L2+AA8Dr4EN\nSGqThAdI/xUNFcXwKsrVkamAOJIAenTKxA6jlbntVJz0DzyvLCywJOG+xpDV\nqwTcmo9XJe460tFo5N2wzpm6700TMrlB1GZ+rtI/4apgsYPxzUhnFgU9SX2+\ngP0SrhDlwckGCs3qQUn7kgBIbhDzsnDdTpVnAdKqhoJ8Sl6yyAJGoTWeCEhe\nFeFvufe46dnR+FBbOJT38BDIwxSAc2nQLN9Nn4byx9CsVOwOJqNa3TgnTtx2\n1ORJom8zn/bW7OmA2a4kr2Q2mvRIDMt1Au4+QCkHn9n2LEl0M655fx3n5ZRc\nfIEzeEHdXQefu7T1MfXXQ5ACyumrUJLRfAWu1FQJKgynVf5VWOC+1Z0Nwwop\nJE/hd2MiRgOuDqs0AASuNGkdPkvuty+QsTohYAvHkOLs/BFPwtQXJnJAAA3Y\ny35pJlQOpyUlwlY+lBA694L/fVZeQ/DAGRC/DkukmGz/qAiAWbL0doHGXDA0\ny+pHpnanrhqOjP/FSkpELK1brrKcia+SR1V2F45TMW+qNXhx2kV8NkMuyxDs\nPJ2dRnj9dbLMMFDadGkv66Dhe9x3E/F2YznYFgn4xX5fiiKabeDo5KIrm7oP\n7joQ\r\n=cnvl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE4Yw2HKzkyrX7Z3X2+rjF9I6BUrksLpHdLLiz8GM3MiAiEA0Ms6X8wq4J0ZbfFKlfpf6rdK2mZ3IkGOJ6Dq8OTNaEM="}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.4.2-unstable.17_1638025819635_0.8870045674572085"},"_hasShrinkwrap":false},"0.4.2-unstable.18":{"name":"@sphereon/pe-js","version":"0.4.2-unstable.18","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","module":"dist/module/index.js","browser":"dist/browser/index.js","typings":"dist/main/index.d.ts","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosure","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build:browser":"tsc -p tsconfig.browser.json","build:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","rimraf":"^2.6.2","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":150},"readmeFilename":"README.md","readme":"<h1 align=\"center\">\n  <br>\n  <a href=\"https://www.sphereon.com\"><img src=\"https://sphereon.com/content/themes/sphereon/assets/img/logo.svg\" alt=\"Sphereon\" width=\"400\"></a>\n  <br>PE-JS   DIF Presentation Exchange JavaScript Library \n  <br>\n</h1>\n\n[![CI](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml/badge.svg)](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/Sphereon-Opensource/pe-js/branch/develop/graph/badge.svg?token=9P1JGUYA35)](https://codecov.io/gh/Sphereon-Opensource/pe-js) [![NPM Version](https://img.shields.io/npm/v/@sphereon/pe-js.svg)](https://npm.im/@sphereon/pe-js)\n\n## Active Development\n_IMPORTANT: This software still is in early development stage. As such you should expect breaking changes in APIs, we expect to keep that to a minimum though._\n\n## Background\n\nThe PE-JS Library is a general use presentation exchange library that implements the functionality described in the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/). It is written in Typescript and can be compiled to any target JavaScript version.\n\nSphereon's PE Library is useful for both verifier systems and holders (e.g. wallets) and can be used in client side browsers and mobile applications as well as on server side technology such as REST APIs (e.g. built with NodeJS). It allows anyone to add DIF Presentation Exchange logic to their existing wallets, or verifiers, without making any further assumptions about the technologies used in their products.\n\nThe presentation exchange operates generally as follows; The verifier creates a Presentation Definition asking for credentials from the holder. The definition for the credentials is sent to the holder, who returns a presentation as a response. Now the verifier will verify the presentation by checking the signature and other accompanying proofs. \n\nThe presentation exchange will ensure that the model used by the verifier, can be interpreted by the holder. It then ensures that the correct parts from the holders credentials are used to create the presentation. The PE contains all the logic to interpret the models, therefore removing the need for the verifier and holder to align their specific models.\n\nThe data objects (models) used in PE-JS are generated from Sphereon's DIF PE OpenAPI Spec component. The code for the component can be seen at [PE-OpenAPI github repository](https://github.com/Sphereon-Opensource/pe-openapi). This allows the generation of the objects in many languages and frameworks consistently by configuring the maven plugin.\n\n\n### The PE Library supports the following actions:\n\n * Creating a presentation definition / request\n * Validating a presentation definition / request to be as per specification\n * Creating a presentation submission\n * Validating a presentation submission when received\n * Input evaluations: Verification of presentation submissions to be as per presentation definition\n * Utilities: to build and use different models compliant with the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/).\n\nStateful storage or credential management should be implemented in separate libraries/ modules that make use of the underlying DIF Presentation Exchange implementation. By keeping these separate, the library will stay platform agnostic. \n\n## For PE-JS developers\n\nThis project has been created using:\n* `yarn` version 1.22.5\n* `node` version 12.22.1\n\n### Install\n```shell\nyarn install\n```\n### Build\n```shell\nyarn build\n```\n### Test\nThe test command runs:\n* `eslint`\n* `prettier`\n* `unit`\n\nYou can also run only a single section of these tests, using for example `yarn test:unit`.\n```shell\nyarn test\n```\n\n### Utility scripts\nThere are several other utility scripts that help with development.\n\n* `yarn fix` - runs `eslint --fix` as well as `prettier` to fix code style\n* `yarn cov` - generates code coverage report\n\n\n## For PE-JS Users\n\nThe library can be installed direction from npmjs via:\n\n```shell\n# install via yarn\nyarn add @sphereon/pe-js\n\n# install via npm\nnpm install @sphereon/pe-js\n```\n\nThe core functionality of the DIF Presentation Exchange can be outlined as follows:\n\n* Input Evaluation\n* Credential Query\n* Utilities\n\n#### Input Evaluation\nInput evaluation is the primary mechanism by which a verifier determines whether a presentation submission from a holder matches the requested presentation definition from the request.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  \"id\": \"32f54163-7166-48f1-93d8-ff217bdb0653\",\n  \"input_descriptors\": [\n    {\n      \"id\": \"wa_driver_license\",\n      \"name\": \"Washington State Business License\",\n      \"purpose\": \"We can only allow licensed Washington State business representatives into the WA Business Conference\",\n      \"schema\": [{\n        \"uri\": \"https://licenses.example.com/business-license.json\"\n      }]\n    }\n  ]\n};\n\nconst verifiablePresentation = {\n  '@context': [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  type: [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: {...},\n  verifiableCredential: [...],\n  proof: {...}\n}\n\nconst {value, warnings, errors} = pejs.evaluate(presentationDefinition, verifiablePresentation);\n```\n\n#### Credential Query\nA credential query allows holders to filter their set of credentials for matches to a given presentation definition.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\n// Definition from verifier request\nconst presentationDefinition = {\n  ...\n};\n\n// Example for loading credentials\nconst credentials = await secureStore.getCredentials();\n\n// Find matching credentials\nconst srMatches = pejs.selectFrom(presentationDefinition, credentials, holderDid);\n\n// An example that selects the first 'count' credentials from\n// the matches. in a real scenario, the user has to select what \n// to disclose\nconst selectedCredentials = srMatches.map(\n  ({matches, count}) => matches.slice(0, count)\n).flat();\n\n// Construct presentation submission from selected credentials\nconst presentationSubmission = pejs.presentationFrom(presentationDefinition, selectedCredentials, holderDID);\n\nconst presentation = {\n  \"@context\": [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  \"type\": [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: presentationSubmission,\n  verifiableCredential: selectedCredentials\n};\n\n// Presentation would be signed and sent to verifier\n```\n\n#### Utilities\nIn addition to the core functionality above, the underlying validation methods are exposed as low-level helper functions.\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  ...\n};\n\nconst {warnings: pdWarnings, errors: pdErrors} = pejs.validateDefinition(presentationDefinition);\n\nconst presentationSubmission = {\n  ...\n};\n\nconst {warnings: psWarnings, errors: psErrors} = pejs.validateSubmission(presentationSubmission);\n```\n\n## API\n\n### Evaluate\n```typescript\nevaluate(presentationDefinition, verifiablePresentation)\n```\n##### Description\nEvaluates whether a presentation submission meets the requested presentation definition\nSince this method will be used both **before** and **after** creating a VerifiablePresentation, we accept both _signed_ and _unsigned_ version of a presentation here. \n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `presentation` | `Presentation` | the Presentation object containing the required credentials and a `presentation_submission` object mapping back to the presentation definition |\n\n#### Return value\nIf evaluation is successful, `value` will be a non-null `PresentationSubmission` mapping the submitted credentials to the requested inputs.\n```typescript\ninterface EvaluationResults {\n  value?: PresentationSubmission;\n  warnings?: string[];\n  errors?: Error[];\n}\n```\n\n### SelectFrom\n```typescript\nselectFrom(presentationDefinition, credentials, holderDids)\n```\n##### Description\nGathers the matching credentials that fit a given presentation definition\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `credentials` | `VerifiableCredential[]` | the array of verifiable credentials to select from |\n| `holderDids` | `string[]` | the holder's dids. this can be found in VerifiablePresentation's holder property note that a wallet can have many holderDids retrieved from different places|\n\n#### Return value\n- If the selection was successful or partially successful, the `matches` array will consist of `SubmissionRequirementMatch` object(s), representing the matching credentials for each `SubmissionRequirement` in the `presentationDefinition` input parameter.\n- If the selection was not successful, the `errors` array will consist of `Checked` object(s), representing what has failed in your selection process.\n\n```typescript\nimport { Status } from './ConstraintUtils';\n\ninterface SelectResults {\n  errors?: Checked[];\n  matches?: SubmissionRequirementMatch[];\n  /**\n   * This is the parameter that pejs library user should look into to determine what to do next\n   * Status can have three values:\n   *  1. INFO: everything is fine, you can call `presentationFrom` after this method\n   *  2. WARN: method was called with more credentials than required. \n   *       To enhance credential holder's privacy it is recommended to select credentials which are absolutely required.\n   *  3. Error: the credentials you've sent didn't satisfy the requirement defined presentationDefinition object\n   */\n  areRequiredCredentialsPresent: Status;\n  /**\n   * All matched/selectable credentials\n   */\n  selectableVerifiableCredentials?: VerifiableCredential[];\n  /**\n   * Following are indexes of the verifiableCredentials passed to the selectFrom method that have been selected.\n   */\n  vcIndexes?: number[];\n  warnings?: Checked[];\n}\n\ninterface SubmissionRequirementMatch {\n  name?: string;\n  rule: Rules;\n  min?: number;\n  count?: number;\n  max?: number;\n  matches: string[];\n  from?: string[];\n  from_nested?: SubmissionRequirementMatch[]; // VerifiableCredential Address\n}\n```\n\n### PresentationFrom\n```typescript\npresentationFrom(presentationDefinition, selectedCredentials, holderDID)\n```\n##### Description\nCreates the corresponding Presentation Submission object to be included in the Verifiable Presentation response, which maps the submitted credentials to the requested inputs in the `presentationDefinition` input parameter.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `selectedCredentials` | `VerifiableCredential[]` | the array of verifiable credentials that meet the submission requirements in the presentation definition |\n| `holderDid` | `string` | the holder's DID. This can be found in VerifiablePresentation's holder property note that a wallet can have many holderDIDs retrieved from different places|\n\n#### Return value\nIf the selected credentials successfully match the submission requirements in the presentation definition, the return value will be a non-null `PresentationSubmission`\n```typescript\ninterface PresentationSubmission {\n  id?: string;\n  definition_id: string;\n  descriptor_map: Descriptor[]\n}\n```\n\n### Validation\n```typescript\nvalidateDefinition(objToValidate)\n```\n```typescript\nvalidateSubmission(objToValidate)\n```\n#### Description\nA validation utility function for `PresentationDefinition` and `PresentationSubmission` objects.\n\n#### Parameters\n| name | type | description|\n|------|------|------------|\n| `objToValidate` | <code>PresentationDefinition &#124; PresentationSubmission</code> | the presentation definition or presentation definition to be validated |\n\n#### Return value\nThe `validate` method returns a validated results array `NonEmptyArray<Checked>` , with structure:\n```typescript\ninterface Checked {\n  tag: string;\n  status: Status;\n  message?: string;\n}\n```\nstatus can have following values `'info' | 'warn' | 'error'`\n\n\n## Workflow Diagram\n![Flow diagram](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/Sphereon-Opensource/pe-js/develop/docs/simple-scenario.puml)\n# Glossary\n\nTerm | Definition |\n---- | ---------- |\nCredential | A set of one or more claims made by an issuer. |\nVerifiable Credential |  Is a tamper-evident credential that has authorship that can be cryptographically verified. Verifiable credentials can be used to build verifiable presentations, which can also be cryptographically verified. The claims in a credential can be about different subjects. |\nPresentation Definition | Presentation Definitions are objects that articulate what proofs a Verifier requires. |\nHolder | Holders are entities that have one or more verifiable credentials in their possession. Holders are also the entities that submit proofs to Verifiers to satisfy the requirements described in a Presentation Definition.\nHolder's Did | Unique ID URI string and PKI metadata document format for describing the cryptographic keys and other fundamental PKI values linked to a unique, user-controlled, self-sovereign identifier in holder's wallet|\nVerifier | Verifiers are entities that define what proofs they require from a Holder (via a Presentation Definition) in order to proceed with an interaction. |\nIssuer | A role an entity can perform by asserting claims about one or more subjects, creating a verifiable credential from these claims, and transmitting the verifiable credential to a holder. |\nPresentation | Data derived from one or more verifiable credentials, issued by one or more issuers |\nVerifiable Presentation | Is a tamper-evident presentation encoded in such a way that authorship of the data can be trusted after a process of cryptographic verification.\n\n## Further work:\n1. Implementation of presentation-exchange v2\n2. In the [DIF documentation](https://identity.foundation/presentation-exchange/#input-evaluation) some entries are addressing `nested credentials` and `nested paths` these are currently not fully support yet.\n","licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.4.2-unstable.18","dist":{"shasum":"d4c1fa56abe2baebf8825b531291ca0302b2391b","integrity":"sha512-YvkYTGm2glLMJtKmPXp+Zn7+86UHyLa0ZiNYAepvKkBTk1F08y4ubgWf7CSgYyex+RICi0Pu2493TfGgN4fX/g==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.4.2-unstable.18.tgz","fileCount":404,"unpackedSize":1750681,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhokrRCRA9TVsSAnZWagAAilwP/0pUVqQFXI7GBZXPLBK5\nkO7BeqVWjXFb+Rpbte5lzaNUEtz/QN7Q7hgU387rK+JKnTI1zJNm0Y9hzbl3\ndhyp0WlLIYbh9qqsyIvJguOiM2lhzJu1kQY7ELhXHqDoWFkI8ysv+sLM0LUA\nOkkHNlrHLus2Nhq3TnlUqCiixRzBQOYKzO7kFEiHS+C4YnW/Jj0L5PPOcgfv\nsQMms1mYiMNKRSJv7zkqLVvAAcxm03A5rODVxHabpYpQAiGsHEsGljSewNPz\n5oVqPPam+7VLsiPwmfr0meyuTEkDlMjlVrkkggBWM1ppZiXABBVafcJH167K\nNS9h9dW0BKrOiMyr06tb5EWRzlxe80HOvJjVVSf+/oDA2C0JzrpuSkU4IU27\nbnqO6Q3XnPe8eJwMNS9Ayf3t370g8xit1S3MjUezpN185NUt5RQRETCPjO00\nZjlnRQqNGchN+0+BYBj4QEKVrp5ADsblwJMoklYqs4j9jOs5KhTGs8D0xspz\nJw4kR6jQv88g7LEH05M+87IoVE5lCGXEq9Wl1IZm0SzpsXhByG543+HStCTU\nIUrrm4YSOiiPO+7m1zQ6/P9cCYV9KqbVueseW4mipKzrt+5Bc17vlSlMwROx\nusR4ZM0TdvRCcrn8EGtI9SZb82L8vw57Ft1hRoFUVl/1cAn5V1RAqa0r6TbQ\nJPAi\r\n=9Iwv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBFIDh4XTwR1zYdLb3tQCF6SKEgIdvVS2L/XYgMfQuF7AiBTOZ0scDv7wN5WZHZuOLvACsJsQsf5zx5c7jknF/k11g=="}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.4.2-unstable.18_1638025937334_0.6433646961788682"},"_hasShrinkwrap":false},"0.5.0-unstable.1":{"name":"@sphereon/pe-js","version":"0.5.0-unstable.1","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","module":"dist/module/index.js","browser":"dist/browser/index.js","typings":"dist/main/index.d.ts","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosure","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build:browser":"tsc -p tsconfig.browser.json","build:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","rimraf":"^2.6.2","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":120},"readmeFilename":"README.md","readme":"<h1 align=\"center\">\n  <br>\n  <a href=\"https://www.sphereon.com\"><img src=\"https://sphereon.com/content/themes/sphereon/assets/img/logo.svg\" alt=\"Sphereon\" width=\"400\"></a>\n  <br>PE-JS   DIF Presentation Exchange Type/JavaScript Library \n  <br>\n</h1>\n\n[![CI](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml/badge.svg)](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/Sphereon-Opensource/pe-js/branch/develop/graph/badge.svg?token=9P1JGUYA35)](https://codecov.io/gh/Sphereon-Opensource/pe-js) [![NPM Version](https://img.shields.io/npm/v/@sphereon/pe-js.svg)](https://npm.im/@sphereon/pe-js)\n\n## Active Development\n\n_IMPORTANT: This software still is in early development stage. As such you should expect breaking changes in APIs, we\nexpect to keep that to a minimum though._\n\n## Background\n\nThe PE-JS Library is a general use presentation exchange library that implements the functionality described in\nthe [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/). It is written\nin Typescript and can be compiled to any target JavaScript version.\n\nSphereon's PE Library is useful for both verifier systems and holders (e.g. wallets) and can be used in client side\nbrowsers and mobile applications as well as on server side technology such as REST APIs (e.g. built with NodeJS). It\nallows anyone to add DIF Presentation Exchange logic to their existing wallets, agents and/or verifiers, without making\nany further assumptions about the technologies used in their products.\n\nThe presentation exchange operates generally as follows; The verifier creates a Presentation Definition asking for\ncredentials from the holder. The definition for the credentials is sent to the holder, who returns a presentation as a\nresponse. Now the verifier will verify the presentation by checking the signature and other accompanying proofs.\n\nThe presentation exchange will ensure that the model used by the verifier, can be interpreted by the holder. It then\nensures that the correct parts from the holders credentials are used to create the presentation. The PE contains all the\nlogic to interpret the models, therefore removing the need for the verifier and holder to align their specific models.\n\nThe data objects (models) used in PE-JS are generated from Sphereon's DIF PE OpenAPI Spec component. The code for the\ncomponent can be seen at [PE-OpenAPI github repository](https://github.com/Sphereon-Opensource/pe-openapi). This allows\nthe generation of the objects in many languages and frameworks consistently by configuring the maven plugin.\n\n### The PE Library supports the following actions:\n\n* Creating a presentation definition / request\n* Validating a presentation definition / conforming to the specification\n* Creating a Presentation\n* Creating a Verifiable Presentation using a callback function\n* Validating a presentation (submission) when received\n* Input evaluations: Verification of presentation submissions conforming to the presentation definition\n* Utilities: to build and use different models compliant with\n  the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/).\n\nStateful storage, signature support or credential management should be implemented in separate libraries/ modules that\nmake use of the underlying DIF Presentation Exchange implementation. By keeping these separate, the library will stay\nplatform agnostic and lean with regards to dependencies.\n\n## For PE-JS Users\n\nThe library can be installed direction from npmjs via:\n\n```shell\n# install via yarn\n  yarn add @sphereon/pe-js\n\n# install via npm\n  npm install @sphereon/pe-js\n```\n\nThe core functionality of the DIF Presentation Exchange can be outlined as follows:\n\n* Input Evaluation\n* Credential Query\n* Presentation and Verifiable Presentation creation\n* Utilities\n\n### Input Evaluation\n\nInput evaluation is the primary mechanism by which a verifier determines whether a presentation submission from a holder\nmatches the requested presentation definition from the request.\n\n```typescript\n  import pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  \"id\": \"32f54163-7166-48f1-93d8-ff217bdb0653\",\n  \"input_descriptors\": [\n    {\n      \"id\": \"wa_driver_license\",\n      \"name\": \"Washington State Business License\",\n      \"purpose\": \"We can only allow licensed Washington State business representatives into the WA Business Conference\",\n      \"schema\": [{\n        \"uri\": \"https://licenses.example.com/business-license.json\"\n      }]\n    }\n  ]\n};\n\nconst verifiablePresentation = {\n  '@context': [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  type: [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: { ... },\n  verifiableCredential: [...],\n  proof: { ... }\n}\n\nconst { value, warnings, errors } = pejs.evaluate(presentationDefinition, verifiablePresentation);\n```\n\n### Credential Query\n\nA credential query allows holders to filter their set of credentials for matches to a given presentation definition.\n\n```typescript\n  import pejs from '@sphereon/pe-js';\n\n// Definition from verifier request\nconst presentationDefinition = {\n  ...\n};\n\n// Example for loading credentials\nconst credentials = await secureStore.getCredentials();\n\n// Find matching credentials\nconst srMatches = pejs.selectFrom(presentationDefinition, credentials, holderDid);\n\n// An example that selects the first 'count' credentials from\n// the matches. in a real scenario, the user has to select which \n// credentials to use. PE-JS did the first filtering, \n// but there still could be multiple credentials satisfying a presentation definition\nconst selectedCredentials = srMatches.map(\n  ({ matches, count }) => matches.slice(0, count)\n).flat();\n\n\n```\n\n### Presentation creation (non verifiable)\n\nTo create a Presentation without Proof (for Proofs, see Verifiable Presentation below) you have to pass in the\nPresentation Definition, selected Verifiable Credentials and an optional holder (DID). The result will be a Verifiable\nPresentation, without proofs, so actually a Presentation. It also contains the presentation submission data that the\nverifier can use.\n\nIt is left up to you to sign the Presentation and adding the proof and make it a truly Verifiable Presentation. There\nare different libraries that allow you to do this. You can also use the callback integration mentioned in the next\nchapter for this.\n\n```typescript\n  import { pejs, Presentation } from '@sphereon/pe-js';\n\n// Construct presentation from selected credentials\nconst presentation: Presentation = pejs.presentationFrom(presentationDefinition, selectedCredentials, holderDID);\n/** presentation object:\n *\n *   {\n *     \"@context\": [\n *       \"https://www.w3.org/2018/credentials/v1\",\n *       \"https://identity.foundation/presentation-exchange/submission/v1\"\n *     ],\n *     \"type\": [\n *       \"VerifiablePresentation\",\n *       \"PresentationSubmission\"\n *     ],\n *     presentation_submission: presentationSubmission,\n *     verifiableCredential: selectedCredentials\n *   };\n */\n// Presentation would need to be signed and sent to verifier\n```\n\n### Verifiable Presentation with callback\n\n**NOTE:** PE-JS does not support the creation of signatures by itself. That has to do with the fact that we didn't want\nto rely on all kinds of signature suites and libraries. PE-JS has minimal dependencies currently, so that it can be used\nin all kinds of scenarios.\n\nHow did we solve this? We have created a callback mechanism, allowing you to create a callback function that gets all\ninput allowing you to use your library of choice to create the signature. The callback needs to accept\na `PresentationSignCallBackParams` object.\n\nThe method `verifiablePresentationFrom` accepts the presentation definition and selected Verifiable Credentials as the\nfirst two arguments, just like the `presentationFrom` method. Next it accepts the callback function as argument and\na `PresentationSignOptions` object as last argument. The sign callback params, allow you to control the signature\nprocess. You will have access in the callback to these params as well.\n\nBefore calling your callback function a few things happen. First of all, just like the `presentationFrom` method, it\nwill evaluate whether the supplied credentials conform to the supplied presentation definition. Then it creates a\npresentation, just like `presentationFrom`. This presentation is provided for your convenience and can be used in your\ncallback for simple use cases. In more elaborate cases, like for instance with more complex signature suites and/or\nselective disclosure, you will probably not use the Presentation directly and make use of other arguments passed into\nthe callback, like the `EvaluationResults`, `PresentationSubmission` and `Partial<Proof>`.\n\nThe `proofOptions` and `signatureOptions`, allow you to populate proof values directly. in which case\nthe `Partial<Proof>` will have all fields filled to just add it as a proof to the presentation in your callback. This\ndoes mean you would have to create the Presentation first and sign that, which means you probably have no use for the\ncallback. If you do not provide these values, the `Partial<Proof>`, will still be populated without the proofValue and\njws, based upon your options.\n\n#### Presentation Sign Options\n\nThe options accepted by the `verifiablePresentationFrom` are:\n\n````typescript\ninterface PresentationSignOptions {\n  /**\n   * The optional holder of the presentation\n   */\n  holder?: string;\n\n  /**\n   * Proof options\n   */\n  proofOptions?: ProofOptions;\n\n  /**\n   * The signature options\n   */\n  signatureOptions?: SignatureOptions;\n}\n\ninterface ProofOptions {\n  /**\n   * The signature type. For instance RsaSignature2018\n   */\n  type?: ProofType | string;\n\n  /**\n   * Type supports selective disclosure?\n   */\n  typeSupportsSelectiveDisclosure?: boolean;\n\n  /**\n   * A challenge protecting against replay attacks\n   */\n  challenge?: string;\n\n  /**\n   * A domain protecting against replay attacks\n   */\n  domain?: string;\n\n  /**\n   * The purpose of this proof, for instance assertionMethod or authentication, see https://www.w3.org/TR/vc-data-model/#proofs-signatures-0\n   */\n  proofPurpose?: ProofPurpose | string;\n\n  /**\n   * The ISO8601 date-time string for creation. You can update the Proof value later in the callback. If not supplied the current date/time will be used\n   */\n  created?: string;\n\n  /**\n   * Similar to challenge. A nonce to protect against replay attacks, used in some ZKP proofs\n   */\n  nonce?: string;\n}\n\n\ninterface SignatureOptions {\n  /**\n   * The private key\n   */\n  privateKey?: string;\n\n  /**\n   * Key encoding\n   */\n  keyEncoding?: KeyEncoding;\n\n  /**\n   * The verification method value\n   */\n  verificationMethod?: string;\n\n  /**\n   * Can be used if you want to provide the Json-ld proof value directly without relying on the callback function generating it\n   */\n  proofValue?: string; // One of any number of valid representations of proof values\n\n  /**\n   * Can be used if you want to provide the JSW proof value directly without relying on the callback function generating it\n   */\n  jws?: string; // JWS based proof\n}\n````\n\nThese options are available in your callback function by accessing the `options` field in\nthe `PresentationSignCallBackParams`.\n\n#### Callback params object\n\nThe callback params gets supplied as the single argument to your callback function. It contains the `Presentation`, a\npartial 'Proof' typically missing the proofValue/jws signature. It also contains the initially supplied Verifiable\nCredentials and Presentation Definition as well as your supplied options.\n\nIf contains the Presentation Submission object, which is also found in the presentation. You can use this to create your\nown Presentation object if you want. Lastly it contains the evaluation results, which includes the mappings and logs\nabout the evaluation.\n\nYou can either choose to use the `Presentation` and partial `Proof` together with the `options`, or in more elaborate\nuse cases opt to use the `PresentationSubmission`, `EvaluationResults` and the `options` for instance.\n\n````typescript\nexport interface PresentationSignCallBackParams {\n\n  /**\n   * The originally supplied presentation sign options\n   */\n  options: PresentationSignOptions;\n\n  /**\n   * The presentation definition\n   */\n  presentationDefinition: PresentationDefinition;\n\n  /**\n   * The selected credentials to include in the eventual VP as determined by PE-JS and/or user\n   */\n  selectedCredentials: VerifiableCredential[];\n\n  /**\n   * The presentation object created from the definition and verifiable credentials.\n   * Can be used directly or in more complex situations can be discarded by using the definition, credentials, proof options, submission and evaluation results\n   */\n  presentation: Presentation;\n\n  /**\n   * A partial proof value the callback can use to complete. If proofValue or JWS was supplied the proof could be complete already\n   */\n  proof: Partial<Proof>;\n\n  /**\n   * The presentation submission data, which can also be found in the presentation itself\n   */\n  presentationSubmission: PresentationSubmission;\n\n  /**\n   * The evaluation results, which the callback function could use to create a VP using the proof(s) using the supplied credentials\n   */\n  evaluationResults: EvaluationResults;\n}\n````\n\n#### Simple example of the callback function\n\nA simple use case using your library of choice for non-selective disclosure using an ed25519 key and signature.\n\n````typescript\nimport {\n  pejs,\n  Proof,\n  ProofPurpose,\n  ProofType,\n  VerifiablePresentation,\n  PresentationSignOptions,\n  KeyEncoding\n} from '@sphereon/pe-js';\n\nconst params: PresentationSignOptions = {\n  holder: 'did:example:1234....',\n  proofOptions: {\n    type: ProofType.Ed25519Signature2018,\n    proofPurpose: ProofPurpose.assertionMethod,\n  },\n  signatureOptions: {\n    verificationMethod: 'did:example:\"1234......#key',\n    keyEncoding: KeyEncoding.Base58,\n    privateKey: 'base58 (key encoding type) key here',\n  }\n}\n\nconst vp = pejs.verifiablePresentationFrom(presentationDefinition, selectedCredentials, simpleSignedProofCallback, params);\n\nfunction simpleSignedProofCallback(callBackParams: PresentationSignCallBackParams): VerifiablePresentation {\n  // Prereq is properly filled out `proofOptions` and `signatureOptions`, together with a `proofValue` or `jws` value.\n  // And thus a generated signature\n  const { presentation, proof, options } = callBackParams; // The created partial proof and presentation, as well as original supplied options\n  const { signatureOptions, proofOptions } = options; // extract the orignially supploed signature and proof Options\n  const privateKeyBase58 = signatureOptions.privateKey; // Please check keyEncoding from signatureOptions first!\n\n  /**\n   * Proof looks like this:\n   * {\n   *    type: 'Ed25519Signature2018',\n   *    created: '2021-12-01T20:10:45.000Z',\n   *    proofPurpose: 'assertionMethod',\n   *    verificationMethod: 'did:example:\"1234......#key',\n   *    .....\n   * }\n   */\n\n    // Just an example. Obviously your lib will have a different method signature\n  const vp = myVPSignLibrary(presentation, { ...proof, privateKeyBase58 });\n\n  return vp;\n}\n\n\n````\n\n### Utilities\n\nIn addition to the core functionality above, the underlying validation methods are exposed as low-level helper\nfunctions.\n\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  ...\n};\n\nconst { warnings: pdWarnings, errors: pdErrors } = pejs.validateDefinition(presentationDefinition);\n\nconst presentationSubmission = {\n  ...\n};\n\nconst { warnings: psWarnings, errors: psErrors } = pejs.validateSubmission(presentationSubmission);\n```\n\n## API\n\n### Evaluate\n\n```typescript\nevaluate(presentationDefinition, verifiablePresentation)\n```\n\n##### Description\n\nEvaluates whether a presentation submission meets the requested presentation definition Since this method will be used\nboth **before** and **after** creating a VerifiablePresentation, we accept both _signed_ and _unsigned_ version of a\npresentation here.\n\n#### Parameters\n\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `presentation` | `Presentation` | the Presentation object containing the required credentials and a `presentation_submission` object mapping back to the presentation definition |\n\n#### Return value\n\nIf evaluation is successful, `value` will be a non-null `PresentationSubmission` mapping the submitted credentials to\nthe requested inputs.\n\n```typescript\ninterface EvaluationResults {\n  value?: PresentationSubmission;\n  warnings?: string[];\n  errors?: Error[];\n}\n```\n\n### SelectFrom\n\n```typescript\nselectFrom(presentationDefinition, credentials, holderDids)\n```\n\n##### Description\n\nGathers the matching credentials that fit a given presentation definition\n\n#### Parameters\n\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `credentials` | `VerifiableCredential[]` | the array of verifiable credentials to select from |\n| `holderDids` | `string[]` | the holder's dids. this can be found in VerifiablePresentation's holder property note that a wallet can have many holderDids retrieved from different places|\n\n#### Return value\n\n- If the selection was successful or partially successful, the `matches` array will consist\n  of `SubmissionRequirementMatch` object(s), representing the matching credentials for each `SubmissionRequirement` in\n  the `presentationDefinition` input parameter.\n- If the selection was not successful, the `errors` array will consist of `Checked` object(s), representing what has\n  failed in your selection process.\n\n```typescript\nimport { Status } from './ConstraintUtils';\n\ninterface SelectResults {\n  errors?: Checked[];\n  matches?: SubmissionRequirementMatch[];\n  /**\n   * This is the parameter that pejs library user should look into to determine what to do next\n   * Status can have three values:\n   *  1. INFO: everything is fine, you can call `presentationFrom` after this method\n   *  2. WARN: method was called with more credentials than required.\n   *       To enhance credential holder's privacy it is recommended to select credentials which are absolutely required.\n   *  3. Error: the credentials you've sent didn't satisfy the requirement defined presentationDefinition object\n   */\n  areRequiredCredentialsPresent: Status;\n  /**\n   * All matched/selectable credentials\n   */\n  selectableVerifiableCredentials?: VerifiableCredential[];\n  /**\n   * Following are indexes of the verifiableCredentials passed to the selectFrom method that have been selected.\n   */\n  vcIndexes?: number[];\n  warnings?: Checked[];\n}\n\ninterface SubmissionRequirementMatch {\n  name?: string;\n  rule: Rules;\n  min?: number;\n  count?: number;\n  max?: number;\n  matches: string[];\n  from?: string[];\n  from_nested?: SubmissionRequirementMatch[]; // VerifiableCredential Address\n}\n```\n\n### PresentationFrom\n\n```typescript\npresentationFrom(presentationDefinition, selectedCredentials, holderDID)\n```\n\n##### Description\n\nCreates the corresponding Presentation Submission object to be included in the Verifiable Presentation response, which\nmaps the submitted credentials to the requested inputs in the `presentationDefinition` input parameter.\n\n#### Parameters\n\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `selectedCredentials` | `VerifiableCredential[]` | the array of verifiable credentials that meet the submission requirements in the presentation definition |\n| `holderDid` | `string` | the holder's DID. This can be found in VerifiablePresentation's holder property note that a wallet can have many holderDIDs retrieved from different places|\n\n#### Return value\n\nIf the selected credentials successfully match the submission requirements in the presentation definition, the return\nvalue will be a non-null `PresentationSubmission`\n\n```typescript\ninterface PresentationSubmission {\n  id?: string;\n  definition_id: string;\n  descriptor_map: Descriptor[]\n}\n```\n\n### Validation\n\n```typescript\nvalidateDefinition(objToValidate)\n```\n\n```typescript\nvalidateSubmission(objToValidate)\n```\n\n#### Description\n\nA validation utility function for `PresentationDefinition` and `PresentationSubmission` objects.\n\n#### Parameters\n\n| name | type | description|\n|------|------|------------|\n| `objToValidate` | <code>PresentationDefinition &#124; PresentationSubmission</code> | the presentation definition or presentation definition to be validated |\n\n#### Return value\n\nThe `validate` method returns a validated results array `NonEmptyArray<Checked>` , with structure:\n\n```typescript\ninterface Checked {\n  tag: string;\n  status: Status;\n  message?: string;\n}\n```\n\nstatus can have following values `'info' | 'warn' | 'error'`\n\n## Workflow Diagram\n\n![Flow diagram](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/Sphereon-Opensource/pe-js/develop/docs/simple-scenario.puml)\n\n## For PE-JS developers\n\nThis project has been created using:\n\n* `yarn` version 1.22.5\n* `node` version 12.22.1\n\n### Install\n\n   ```shell\n   yarn install\n   ```\n\n### Build\n\n   ```shell\n   yarn build\n   ```\n\n### Test\n\nThe test command runs:\n\n* `eslint`\n* `prettier`\n* `unit`\n\nYou can also run only a single section of these tests, using for example `yarn test:unit`.\n\n   ```shell\n   yarn test\n   ```\n\n### Utility scripts\n\nThere are several other utility scripts that help with development.\n\n* `yarn fix` - runs `eslint --fix` as well as `prettier` to fix code style\n* `yarn cov` - generates code coverage report\n\n# Glossary\n\nTerm | Definition |\n---- | ---------- |\nCredential | A set of one or more claims made by an issuer. |\nVerifiable Credential |  Is a tamper-evident credential that has authorship that can be cryptographically verified. Verifiable credentials can be used to build verifiable presentations, which can also be cryptographically verified. The claims in a credential can be about different subjects. |\nPresentation Definition | Presentation Definitions are objects that articulate what proofs a Verifier requires. |\nHolder | Holders are entities that have one or more verifiable credentials in their possession. Holders are also the entities that submit proofs to Verifiers to satisfy the requirements described in a Presentation Definition.\nHolder's Did | Unique ID URI string and PKI metadata document format for describing the cryptographic keys and other fundamental PKI values linked to a unique, user-controlled, self-sovereign identifier in holder's wallet|\nVerifier | Verifiers are entities that define what proofs they require from a Holder (via a Presentation Definition) in order to proceed with an interaction. |\nIssuer | A role an entity can perform by asserting claims about one or more subjects, creating a verifiable credential from these claims, and transmitting the verifiable credential to a holder. |\nPresentation | Data derived from one or more verifiable credentials, issued by one or more issuers |\nVerifiable Presentation | Is a tamper-evident presentation encoded in such a way that authorship of the data can be trusted after a process of cryptographic verification.\n\n## Further work:\n\n1. Implementation of presentation-exchange v2\n2. In the [DIF documentation](https://identity.foundation/presentation-exchange/#input-evaluation) some entries are\n   addressing `nested credentials` and `nested paths` these are currently not fully support yet.\n","licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.5.0-unstable.1","dist":{"shasum":"4185f7c94ff30c381001ffaed9e202e864f6de9c","integrity":"sha512-8yF3NxRPqkUThvNLUBs+hgHVDNHM9t7hNzBxEDNXYMmgvCHC++9N1IdzOK2bVYEuA7ya3E3cINdGPckLZQjeow==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.5.0-unstable.1.tgz","fileCount":404,"unpackedSize":1798022,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhouO5CRA9TVsSAnZWagAAr78P+wfDdF2iWSwZDMiKmzrf\nueTIIp94aJnOxQ+cwZTpU5scjz14ZyMn9hj6Kmfw7UOMuVPUeHSubpqbVrQ7\nUyDE1yTKKSbuF4+FTCinZ8mTZ+kZGuIlGaBLYTc1K16m5H8OsOb91b3RiYMM\nVC89Ppm4WNamrGnr9rmJm4Byx1tcu42Np3anotoLhb/VbRsyilprr1v1fODL\n/zawm9amLTKgCM75alep8Of6ACbOgwQRMw+MH0rQWwd1l49vWT9wx2pG+OS9\n8BVvBljfZPzt1dytsAKmKDyYp11ejXaTk7MD4MqkXva78jmVmw40x4uQscEA\nLdReIm0KSsSdoD3XeFOHaq5ky+N6OG3X31EJfGMA6pXyTOkj11J8XB9cQvr/\n9rpzfOb+oUPOW0s0wGlrSsdRLOEHH0Pkpqzhglw5fbh+WXDtVs4Bwxr4MGpW\n/rs8ZUEpnw0P6ZLaoxzqH+hTPB15dsDYsu2zCBy1FJDy+nm+QBA2rPr+SXsW\n3nPoZGufiONQp9yqrgr5yDS8qG2+y80i9OuTu75Mnsc/Q5vnbHHleX1kLGLD\ngStohEiKwsalKBIc49ltHOKTRTy8auKhY+7cAh3vXrjKyFTwIa086Prw13SU\n5/WQCHci90GAVQzcxywrQDP28F1AH7pZ3hJ8QX0r3n1smnEnqi9MSItuYCFx\nskyi\r\n=FICm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDgyxdeEHAHX04oAgR2fYDDenWjz7tvEwwfxDsVkld35gIgUk4Pd59aNzhTN52P9AJslWGBi4eRt3GAJICGYbm4s/E="}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.5.0-unstable.1_1638065081179_0.41769919182087056"},"_hasShrinkwrap":false},"0.5.0-unstable.2":{"name":"@sphereon/pe-js","version":"0.5.0-unstable.2","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","module":"dist/module/index.js","browser":"dist/browser/index.js","typings":"dist/main/index.d.ts","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosure","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build:browser":"tsc -p tsconfig.browser.json","build:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","rimraf":"^2.6.2","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":120},"readmeFilename":"README.md","readme":"<h1 align=\"center\">\n  <br>\n  <a href=\"https://www.sphereon.com\"><img src=\"https://sphereon.com/content/themes/sphereon/assets/img/logo.svg\" alt=\"Sphereon\" width=\"400\"></a>\n  <br>PE-JS   DIF Presentation Exchange Type/JavaScript Library \n  <br>\n</h1>\n\n[![CI](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml/badge.svg)](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/Sphereon-Opensource/pe-js/branch/develop/graph/badge.svg?token=9P1JGUYA35)](https://codecov.io/gh/Sphereon-Opensource/pe-js) [![NPM Version](https://img.shields.io/npm/v/@sphereon/pe-js.svg)](https://npm.im/@sphereon/pe-js)\n\n## Active Development\n\n_IMPORTANT: This software still is in early development stage. As such you should expect breaking changes in APIs, we\nexpect to keep that to a minimum though._\n\n## Background\n\nThe PE-JS Library is a general use presentation exchange library that implements the functionality described in\nthe [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/). It is written\nin Typescript and can be compiled to any target JavaScript version.\n\nSphereon's PE Library is useful for both verifier systems and holders (e.g. wallets) and can be used in client side\nbrowsers and mobile applications as well as on server side technology such as REST APIs (e.g. built with NodeJS). It\nallows anyone to add DIF Presentation Exchange logic to their existing wallets, agents and/or verifiers, without making\nany further assumptions about the technologies used in their products.\n\nThe presentation exchange operates generally as follows; The verifier creates a Presentation Definition asking for\ncredentials from the holder. The definition for the credentials is sent to the holder, who returns a presentation as a\nresponse. Now the verifier will verify the presentation by checking the signature and other accompanying proofs.\n\nThe presentation exchange will ensure that the model used by the verifier, can be interpreted by the holder. It then\nensures that the correct parts from the holders credentials are used to create the presentation. The PE contains all the\nlogic to interpret the models, therefore removing the need for the verifier and holder to align their specific models.\n\nThe data objects (models) used in PE-JS are generated from Sphereon's DIF PE OpenAPI Spec component. The code for the\ncomponent can be seen at [PE-OpenAPI github repository](https://github.com/Sphereon-Opensource/pe-openapi). This allows\nthe generation of the objects in many languages and frameworks consistently by configuring the maven plugin.\n\n### The PE Library supports the following actions:\n\n* Creating a presentation definition / request\n* Validating a presentation definition / conforming to the specification\n* Creating a Presentation\n* Creating a Verifiable Presentation using a callback function\n* Validating a presentation (submission) when received\n* Input evaluations: Verification of presentation submissions conforming to the presentation definition\n* Utilities: to build and use different models compliant with\n  the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/).\n\nStateful storage, signature support or credential management should be implemented in separate libraries/ modules that\nmake use of the underlying DIF Presentation Exchange implementation. By keeping these separate, the library will stay\nplatform agnostic and lean with regards to dependencies.\n\n## For PE-JS Users\n\nThe library can be installed direction from npmjs via:\n\n```shell\n# install via yarn\n  yarn add @sphereon/pe-js\n\n# install via npm\n  npm install @sphereon/pe-js\n```\n\nThe core functionality of the DIF Presentation Exchange can be outlined as follows:\n\n* Input Evaluation\n* Credential Query\n* Presentation and Verifiable Presentation creation\n* Utilities\n\n### Input Evaluation\n\nInput evaluation is the primary mechanism by which a verifier determines whether a presentation submission from a holder\nmatches the requested presentation definition from the request.\n\n```typescript\n  import pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  \"id\": \"32f54163-7166-48f1-93d8-ff217bdb0653\",\n  \"input_descriptors\": [\n    {\n      \"id\": \"wa_driver_license\",\n      \"name\": \"Washington State Business License\",\n      \"purpose\": \"We can only allow licensed Washington State business representatives into the WA Business Conference\",\n      \"schema\": [{\n        \"uri\": \"https://licenses.example.com/business-license.json\"\n      }]\n    }\n  ]\n};\n\nconst verifiablePresentation = {\n  '@context': [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  type: [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: { ... },\n  verifiableCredential: [...],\n  proof: { ... }\n}\n\nconst { value, warnings, errors } = pejs.evaluate(presentationDefinition, verifiablePresentation);\n```\n\n### Credential Query\n\nA credential query allows holders to filter their set of credentials for matches to a given presentation definition.\n\n```typescript\n  import pejs from '@sphereon/pe-js';\n\n// Definition from verifier request\nconst presentationDefinition = {\n  ...\n};\n\n// Example for loading credentials\nconst credentials = await secureStore.getCredentials();\n\n// Find matching credentials\nconst srMatches = pejs.selectFrom(presentationDefinition, credentials, holderDid);\n\n// An example that selects the first 'count' credentials from\n// the matches. in a real scenario, the user has to select which \n// credentials to use. PE-JS did the first filtering, \n// but there still could be multiple credentials satisfying a presentation definition\nconst selectedCredentials = srMatches.map(\n  ({ matches, count }) => matches.slice(0, count)\n).flat();\n\n\n```\n\n### Presentation creation (non verifiable)\n\nTo create a Presentation without Proof (for Proofs, see Verifiable Presentation below) you have to pass in the\nPresentation Definition, selected Verifiable Credentials and an optional holder (DID). The result will be a Verifiable\nPresentation, without proofs, so actually a Presentation. It also contains the presentation submission data that the\nverifier can use.\n\nIt is left up to you to sign the Presentation and adding the proof and make it a truly Verifiable Presentation. There\nare different libraries that allow you to do this. You can also use the callback integration mentioned in the next\nchapter for this.\n\n```typescript\n  import { pejs, Presentation } from '@sphereon/pe-js';\n\n// Construct presentation from selected credentials\nconst presentation: Presentation = pejs.presentationFrom(presentationDefinition, selectedCredentials, holderDID);\n/** presentation object:\n *\n *   {\n *     \"@context\": [\n *       \"https://www.w3.org/2018/credentials/v1\",\n *       \"https://identity.foundation/presentation-exchange/submission/v1\"\n *     ],\n *     \"type\": [\n *       \"VerifiablePresentation\",\n *       \"PresentationSubmission\"\n *     ],\n *     presentation_submission: presentationSubmission,\n *     verifiableCredential: selectedCredentials\n *   };\n */\n// Presentation would need to be signed and sent to verifier\n```\n\n### Verifiable Presentation with callback\n\n**NOTE:** PE-JS does not support the creation of signatures by itself. That has to do with the fact that we didn't want\nto rely on all kinds of signature suites and libraries. PE-JS has minimal dependencies currently, so that it can be used\nin all kinds of scenarios.\n\nHow did we solve this? We have created a callback mechanism, allowing you to create a callback function that gets all\ninput allowing you to use your library of choice to create the signature. The callback needs to accept\na `PresentationSignCallBackParams` object.\n\nThe method `verifiablePresentationFrom` accepts the presentation definition and selected Verifiable Credentials as the\nfirst two arguments, just like the `presentationFrom` method. Next it accepts the callback function as argument and\na `PresentationSignOptions` object as last argument. The sign callback params, allow you to control the signature\nprocess. You will have access in the callback to these params as well.\n\nBefore calling your callback function a few things happen. First of all, just like the `presentationFrom` method, it\nwill evaluate whether the supplied credentials conform to the supplied presentation definition. Then it creates a\npresentation, just like `presentationFrom`. This presentation is provided for your convenience and can be used in your\ncallback for simple use cases. In more elaborate cases, like for instance with more complex signature suites and/or\nselective disclosure, you will probably not use the Presentation directly and make use of other arguments passed into\nthe callback, like the `EvaluationResults`, `PresentationSubmission` and `Partial<Proof>`.\n\nThe `proofOptions` and `signatureOptions`, allow you to populate proof values directly. in which case\nthe `Partial<Proof>` will have all fields filled to just add it as a proof to the presentation in your callback. This\ndoes mean you would have to create the Presentation first and sign that, which means you probably have no use for the\ncallback. If you do not provide these values, the `Partial<Proof>`, will still be populated without the proofValue and\njws, based upon your options.\n\n#### Presentation Sign Options\n\nThe options accepted by the `verifiablePresentationFrom` are:\n\n````typescript\ninterface PresentationSignOptions {\n  /**\n   * The optional holder of the presentation\n   */\n  holder?: string;\n\n  /**\n   * Proof options\n   */\n  proofOptions?: ProofOptions;\n\n  /**\n   * The signature options\n   */\n  signatureOptions?: SignatureOptions;\n}\n\ninterface ProofOptions {\n  /**\n   * The signature type. For instance RsaSignature2018\n   */\n  type?: ProofType | string;\n\n  /**\n   * Type supports selective disclosure?\n   */\n  typeSupportsSelectiveDisclosure?: boolean;\n\n  /**\n   * A challenge protecting against replay attacks\n   */\n  challenge?: string;\n\n  /**\n   * A domain protecting against replay attacks\n   */\n  domain?: string;\n\n  /**\n   * The purpose of this proof, for instance assertionMethod or authentication, see https://www.w3.org/TR/vc-data-model/#proofs-signatures-0\n   */\n  proofPurpose?: ProofPurpose | string;\n\n  /**\n   * The ISO8601 date-time string for creation. You can update the Proof value later in the callback. If not supplied the current date/time will be used\n   */\n  created?: string;\n\n  /**\n   * Similar to challenge. A nonce to protect against replay attacks, used in some ZKP proofs\n   */\n  nonce?: string;\n}\n\n\ninterface SignatureOptions {\n  /**\n   * The private key\n   */\n  privateKey?: string;\n\n  /**\n   * Key encoding\n   */\n  keyEncoding?: KeyEncoding;\n\n  /**\n   * The verification method value\n   */\n  verificationMethod?: string;\n\n  /**\n   * Can be used if you want to provide the Json-ld proof value directly without relying on the callback function generating it\n   */\n  proofValue?: string; // One of any number of valid representations of proof values\n\n  /**\n   * Can be used if you want to provide the JSW proof value directly without relying on the callback function generating it\n   */\n  jws?: string; // JWS based proof\n}\n````\n\nThese options are available in your callback function by accessing the `options` field in\nthe `PresentationSignCallBackParams`.\n\n#### Callback params object\n\nThe callback params gets supplied as the single argument to your callback function. It contains the `Presentation`, a\npartial 'Proof' typically missing the proofValue/jws signature. It also contains the initially supplied Verifiable\nCredentials and Presentation Definition as well as your supplied options.\n\nIf contains the Presentation Submission object, which is also found in the presentation. You can use this to create your\nown Presentation object if you want. Lastly it contains the evaluation results, which includes the mappings and logs\nabout the evaluation.\n\nYou can either choose to use the `Presentation` and partial `Proof` together with the `options`, or in more elaborate\nuse cases opt to use the `PresentationSubmission`, `EvaluationResults` and the `options` for instance.\n\n````typescript\nexport interface PresentationSignCallBackParams {\n\n  /**\n   * The originally supplied presentation sign options\n   */\n  options: PresentationSignOptions;\n\n  /**\n   * The presentation definition\n   */\n  presentationDefinition: PresentationDefinition;\n\n  /**\n   * The selected credentials to include in the eventual VP as determined by PE-JS and/or user\n   */\n  selectedCredentials: VerifiableCredential[];\n\n  /**\n   * The presentation object created from the definition and verifiable credentials.\n   * Can be used directly or in more complex situations can be discarded by using the definition, credentials, proof options, submission and evaluation results\n   */\n  presentation: Presentation;\n\n  /**\n   * A partial proof value the callback can use to complete. If proofValue or JWS was supplied the proof could be complete already\n   */\n  proof: Partial<Proof>;\n\n  /**\n   * The presentation submission data, which can also be found in the presentation itself\n   */\n  presentationSubmission: PresentationSubmission;\n\n  /**\n   * The evaluation results, which the callback function could use to create a VP using the proof(s) using the supplied credentials\n   */\n  evaluationResults: EvaluationResults;\n}\n````\n\n#### Simple example of the callback function\n\nA simple use case using your library of choice for non-selective disclosure using an ed25519 key and signature.\n\n````typescript\nimport {\n  pejs,\n  Proof,\n  ProofPurpose,\n  ProofType,\n  VerifiablePresentation,\n  PresentationSignOptions,\n  KeyEncoding\n} from '@sphereon/pe-js';\n\nconst params: PresentationSignOptions = {\n  holder: 'did:example:1234....',\n  proofOptions: {\n    type: ProofType.Ed25519Signature2018,\n    proofPurpose: ProofPurpose.assertionMethod,\n  },\n  signatureOptions: {\n    verificationMethod: 'did:example:\"1234......#key',\n    keyEncoding: KeyEncoding.Base58,\n    privateKey: 'base58 (key encoding type) key here',\n  }\n}\n\nconst vp = pejs.verifiablePresentationFrom(presentationDefinition, selectedCredentials, simpleSignedProofCallback, params);\n\nfunction simpleSignedProofCallback(callBackParams: PresentationSignCallBackParams): VerifiablePresentation {\n  // Prereq is properly filled out `proofOptions` and `signatureOptions`, together with a `proofValue` or `jws` value.\n  // And thus a generated signature\n  const { presentation, proof, options } = callBackParams; // The created partial proof and presentation, as well as original supplied options\n  const { signatureOptions, proofOptions } = options; // extract the orignially supploed signature and proof Options\n  const privateKeyBase58 = signatureOptions.privateKey; // Please check keyEncoding from signatureOptions first!\n\n  /**\n   * Proof looks like this:\n   * {\n   *    type: 'Ed25519Signature2018',\n   *    created: '2021-12-01T20:10:45.000Z',\n   *    proofPurpose: 'assertionMethod',\n   *    verificationMethod: 'did:example:\"1234......#key',\n   *    .....\n   * }\n   */\n\n    // Just an example. Obviously your lib will have a different method signature\n  const vp = myVPSignLibrary(presentation, { ...proof, privateKeyBase58 });\n\n  return vp;\n}\n\n\n````\n\n### Utilities\n\nIn addition to the core functionality above, the underlying validation methods are exposed as low-level helper\nfunctions.\n\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  ...\n};\n\nconst { warnings: pdWarnings, errors: pdErrors } = pejs.validateDefinition(presentationDefinition);\n\nconst presentationSubmission = {\n  ...\n};\n\nconst { warnings: psWarnings, errors: psErrors } = pejs.validateSubmission(presentationSubmission);\n```\n\n## API\n\n### Evaluate\n\n```typescript\nevaluate(presentationDefinition, verifiablePresentation)\n```\n\n##### Description\n\nEvaluates whether a presentation submission meets the requested presentation definition Since this method will be used\nboth **before** and **after** creating a VerifiablePresentation, we accept both _signed_ and _unsigned_ version of a\npresentation here.\n\n#### Parameters\n\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `presentation` | `Presentation` | the Presentation object containing the required credentials and a `presentation_submission` object mapping back to the presentation definition |\n\n#### Return value\n\nIf evaluation is successful, `value` will be a non-null `PresentationSubmission` mapping the submitted credentials to\nthe requested inputs.\n\n```typescript\ninterface EvaluationResults {\n  value?: PresentationSubmission;\n  warnings?: string[];\n  errors?: Error[];\n}\n```\n\n### SelectFrom\n\n```typescript\nselectFrom(presentationDefinition, credentials, holderDids)\n```\n\n##### Description\n\nGathers the matching credentials that fit a given presentation definition\n\n#### Parameters\n\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `credentials` | `VerifiableCredential[]` | the array of verifiable credentials to select from |\n| `holderDids` | `string[]` | the holder's dids. this can be found in VerifiablePresentation's holder property note that a wallet can have many holderDids retrieved from different places|\n\n#### Return value\n\n- If the selection was successful or partially successful, the `matches` array will consist\n  of `SubmissionRequirementMatch` object(s), representing the matching credentials for each `SubmissionRequirement` in\n  the `presentationDefinition` input parameter.\n- If the selection was not successful, the `errors` array will consist of `Checked` object(s), representing what has\n  failed in your selection process.\n\n```typescript\nimport { Status } from './ConstraintUtils';\n\ninterface SelectResults {\n  errors?: Checked[];\n  matches?: SubmissionRequirementMatch[];\n  /**\n   * This is the parameter that pejs library user should look into to determine what to do next\n   * Status can have three values:\n   *  1. INFO: everything is fine, you can call `presentationFrom` after this method\n   *  2. WARN: method was called with more credentials than required.\n   *       To enhance credential holder's privacy it is recommended to select credentials which are absolutely required.\n   *  3. Error: the credentials you've sent didn't satisfy the requirement defined presentationDefinition object\n   */\n  areRequiredCredentialsPresent: Status;\n  /**\n   * All matched/selectable credentials\n   */\n  selectableVerifiableCredentials?: VerifiableCredential[];\n  /**\n   * Following are indexes of the verifiableCredentials passed to the selectFrom method that have been selected.\n   */\n  vcIndexes?: number[];\n  warnings?: Checked[];\n}\n\ninterface SubmissionRequirementMatch {\n  name?: string;\n  rule: Rules;\n  min?: number;\n  count?: number;\n  max?: number;\n  matches: string[];\n  from?: string[];\n  from_nested?: SubmissionRequirementMatch[]; // VerifiableCredential Address\n}\n```\n\n### PresentationFrom\n\n```typescript\npresentationFrom(presentationDefinition, selectedCredentials, holderDID)\n```\n\n##### Description\n\nCreates the corresponding Presentation Submission object to be included in the Verifiable Presentation response, which\nmaps the submitted credentials to the requested inputs in the `presentationDefinition` input parameter.\n\n#### Parameters\n\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `selectedCredentials` | `VerifiableCredential[]` | the array of verifiable credentials that meet the submission requirements in the presentation definition |\n| `holderDid` | `string` | the holder's DID. This can be found in VerifiablePresentation's holder property note that a wallet can have many holderDIDs retrieved from different places|\n\n#### Return value\n\nIf the selected credentials successfully match the submission requirements in the presentation definition, the return\nvalue will be a non-null `PresentationSubmission`\n\n```typescript\ninterface PresentationSubmission {\n  id?: string;\n  definition_id: string;\n  descriptor_map: Descriptor[]\n}\n```\n\n### Validation\n\n```typescript\nvalidateDefinition(objToValidate)\n```\n\n```typescript\nvalidateSubmission(objToValidate)\n```\n\n#### Description\n\nA validation utility function for `PresentationDefinition` and `PresentationSubmission` objects.\n\n#### Parameters\n\n| name | type | description|\n|------|------|------------|\n| `objToValidate` | <code>PresentationDefinition &#124; PresentationSubmission</code> | the presentation definition or presentation definition to be validated |\n\n#### Return value\n\nThe `validate` method returns a validated results array `NonEmptyArray<Checked>` , with structure:\n\n```typescript\ninterface Checked {\n  tag: string;\n  status: Status;\n  message?: string;\n}\n```\n\nstatus can have following values `'info' | 'warn' | 'error'`\n\n## Workflow Diagram\n\n![Flow diagram](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/Sphereon-Opensource/pe-js/develop/docs/simple-scenario.puml)\n\n## For PE-JS developers\n\nThis project has been created using:\n\n* `yarn` version 1.22.5\n* `node` version 12.22.1\n\n### Install\n\n   ```shell\n   yarn install\n   ```\n\n### Build\n\n   ```shell\n   yarn build\n   ```\n\n### Test\n\nThe test command runs:\n\n* `eslint`\n* `prettier`\n* `unit`\n\nYou can also run only a single section of these tests, using for example `yarn test:unit`.\n\n   ```shell\n   yarn test\n   ```\n\n### Utility scripts\n\nThere are several other utility scripts that help with development.\n\n* `yarn fix` - runs `eslint --fix` as well as `prettier` to fix code style\n* `yarn cov` - generates code coverage report\n\n# Glossary\n\nTerm | Definition |\n---- | ---------- |\nCredential | A set of one or more claims made by an issuer. |\nVerifiable Credential |  Is a tamper-evident credential that has authorship that can be cryptographically verified. Verifiable credentials can be used to build verifiable presentations, which can also be cryptographically verified. The claims in a credential can be about different subjects. |\nPresentation Definition | Presentation Definitions are objects that articulate what proofs a Verifier requires. |\nHolder | Holders are entities that have one or more verifiable credentials in their possession. Holders are also the entities that submit proofs to Verifiers to satisfy the requirements described in a Presentation Definition.\nHolder's Did | Unique ID URI string and PKI metadata document format for describing the cryptographic keys and other fundamental PKI values linked to a unique, user-controlled, self-sovereign identifier in holder's wallet|\nVerifier | Verifiers are entities that define what proofs they require from a Holder (via a Presentation Definition) in order to proceed with an interaction. |\nIssuer | A role an entity can perform by asserting claims about one or more subjects, creating a verifiable credential from these claims, and transmitting the verifiable credential to a holder. |\nPresentation | Data derived from one or more verifiable credentials, issued by one or more issuers |\nVerifiable Presentation | Is a tamper-evident presentation encoded in such a way that authorship of the data can be trusted after a process of cryptographic verification.\n\n## Further work:\n\n1. Implementation of presentation-exchange v2\n2. In the [DIF documentation](https://identity.foundation/presentation-exchange/#input-evaluation) some entries are\n   addressing `nested credentials` and `nested paths` these are currently not fully support yet.\n","licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.5.0-unstable.2","dist":{"shasum":"7db8f81c07f1c13319e7f2827af3cd94d7d35a97","integrity":"sha512-qIYwckph9jZM217BdU3/cizDY+pIV6w/wQbSrzjYYsBdMPbppf+fAhI91gA6AaztxmbhrtgpVzTY/xy9xJl3QA==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.5.0-unstable.2.tgz","fileCount":419,"unpackedSize":1816278,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhoubGCRA9TVsSAnZWagAAk10P/jEH6br3iSNv3nfVL29S\nVicrpyTmiqhLBbPTIBNpJnzgSYnSU58xCRyQTVQzfugCrEj4dkjn6WY1otMi\nWUwYWNDOnYauHmitA4xVqT1e4tyI+/R5DtWxEVnOSbzbh+SFhqpKJDpMFwFZ\n0jiLvuhWRnkMGKzgKMpRT+uNgk0qEA2pqnp4GGUS8x24g6d1nDysDkVws2gi\nGLrZcd/58MYSoJ7OFgsgBYsvWARaBOYEuQNfngwLPjfUhOENINxdOgS9TdzL\nMsffvgbWh8SeYeMakWrYnmW9ZJwFJn2fK6VOKOH8npGojofOSQSrc1d3Lgei\nGwKNri/IiRkKzqSnjMRQA0ViBGeOlOxyx/telHftcxTfZoUZEOZ74BnnPSoQ\ni2luklQF3uEXj6+JHcwhEEpKopIMqIyFxRB1JGNC47hs1gF4Ixc9HoJbESGW\nFsXmKTVMvh7WdeVbFlwOiAqE1jOllRcjPK/2ySnMufFKJAa161aNhCG/zAHM\nywsNFb0WyJuoG6ptM0mh+9sZTiE86IsaeRz+LL5TWhnB2GRo5fshqLxKtzNE\nICT5X2eU1aEMBGC0789bPHLPDC3So4bPAGv2VG+yXBIA7JgFsXkriB0rOjUp\nHXbya03px7QlcBJBZW1bzRAPH69fkRskodW3Oq39mN4uYV9NUT89ei/iZGxg\nrDC1\r\n=19G5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEp2qhqft3YCiKkiku9HusPCsi3guXSCzjRkl2PbBEzIAiA4P3WdYY8T9pV6L8hv03kaB3M9u2CzX71C0zk75TilGQ=="}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.5.0-unstable.2_1638065862401_0.9523132181824974"},"_hasShrinkwrap":false},"0.5.0":{"name":"@sphereon/pe-js","version":"0.5.0","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","module":"dist/module/index.js","browser":"dist/browser/index.js","typings":"dist/main/index.d.ts","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosure","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build:browser":"tsc -p tsconfig.browser.json","build:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","rimraf":"^2.6.2","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":120},"licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.5.0","dist":{"shasum":"5069824a4ea08b9c3a98098c79fd8c4e37338f17","integrity":"sha512-4MzvHkT0pzuiozoAvI+3Xyk2HeJrAxux6NBsH0pYTeE5EglZlvzmh7W/SCd84iIrpYCTcw1u04cJ9g5er6cFdA==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.5.0.tgz","fileCount":319,"unpackedSize":1153358,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhpMoKCRA9TVsSAnZWagAASl4P/1pibtjf594BGbfvTHbO\nKgM1MGA8epGa09Kmgu4YnerbYNQoM1jDMTbb36bMLvpNzWio05iTTCbnkQIh\nzh7uM4BIMNcVxhoWfCBLb9R7EeG0yiueHKJ/+CgraKUrt9GALyEQR6wkVntG\nvhpJzpwa8zuRFykmBfsUj5Lw5/u0tZDRYY2+zUYdlSqYA2PhdYiRmMI69kZH\nWY7RG7MAYLY6tsGDBWj3wx6sSkHJ+bj8tBVM58TV8wQz96jw3YCwFRXHGYh4\nhhm99mcfl/7yswNDsgqpWZdvtHIkIG2KX9Zy4tZ86kxZImBtt8LJyn2Uid4L\n3lWwCbilfuP1tqQbjKUXjAzxhCxuGf3xf3SSmhmhuZRQgIfRWPxFEJiwQ+Wl\nxxkmBaoePRTT6kXxISEXwdut6AiJ79qnRhHVRPVdRLrFCCfGgfvDLKxGKXLc\nFQb2PaJHHHImZESYPRp/yNZVMppyr/lCg0HfoZsnpIJF9KZQzK0fFhTDB7yG\nexTsyekAxdeqvG3rIrcDUw6oPrNsWVN1/PGVpDJriZnlMPIVjoK9V5dQlXdA\nEJjPcnZ9r1a+mbLKSjQdmIfxP7jNHM2tp4sar2vWXojZI4J33McMutvKF6Um\n+Sh+ncbT/bjOtwY89R3a7ajLLYi6MSAlMV+/OHfiNtBTerThTQzgS8qWbQvD\nY+n8\r\n=k770\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF0A5qZaq2aoLC2/WViiEqHUVh5T9Q6PuBV2UWkv/9GcAiBls/lFhrlQJo8rjLaAOzgBmd8lBcgoDAtemadcsjDolQ=="}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.5.0_1638189578772_0.856939629101968"},"_hasShrinkwrap":false,"deprecated":"WARNING: Project was renamed to @sphereon/pex. Please use the new package name"},"0.5.1":{"name":"@sphereon/pe-js","version":"0.5.1","description":"A Typescript implementation of the DIF Presentation Exchange specification.","main":"dist/main/index.js","module":"dist/module/index.js","browser":"dist/browser/index.js","typings":"dist/main/index.d.ts","repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosure","DIF"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.main.json","build:browser":"tsc -p tsconfig.browser.json","build:module":"tsc -p tsconfig.module.json","clean":"rimraf node_modules dist coverage","fix":"run-s fix:*","fix:prettier":"prettier \"{lib,test}/**/*.ts\" --write","fix:lint":"eslint . --ext .ts --fix","test":"run-s build test:*","test:lint":"eslint . --ext .ts","test:prettier":"prettier \"{lib,test}/**/*.ts\" --list-different","test:unit":"jest","test:cov":"jest --ci --coverage && codecov"},"engines":{"node":">=10"},"dependencies":{"@sphereon/pe-models":"0.0.5","ajv":"^8.6.3","ajv-formats":"^2.1.1","jsonpath":"^1.1.1","nanoid":"^3.1.25"},"devDependencies":{"@types/jest":"^27.0.1","@types/jsonpath":"^0.2.0","@types/node":"^16.11.2","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","codecov":"^3.8.3","cspell":"^5.9.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","jest":"^27.2.0","npm-run-all":"^4.1.5","open-cli":"^7.0.1","prettier":"^2.4.0","rimraf":"^2.6.2","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.4.3"},"prettier":{"singleQuote":true,"printWidth":120},"licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2020] [Sphereon BV, info@sphereon.com]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","_id":"@sphereon/pe-js@0.5.1","dist":{"shasum":"37feef3cd29d3595319f1f9fe91d7b6e643a15d3","integrity":"sha512-dFr5LJ5VjnHJBYuEmHNoCMs1dyzqisbwdUl9HW5avQO+G1KvzfPGwOPl5b30+eq/40USXimJZvVrRit34tSVXA==","tarball":"https://registry.npmjs.org/@sphereon/pe-js/-/pe-js-0.5.1.tgz","fileCount":319,"unpackedSize":1169079,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhqkIhCRA9TVsSAnZWagAAYGsQAICCuk/8MLhCbaL06aWZ\nbFya/PcvJ+TVa2bbLX71lcViIfhL7QXWLGFTRNK+cb5wHP9+kZYvHq4XaweN\nSACizwtqCukS5tZ8/F7B7KdPTIDAlS2vb+ODTUmLYGfau8V2c8vN0UUdFIML\n5GlSYKvsvqGwUo5G1brSxWMEz8Z3PBRiFIK1jZFfi8cE5xVrAaoZwgPVR0kW\nax1yAh4hjEoeLFBcgvWOK6/hf86vnamxxFKFo0VJS++jrGTRsfULkFkQZ/PB\nXm1Hau7thoSJN/vqXvc58CFtFFj4g8tYrBmvBTemrErf9ZGj/MVsG7LLDZMW\ndw579EoF/2AQWd8CTXRc6aU3ZPe0C8OvDceX2ele5uPX/1KhZzpLdicbf0kC\nrdn6obBJ3iQYlI/QBVemqUe0NVjaikKsXsuzzSw0vMk016HI1GTEdxuo4DpQ\nzsr6jQjiifTyJ5dWEOJzkD9lDO/UvIKHd2tYrDTkGOLRfYwnEkRUArFcTbVl\ni+1ZkH498zlN+98LHGx/jT5tQXsPDVSFBfaGFp/ZOKrib+lPSYPgPyn/PZAO\nnMBCihpkjMufNoMCYNDk0sEZA5Bu1jL1SCwrskHfKsJme8JYBBLH+ifwIOig\n9JJksxrpVwAh1BVVRXVX+eeVq33vpuiaOHjHl4lVql2YNzP54jLaHLqftdEh\nJdlI\r\n=R33A\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG2qDam2v0Aa887lfubt6r1hbXDDV/ArAxarNtQT3eY5AiEAoFaCIcaMgldYN0MuPE91TavxUV5opgQuxglYJubXWmA="}]},"_npmUser":{"name":"nklomp78","email":"dev@sphereon.com"},"directories":{},"maintainers":[{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"},{"name":"bramtencate","email":"btencate@sphereon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pe-js_0.5.1_1638548001398_0.9193274304120909"},"_hasShrinkwrap":false,"deprecated":"WARNING: Project was renamed to @sphereon/pex. Please use the new package name"}},"time":{"created":"2021-08-17T21:15:48.113Z","0.0.1":"2021-08-17T21:15:48.408Z","modified":"2022-04-07T01:33:21.642Z","0.1.0":"2021-09-03T18:25:02.933Z","0.1.1":"2021-09-09T17:46:15.871Z","0.2.0":"2021-09-15T11:18:21.377Z","0.2.1":"2021-09-15T13:21:51.967Z","0.2.2":"2021-09-15T15:26:43.600Z","0.2.3":"2021-09-23T15:58:08.262Z","0.2.4":"2021-10-06T17:58:36.563Z","0.3.0":"2021-11-10T00:35:38.717Z","0.4.0":"2021-11-26T14:43:06.665Z","0.4.1":"2021-11-26T16:16:36.262Z","0.4.2-unstable.1":"2021-11-26T21:02:27.640Z","0.4.2-unstable.2":"2021-11-26T21:18:22.175Z","0.4.2-unstable.3":"2021-11-26T22:36:18.813Z","0.4.2-unstable.4":"2021-11-26T22:42:42.691Z","0.4.2-unstable.5":"2021-11-26T23:01:33.133Z","0.4.2-unstable.6":"2021-11-27T00:09:27.302Z","0.4.2-unstable.7":"2021-11-27T00:21:51.251Z","0.4.2-unstable.8":"2021-11-27T00:39:18.561Z","0.4.2-unstable.9":"2021-11-27T00:57:31.008Z","0.4.2-unstable.10":"2021-11-27T01:04:59.584Z","0.4.2-unstable.11":"2021-11-27T01:08:02.592Z","0.4.2-unstable.12":"2021-11-27T01:15:18.301Z","0.4.2-unstable.13":"2021-11-27T01:43:03.992Z","0.4.2-unstable.14":"2021-11-27T04:43:05.602Z","0.4.2-unstable.15":"2021-11-27T15:06:23.833Z","0.4.2-unstable.16":"2021-11-27T15:06:40.544Z","0.4.2-unstable.17":"2021-11-27T15:10:19.865Z","0.4.2-unstable.18":"2021-11-27T15:12:17.564Z","0.5.0-unstable.1":"2021-11-28T02:04:41.393Z","0.5.0-unstable.2":"2021-11-28T02:17:42.656Z","0.5.0":"2021-11-29T12:39:38.955Z","0.5.1":"2021-12-03T16:13:21.611Z"},"maintainers":[{"name":"bramtencate","email":"btencate@sphereon.com"},{"name":"nklomp","email":"nklomp@sphereon.com"},{"name":"nklomp78","email":"dev@sphereon.com"},{"name":"spostma","email":"spostma@sphereon.com"}],"description":"A Typescript implementation of the DIF Presentation Exchange specification.","keywords":["SSI","Presentation Exchange","Verifiable Credentials","Verifiable Presentations","Selective Disclosure","DIF"],"repository":{"type":"git","url":"https://github.com/Sphereon-Opensource/pe-js.git"},"license":"Apache-2.0","readme":"<h1 align=\"center\">\n  <br>\n  <a href=\"https://www.sphereon.com\"><img src=\"https://sphereon.com/content/themes/sphereon/assets/img/logo.svg\" alt=\"Sphereon\" width=\"400\"></a>\n  <br>PE-JS   DIF Presentation Exchange Type/JavaScript Library \n  <br>\n</h1>\n\n[![CI](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml/badge.svg)](https://github.com/Sphereon-Opensource/pe-js/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/Sphereon-Opensource/pe-js/branch/develop/graph/badge.svg?token=9P1JGUYA35)](https://codecov.io/gh/Sphereon-Opensource/pe-js) [![NPM Version](https://img.shields.io/npm/v/@sphereon/pe-js.svg)](https://npm.im/@sphereon/pe-js)\n\n## Active Development\n\n_IMPORTANT: This software still is in early development stage. As such you should expect breaking changes in APIs, we\nexpect to keep that to a minimum though._\n\n## Background\n\nThe PE-JS Library is a general use presentation exchange library that implements the functionality described in\nthe [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/). It is written\nin Typescript and can be compiled to any target JavaScript version.\n\nSphereon's PE Library is useful for both verifier systems and holders (e.g. wallets) and can be used in client side\nbrowsers and mobile applications as well as on server side technology such as REST APIs (e.g. built with NodeJS). It\nallows anyone to add DIF Presentation Exchange logic to their existing wallets, agents and/or verifiers, without making\nany further assumptions about the technologies used in their products.\n\nThe presentation exchange operates generally as follows; The verifier creates a Presentation Definition asking for\ncredentials from the holder. The definition for the credentials is sent to the holder, who returns a presentation as a\nresponse. Now the verifier will verify the presentation by checking the signature and other accompanying proofs.\n\nThe presentation exchange will ensure that the model used by the verifier, can be interpreted by the holder. It then\nensures that the correct parts from the holders credentials are used to create the presentation. The PE contains all the\nlogic to interpret the models, therefore removing the need for the verifier and holder to align their specific models.\n\nThe data objects (models) used in PE-JS are generated from Sphereon's DIF PE OpenAPI Spec component. The code for the\ncomponent can be seen at [PE-OpenAPI github repository](https://github.com/Sphereon-Opensource/pe-openapi). This allows\nthe generation of the objects in many languages and frameworks consistently by configuring the maven plugin.\n\n### The PE Library supports the following actions:\n\n* Creating a presentation definition / request\n* Validating a presentation definition / conforming to the specification\n* Creating a Presentation\n* Creating a Verifiable Presentation using a callback function\n* Validating a presentation (submission) when received\n* Input evaluations: Verification of presentation submissions conforming to the presentation definition\n* Utilities: to build and use different models compliant with\n  the [DIF Presentation Exchange v1.0.0 specification](https://identity.foundation/presentation-exchange/).\n\nStateful storage, signature support or credential management should be implemented in separate libraries/ modules that\nmake use of the underlying DIF Presentation Exchange implementation. By keeping these separate, the library will stay\nplatform agnostic and lean with regards to dependencies.\n\n## For PE-JS Users\n\nThe library can be installed direction from npmjs via:\n\n```shell\n# install via yarn\n  yarn add @sphereon/pe-js\n\n# install via npm\n  npm install @sphereon/pe-js\n```\n\nThe core functionality of the DIF Presentation Exchange can be outlined as follows:\n\n* Input Evaluation\n* Credential Query\n* Presentation and Verifiable Presentation creation\n* Utilities\n\n### Input Evaluation\n\nInput evaluation is the primary mechanism by which a verifier determines whether a presentation submission from a holder\nmatches the requested presentation definition from the request.\n\n```typescript\n  import pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  \"id\": \"32f54163-7166-48f1-93d8-ff217bdb0653\",\n  \"input_descriptors\": [\n    {\n      \"id\": \"wa_driver_license\",\n      \"name\": \"Washington State Business License\",\n      \"purpose\": \"We can only allow licensed Washington State business representatives into the WA Business Conference\",\n      \"schema\": [{\n        \"uri\": \"https://licenses.example.com/business-license.json\"\n      }]\n    }\n  ]\n};\n\nconst verifiablePresentation = {\n  '@context': [\n    \"https://www.w3.org/2018/credentials/v1\",\n    \"https://identity.foundation/presentation-exchange/submission/v1\"\n  ],\n  type: [\n    \"VerifiablePresentation\",\n    \"PresentationSubmission\"\n  ],\n  presentation_submission: { ... },\n  verifiableCredential: [...],\n  proof: { ... }\n}\n\nconst { value, warnings, errors } = pejs.evaluate(presentationDefinition, verifiablePresentation);\n```\n\n### Credential Query\n\nA credential query allows holders to filter their set of credentials for matches to a given presentation definition.\n\n```typescript\n  import pejs from '@sphereon/pe-js';\n\n// Definition from verifier request\nconst presentationDefinition = {\n  ...\n};\n\n// Example for loading credentials\nconst credentials = await secureStore.getCredentials();\n\n// Find matching credentials\nconst srMatches = pejs.selectFrom(presentationDefinition, credentials, holderDid);\n\n// An example that selects the first 'count' credentials from\n// the matches. in a real scenario, the user has to select which \n// credentials to use. PE-JS did the first filtering, \n// but there still could be multiple credentials satisfying a presentation definition\nconst selectedCredentials = srMatches.map(\n  ({ matches, count }) => matches.slice(0, count)\n).flat();\n\n\n```\n\n### Presentation creation (non verifiable)\n\nTo create a Presentation without Proof (for Proofs, see Verifiable Presentation below) you have to pass in the\nPresentation Definition, selected Verifiable Credentials and an optional holder (DID). The result will be a Verifiable\nPresentation, without proofs, so actually a Presentation. It also contains the presentation submission data that the\nverifier can use.\n\nIt is left up to you to sign the Presentation and adding the proof and make it a truly Verifiable Presentation. There\nare different libraries that allow you to do this. You can also use the callback integration mentioned in the next\nchapter for this.\n\n```typescript\n  import { pejs, Presentation } from '@sphereon/pe-js';\n\n// Construct presentation from selected credentials\nconst presentation: Presentation = pejs.presentationFrom(presentationDefinition, selectedCredentials, holderDID);\n/** presentation object:\n *\n *   {\n *     \"@context\": [\n *       \"https://www.w3.org/2018/credentials/v1\",\n *       \"https://identity.foundation/presentation-exchange/submission/v1\"\n *     ],\n *     \"type\": [\n *       \"VerifiablePresentation\",\n *       \"PresentationSubmission\"\n *     ],\n *     presentation_submission: presentationSubmission,\n *     verifiableCredential: selectedCredentials\n *   };\n */\n// Presentation would need to be signed and sent to verifier\n```\n\n### Verifiable Presentation with callback\n\n**NOTE:** PE-JS does not support the creation of signatures by itself. That has to do with the fact that we didn't want\nto rely on all kinds of signature suites and libraries. PE-JS has minimal dependencies currently, so that it can be used\nin all kinds of scenarios.\n\nHow did we solve this? We have created a callback mechanism, allowing you to create a callback function that gets all\ninput allowing you to use your library of choice to create the signature. The callback needs to accept\na `PresentationSignCallBackParams` object.\n\nThe method `verifiablePresentationFrom` accepts the presentation definition and selected Verifiable Credentials as the\nfirst two arguments, just like the `presentationFrom` method. Next it accepts the callback function as argument and\na `PresentationSignOptions` object as last argument. The sign callback params, allow you to control the signature\nprocess. You will have access in the callback to these params as well.\n\nBefore calling your callback function a few things happen. First of all, just like the `presentationFrom` method, it\nwill evaluate whether the supplied credentials conform to the supplied presentation definition. Then it creates a\npresentation, just like `presentationFrom`. This presentation is provided for your convenience and can be used in your\ncallback for simple use cases. In more elaborate cases, like for instance with more complex signature suites and/or\nselective disclosure, you will probably not use the Presentation directly and make use of other arguments passed into\nthe callback, like the `EvaluationResults`, `PresentationSubmission` and `Partial<Proof>`.\n\nThe `proofOptions` and `signatureOptions`, allow you to populate proof values directly. in which case\nthe `Partial<Proof>` will have all fields filled to just add it as a proof to the presentation in your callback. This\ndoes mean you would have to create the Presentation first and sign that, which means you probably have no use for the\ncallback. If you do not provide these values, the `Partial<Proof>`, will still be populated without the proofValue and\njws, based upon your options.\n\n#### Presentation Sign Options\n\nThe options accepted by the `verifiablePresentationFrom` are:\n\n````typescript\ninterface PresentationSignOptions {\n  /**\n   * The optional holder of the presentation\n   */\n  holder?: string;\n\n  /**\n   * Proof options\n   */\n  proofOptions?: ProofOptions;\n\n  /**\n   * The signature options\n   */\n  signatureOptions?: SignatureOptions;\n}\n\ninterface ProofOptions {\n  /**\n   * The signature type. For instance RsaSignature2018\n   */\n  type?: ProofType | string;\n\n  /**\n   * Type supports selective disclosure?\n   */\n  typeSupportsSelectiveDisclosure?: boolean;\n\n  /**\n   * A challenge protecting against replay attacks\n   */\n  challenge?: string;\n\n  /**\n   * A domain protecting against replay attacks\n   */\n  domain?: string;\n\n  /**\n   * The purpose of this proof, for instance assertionMethod or authentication, see https://www.w3.org/TR/vc-data-model/#proofs-signatures-0\n   */\n  proofPurpose?: ProofPurpose | string;\n\n  /**\n   * The ISO8601 date-time string for creation. You can update the Proof value later in the callback. If not supplied the current date/time will be used\n   */\n  created?: string;\n\n  /**\n   * Similar to challenge. A nonce to protect against replay attacks, used in some ZKP proofs\n   */\n  nonce?: string;\n}\n\n\ninterface SignatureOptions {\n  /**\n   * The private key\n   */\n  privateKey?: string;\n\n  /**\n   * Key encoding\n   */\n  keyEncoding?: KeyEncoding;\n\n  /**\n   * The verification method value\n   */\n  verificationMethod?: string;\n\n  /**\n   * Can be used if you want to provide the Json-ld proof value directly without relying on the callback function generating it\n   */\n  proofValue?: string; // One of any number of valid representations of proof values\n\n  /**\n   * Can be used if you want to provide the JSW proof value directly without relying on the callback function generating it\n   */\n  jws?: string; // JWS based proof\n}\n````\n\nThese options are available in your callback function by accessing the `options` field in\nthe `PresentationSignCallBackParams`.\n\n#### Callback params object\n\nThe callback params gets supplied as the single argument to your callback function. It contains the `Presentation`, a\npartial 'Proof' typically missing the proofValue/jws signature. It also contains the initially supplied Verifiable\nCredentials and Presentation Definition as well as your supplied options.\n\nIf contains the Presentation Submission object, which is also found in the presentation. You can use this to create your\nown Presentation object if you want. Lastly it contains the evaluation results, which includes the mappings and logs\nabout the evaluation.\n\nYou can either choose to use the `Presentation` and partial `Proof` together with the `options`, or in more elaborate\nuse cases opt to use the `PresentationSubmission`, `EvaluationResults` and the `options` for instance.\n\n````typescript\nexport interface PresentationSignCallBackParams {\n\n  /**\n   * The originally supplied presentation sign options\n   */\n  options: PresentationSignOptions;\n\n  /**\n   * The presentation definition\n   */\n  presentationDefinition: PresentationDefinition;\n\n  /**\n   * The selected credentials to include in the eventual VP as determined by PE-JS and/or user\n   */\n  selectedCredentials: VerifiableCredential[];\n\n  /**\n   * The presentation object created from the definition and verifiable credentials.\n   * Can be used directly or in more complex situations can be discarded by using the definition, credentials, proof options, submission and evaluation results\n   */\n  presentation: Presentation;\n\n  /**\n   * A partial proof value the callback can use to complete. If proofValue or JWS was supplied the proof could be complete already\n   */\n  proof: Partial<Proof>;\n\n  /**\n   * The presentation submission data, which can also be found in the presentation itself\n   */\n  presentationSubmission: PresentationSubmission;\n\n  /**\n   * The evaluation results, which the callback function could use to create a VP using the proof(s) using the supplied credentials\n   */\n  evaluationResults: EvaluationResults;\n}\n````\n\n#### Simple example of the callback function\n\nA simple use case using your library of choice for non-selective disclosure using an ed25519 key and signature.\n\n````typescript\nimport {\n  pejs,\n  Proof,\n  ProofPurpose,\n  ProofType,\n  VerifiablePresentation,\n  PresentationSignOptions,\n  KeyEncoding\n} from '@sphereon/pe-js';\n\nconst params: PresentationSignOptions = {\n  holder: 'did:example:1234....',\n  proofOptions: {\n    type: ProofType.Ed25519Signature2018,\n    proofPurpose: ProofPurpose.assertionMethod,\n  },\n  signatureOptions: {\n    verificationMethod: 'did:example:\"1234......#key',\n    keyEncoding: KeyEncoding.Base58,\n    privateKey: 'base58 (key encoding type) key here',\n  }\n}\n\nconst vp = pejs.verifiablePresentationFrom(presentationDefinition, selectedCredentials, simpleSignedProofCallback, params);\n\nfunction simpleSignedProofCallback(callBackParams: PresentationSignCallBackParams): VerifiablePresentation {\n  // Prereq is properly filled out `proofOptions` and `signatureOptions`, together with a `proofValue` or `jws` value.\n  // And thus a generated signature\n  const { presentation, proof, options } = callBackParams; // The created partial proof and presentation, as well as original supplied options\n  const { signatureOptions, proofOptions } = options; // extract the orignially supploed signature and proof Options\n  const privateKeyBase58 = signatureOptions.privateKey; // Please check keyEncoding from signatureOptions first!\n\n  /**\n   * Proof looks like this:\n   * {\n   *    type: 'Ed25519Signature2018',\n   *    created: '2021-12-01T20:10:45.000Z',\n   *    proofPurpose: 'assertionMethod',\n   *    verificationMethod: 'did:example:\"1234......#key',\n   *    .....\n   * }\n   */\n\n    // Just an example. Obviously your lib will have a different method signature\n  const vp = myVPSignLibrary(presentation, { ...proof, privateKeyBase58 });\n\n  return vp;\n}\n\n\n````\n\n### Utilities\n\nIn addition to the core functionality above, the underlying validation methods are exposed as low-level helper\nfunctions.\n\n```typescript\nimport pejs from '@sphereon/pe-js';\n\nconst presentationDefinition = {\n  ...\n};\n\nconst { warnings: pdWarnings, errors: pdErrors } = pejs.validateDefinition(presentationDefinition);\n\nconst presentationSubmission = {\n  ...\n};\n\nconst { warnings: psWarnings, errors: psErrors } = pejs.validateSubmission(presentationSubmission);\n```\n\n## API\n\n### Evaluate\n\n```typescript\nevaluate(presentationDefinition, verifiablePresentation)\n```\n\n##### Description\n\nEvaluates whether a presentation submission meets the requested presentation definition Since this method will be used\nboth **before** and **after** creating a VerifiablePresentation, we accept both _signed_ and _unsigned_ version of a\npresentation here.\n\n#### Parameters\n\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `presentation` | `Presentation` | the Presentation object containing the required credentials and a `presentation_submission` object mapping back to the presentation definition |\n\n#### Return value\n\nIf evaluation is successful, `value` will be a non-null `PresentationSubmission` mapping the submitted credentials to\nthe requested inputs.\n\n```typescript\ninterface EvaluationResults {\n  value?: PresentationSubmission;\n  warnings?: string[];\n  errors?: Error[];\n  verifiableCredential: VerifiableCredential[];\n}\n```\n\n### SelectFrom\n\n```typescript\nselectFrom(presentationDefinition, credentials, holderDids)\n```\n\n##### Description\n\nGathers the matching credentials that fit a given presentation definition\n\n#### Parameters\n\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `credentials` | `VerifiableCredential[]` | the array of verifiable credentials to select from |\n| `holderDids` | `string[]` | the holder's dids. this can be found in VerifiablePresentation's holder property note that a wallet can have many holderDids retrieved from different places|\n\n#### Return value\n\n- If the selection was successful or partially successful, the `matches` array will consist\n  of `SubmissionRequirementMatch` object(s), representing the matching credentials for each `SubmissionRequirement` in\n  the `presentationDefinition` input parameter.\n- If the selection was not successful, the `errors` array will consist of `Checked` object(s), representing what has\n  failed in your selection process.\n\n```typescript\nimport { Status } from './ConstraintUtils';\n\ninterface SelectResults {\n  errors?: Checked[];\n  matches?: SubmissionRequirementMatch[];\n  /**\n   * This is the parameter that pejs library user should look into to determine what to do next\n   * Status can have three values:\n   *  1. INFO: everything is fine, you can call `presentationFrom` after this method\n   *  2. WARN: method was called with more credentials than required.\n   *       To enhance credential holder's privacy it is recommended to select credentials which are absolutely required.\n   *  3. Error: the credentials you've sent didn't satisfy the requirement defined presentationDefinition object\n   */\n  areRequiredCredentialsPresent: Status;\n  /**\n   * All matched/selectable credentials\n   */\n  verifiableCredential?: VerifiableCredential[];\n  /**\n   * Following are indexes of the verifiableCredentials passed to the selectFrom method that have been selected.\n   */\n  vcIndexes?: number[];\n  warnings?: Checked[];\n}\n\ninterface SubmissionRequirementMatch {\n  name?: string;\n  rule: Rules;\n  min?: number;\n  count?: number;\n  max?: number;\n  vc_path: string[];\n  from?: string[];\n  from_nested?: SubmissionRequirementMatch[]; // VerifiableCredential Address\n}\n```\n\n### PresentationFrom\n\n```typescript\npresentationFrom(presentationDefinition, selectedCredentials, holderDID)\n```\n\n##### Description\n\nCreates the corresponding Presentation Submission object to be included in the Verifiable Presentation response, which\nmaps the submitted credentials to the requested inputs in the `presentationDefinition` input parameter.\n\n#### Parameters\n\n| name | type | description|\n|------|------|------------|\n| `presentationDefinition` | `PresentationDefinition` | the presentation definition that initiated the request from the verifier |\n| `selectedCredentials` | `VerifiableCredential[]` | the array of verifiable credentials that meet the submission requirements in the presentation definition |\n| `holderDid` | `string` | the holder's DID. This can be found in VerifiablePresentation's holder property note that a wallet can have many holderDIDs retrieved from different places|\n\n#### Return value\n\nIf the selected credentials successfully match the submission requirements in the presentation definition, the return\nvalue will be a non-null `PresentationSubmission`\n\n```typescript\ninterface PresentationSubmission {\n  id?: string;\n  definition_id: string;\n  descriptor_map: Descriptor[]\n}\n```\n\n### Validation\n\n```typescript\nvalidateDefinition(objToValidate)\n```\n\n```typescript\nvalidateSubmission(objToValidate)\n```\n\n#### Description\n\nA validation utility function for `PresentationDefinition` and `PresentationSubmission` objects.\n\n#### Parameters\n\n| name | type | description|\n|------|------|------------|\n| `objToValidate` | <code>PresentationDefinition &#124; PresentationSubmission</code> | the presentation definition or presentation definition to be validated |\n\n#### Return value\n\nThe `validate` method returns a validated results array `NonEmptyArray<Checked>` , with structure:\n\n```typescript\ninterface Checked {\n  tag: string;\n  status: Status;\n  message?: string;\n}\n```\n\nstatus can have following values `'info' | 'warn' | 'error'`\n\n## Workflow Diagram\n\n![Flow diagram](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/Sphereon-Opensource/pe-js/develop/docs/simple-scenario.puml)\n\n## For PE-JS developers\n\nThis project has been created using:\n\n* `yarn` version 1.22.5\n* `node` version 12.22.1\n\n### Install\n\n   ```shell\n   yarn install\n   ```\n\n### Build\n\n   ```shell\n   yarn build\n   ```\n\n### Test\n\nThe test command runs:\n\n* `eslint`\n* `prettier`\n* `unit`\n\nYou can also run only a single section of these tests, using for example `yarn test:unit`.\n\n   ```shell\n   yarn test\n   ```\n\n### Utility scripts\n\nThere are several other utility scripts that help with development.\n\n* `yarn fix` - runs `eslint --fix` as well as `prettier` to fix code style\n* `yarn cov` - generates code coverage report\n\n# Glossary\n\nTerm | Definition |\n---- | ---------- |\nCredential | A set of one or more claims made by an issuer. |\nVerifiable Credential |  Is a tamper-evident credential that has authorship that can be cryptographically verified. Verifiable credentials can be used to build verifiable presentations, which can also be cryptographically verified. The claims in a credential can be about different subjects. |\nPresentation Definition | Presentation Definitions are objects that articulate what proofs a Verifier requires. |\nHolder | Holders are entities that have one or more verifiable credentials in their possession. Holders are also the entities that submit proofs to Verifiers to satisfy the requirements described in a Presentation Definition.\nHolder's Did | Unique ID URI string and PKI metadata document format for describing the cryptographic keys and other fundamental PKI values linked to a unique, user-controlled, self-sovereign identifier in holder's wallet|\nVerifier | Verifiers are entities that define what proofs they require from a Holder (via a Presentation Definition) in order to proceed with an interaction. |\nIssuer | A role an entity can perform by asserting claims about one or more subjects, creating a verifiable credential from these claims, and transmitting the verifiable credential to a holder. |\nPresentation | Data derived from one or more verifiable credentials, issued by one or more issuers |\nVerifiable Presentation | Is a tamper-evident presentation encoded in such a way that authorship of the data can be trusted after a process of cryptographic verification.\n\n## Further work:\n\n1. Implementation of presentation-exchange v2\n2. In the [DIF documentation](https://identity.foundation/presentation-exchange/#input-evaluation) some entries are\n   addressing `nested credentials` and `nested paths` these are currently not fully support yet.\n","readmeFilename":"README.md"}